Skip to content

Commit

Permalink
Merge pull request #214 from WildcardSearch/major-18
Browse files Browse the repository at this point in the history
ASB 3.0 Release
  • Loading branch information
Mark Vincent authored Oct 13, 2016
2 parents 39ed0b8 + 6d89a79 commit b763d21
Show file tree
Hide file tree
Showing 66 changed files with 1,192 additions and 1,650 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Advanced-Sidebox 2.1.1
## Advanced-Sidebox 3.0

<p align="center">
<img title="Advanced Sidebox Logo" alt="Advanced Sidebox Logo" src="https://github.com/WildcardSearch/Advanced-Sidebox/wiki/asb_logo_320.png" />
<img title="Advanced Sidebox Logo" alt="Advanced Sidebox Logo" src="http://i.imgur.com/4QWLq5V.png" />
</p>

*A plugin for MyBB forums that displays custom boxes on various forum pages.*
Expand Down
39 changes: 14 additions & 25 deletions Upload/admin/jscripts/asb/asb.js
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")
});
}
});
5 changes: 2 additions & 3 deletions Upload/admin/jscripts/asb/asb.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

108 changes: 29 additions & 79 deletions Upload/admin/jscripts/asb/asb_modal.js
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);
13 changes: 5 additions & 8 deletions Upload/admin/jscripts/asb/asb_modal.min.js
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);
Loading

0 comments on commit b763d21

Please sign in to comment.