-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #214 from WildcardSearch/major-18
ASB 3.0 Release
- Loading branch information
Showing
66 changed files
with
1,192 additions
and
1,650 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,23 @@ | ||
/* | ||
* Plugin Name: Advanced Sidebox for MyBB 1.6.x | ||
* Plugin Name: Advanced Sidebox for MyBB 1.8.x | ||
* Copyright 2014 WildcardSearch | ||
* http://www.rantcentralforums.com | ||
* | ||
* this file contains JavaScript for the ACP functions | ||
*/ | ||
|
||
(function() { | ||
/** | ||
* init() | ||
* | ||
* observe help links | ||
* | ||
* @return: n/a | ||
*/ | ||
function init() { | ||
if ($('help_link')) { | ||
$('help_link').observe('click', function(event) { | ||
Event.stop(event); | ||
MyBB.popupWindow(this.href, 'asbHelp', 840, 520); | ||
}); | ||
} | ||
|
||
if ($('help_link_icon')) { | ||
$('help_link_icon').observe('click', function(event) { | ||
Event.stop(event); | ||
MyBB.popupWindow(this.up('a').href, 'asbHelp', 840, 520); | ||
}); | ||
} | ||
$(function() { | ||
if ($('#help_link')) { | ||
$('#help_link').click(function(event) { | ||
event.preventDefault(); | ||
window.open(this.href, 'asbHelp', "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes.width=840,height=520") | ||
}); | ||
} | ||
|
||
Event.observe(window, 'load', init); | ||
})(); | ||
if ($('#help_link_icon')) { | ||
$('#help_link_icon').click(function(event) { | ||
event.preventDefault(); | ||
window.open(this.href, 'asbHelp', "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes.width=840,height=520") | ||
}); | ||
} | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,39 @@ | ||
/* | ||
* Plugin Name: Advanced Sidebox for MyBB 1.6.x | ||
* Plugin Name: Advanced Sidebox for MyBB 1.8.x | ||
* Copyright 2014 WildcardSearch | ||
* http://www.rantcentralforums.com | ||
* | ||
* extend MyModal class to work around this Prototype error: | ||
* https://prototype.lighthouseapp.com/projects/8886/tickets/1384 | ||
* intercept the submit button, submit | ||
* with ajax, and eval return scripts | ||
*/ | ||
|
||
var ASB = (function(a) { | ||
/** | ||
* submit() | ||
* | ||
* serialize and send the form data, replacing any multiple select | ||
* elements with an array of hidden inputs to overcome a limitation | ||
* of the Prototype JS library when serializing multiple | ||
* select elements | ||
* | ||
* @param - e - (Event) the submit event object | ||
* @return: n/a | ||
*/ | ||
function submit(e) { | ||
var form, select, selects, option, options, newElement, s, o; | ||
|
||
Event.stop(e); | ||
this.showOverlayLoader(); | ||
|
||
// get all the select elements on this form | ||
form = $(this.options.formId); | ||
selects = $$('#' + this.options.formId + ' select'); | ||
|
||
for (s = 0; s < selects.length; s++) { | ||
select = selects[s]; | ||
if (!select.multiple) { | ||
continue; | ||
} | ||
|
||
// get all the options in this select element | ||
options = select.childElements(); | ||
for (o = 0; o < options.length; o++) { | ||
option = options[o]; | ||
if (option.nodeName != 'OPTION' || !option.selected) { | ||
continue; | ||
} | ||
|
||
form.insert(new Element('input', { | ||
type: 'hidden', | ||
name: select.getAttribute('name'), | ||
value: option.value | ||
})); | ||
} | ||
|
||
// remove the select element once it is replaced | ||
select.remove(); | ||
} | ||
|
||
// send the post data | ||
var postData = form.serialize(); | ||
new Ajax.Request(this.options.url, { | ||
method: 'post', | ||
postBody: postData + '&ajax=1&time=' + new Date().getTime(), | ||
onComplete: this.onComplete.bind(this), | ||
}); | ||
(function($) { | ||
function init() { | ||
$("#modalSubmit").click(submitForm); | ||
} | ||
|
||
/** | ||
* displayModal() | ||
* | ||
* intercept module errors if necessary | ||
* | ||
* @param - $super - (Function) the parent function | ||
* @param - data - (String) the HTML | ||
* @return: n/a | ||
*/ | ||
function displayModal($super, data) { | ||
if(data == '<error>asb</error>') { | ||
window.location = "./index.php?module=config-asb"; | ||
return; | ||
} | ||
$super(data); | ||
function submitForm (e) { | ||
e.preventDefault(); | ||
|
||
$.ajax({ | ||
type: "POST", | ||
url: $("#modal_form").attr('action'), | ||
data: $("#modal_form").serialize(), | ||
success: function(data) { | ||
$(data).filter("script").each(function(e) { | ||
eval($(this).text()); | ||
}); | ||
$.modal.close(); | ||
}, | ||
error: function(jqXHR, textStatus, errorThrown) { | ||
alert('error' + | ||
"\n\n" + | ||
textStatus + | ||
"\n\n" + | ||
errorThrown); | ||
}, | ||
}); | ||
} | ||
|
||
a.Modal = Class.create(MyModal, { | ||
submit: submit, | ||
displayModal: displayModal, | ||
}); | ||
|
||
return a; | ||
})(ASB || {}); | ||
$(init); | ||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
var ASB=(function(a){function submit(e){var form,select,selects,option,options,newElement,s,o;Event.stop(e);this.showOverlayLoader();form=$(this.options.formId);selects=$$('#'+this.options.formId+' select');for(s=0;s<selects.length;s++){select=selects[s];if(!select.multiple){continue;} | ||
options=select.childElements();for(o=0;o<options.length;o++){option=options[o];if(option.nodeName!='OPTION'||!option.selected){continue;} | ||
form.insert(new Element('input',{type:'hidden',name:select.getAttribute('name'),value:option.value}));} | ||
select.remove();} | ||
var postData=form.serialize();new Ajax.Request(this.options.url,{method:'post',postBody:postData+'&ajax=1&time='+new Date().getTime(),onComplete:this.onComplete.bind(this),});} | ||
function displayModal($super,data){if(data=='<error>asb</error>'){window.location="./index.php?module=config-asb";return;} | ||
$super(data);} | ||
a.Modal=Class.create(MyModal,{submit:submit,displayModal:displayModal,});return a;})(ASB||{}); | ||
(function($){function init(){$("#modalSubmit").click(submitForm);} | ||
function submitForm(e){e.preventDefault();$.ajax({type:"POST",url:$("#modal_form").attr('action'),data:$("#modal_form").serialize(),success:function(data){$(data).filter("script").each(function(e){eval($(this).text());});$.modal.close();},error:function(jqXHR,textStatus,errorThrown){alert('error'+"\n\n"+ | ||
textStatus+"\n\n"+ | ||
errorThrown);},});} | ||
$(init);})(jQuery); |
Oops, something went wrong.