Skip to content

Commit

Permalink
Merge pull request #199 from WildcardSearch/minor
Browse files Browse the repository at this point in the history
2.1 Release
  • Loading branch information
Mark Vincent committed May 5, 2014
2 parents 45e9068 + e00e5e3 commit 59840b4
Show file tree
Hide file tree
Showing 52 changed files with 2,368 additions and 1,278 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Advanced-Sidebox 2.0.7
## Advanced-Sidebox 2.1

<p align="center">
<img title="Advanced Sidebox Logo" alt="Advanced Sidebox Logo" src="https://github.com/WildcardSearch/Advanced-Sidebox/wiki/asb_logo_320.png" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
* this file contains JavaScript for the ACP functions
*/

ASB = {
(function() {
/**
* init()
*
* observe help links
*
* @return: n/a
*/
init: function()
{
function init() {
if ($('help_link')) {
$('help_link').observe('click', function(event) {
Event.stop(event);
Expand All @@ -30,5 +29,6 @@ ASB = {
});
}
}
};
Event.observe(window, 'load', ASB.init);

Event.observe(window, 'load', init);
})();
3 changes: 3 additions & 0 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.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
* https://prototype.lighthouseapp.com/projects/8886/tickets/1384
*/

MyModal = Class.create(MyModal,
{
var ASB = (function(a) {
/**
* submit()
*
Expand All @@ -17,16 +16,16 @@ MyModal = Class.create(MyModal,
* of the Prototype JS library when serializing multiple
* select elements
*
* @param - event - (Event) the submit event object
* @param - e - (Event) the submit event object
* @return: n/a
*/
submit: function(event)
{
Event.stop(event);
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
var form, select, selects, option, options, newElement, s, o;
form = $(this.options.formId);
selects = $$('#' + this.options.formId + ' select');

Expand Down Expand Up @@ -63,4 +62,28 @@ MyModal = Class.create(MyModal,
onComplete: this.onComplete.bind(this),
});
}
});

/**
* 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);
}

a.Modal = Class.create(MyModal, {
submit: submit,
displayModal: displayModal,
});

return a;
})(ASB || {});
8 changes: 8 additions & 0 deletions Upload/admin/jscripts/asb/asb_modal.min.js

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

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* this file contains JavaScript for the ACP script edit functions
*/

ASBScript = {
current: '',
var ASB = (function(a) {
var current = '';

/**
* init()
Expand All @@ -18,8 +18,7 @@ ASBScript = {
*
* @return: n/a
*/
init: function()
{
function init() {
// only show replace all options when selected
new Peeker($$(".replace_all"), $("replace_content"), /1/, true);

Expand Down Expand Up @@ -51,13 +50,13 @@ ASBScript = {

// watch the 'detected' selectors and send the chosen
// item to the appropriate text box
ASBScript.observeInputs();
observeInputs();

// watch the file name input and if it has changed on blur
// attempt to detect hooks, template and URL attributes (page, action)
// and display them as selectable lists
$('filename').observe('blur', ASBScript.update);
},
$('filename').observe('blur', update);
}

/**
* update()
Expand All @@ -67,15 +66,14 @@ ASBScript = {
* @param - event - (Event) the blur event object
* @return: n/a
*/
update: function(event)
{
function update(event) {
// if nothing has changed, get out
if (this.value == ASBScript.current || this.value == '') {
if (this.value == current || this.value == '') {
return;
}

// otherwise, update the current script
ASBScript.current = this.value;
current = this.value;

// hide the 'detected' selectors
$('hook_list').hide();
Expand All @@ -90,16 +88,15 @@ ASBScript = {

// attempt to get the info
new Ajax.Request('index.php', {
parameters:
{
parameters: {
module: 'config-asb',
action: 'xmlhttp',
mode: 'analyze_script',
filename: this.value
},
onSuccess: ASBScript.showResults
onSuccess: showResults
});
},
}

/**
* showResults()
Expand All @@ -109,8 +106,7 @@ ASBScript = {
* @param - response - (Response) the XMLHTTP response object
* @return: n/a
*/
showResults: function(response)
{
function showResults(response) {
// hide all the spinners
var spinners = $$('div.ajax_spinners');
for (x = 0; x < spinners.length; ++x) {
Expand All @@ -126,24 +122,24 @@ ASBScript = {
var info = response.responseText.evalJSON();

// if there is info, show it
if (info['hooks']) {
$('hook_list').innerHTML = info['hooks'];
if (info.hooks) {
$('hook_list').update(info.hooks);
$('hook_list').show();
}

if (info['templates']) {
$('template_list').innerHTML = info['templates'];
if (info.templates) {
$('template_list').update(info.templates);
$('template_list').show();
}

if (info['actions']) {
$('action_list').innerHTML = info['actions'];
if (info.actions) {
$('action_list').update(info.actions);
$('action_list').show();
}

// re-do our observation of the selectors now that they have been rebuilt
ASBScript.observeInputs();
},
observeInputs();
}

/**
* observeInputs()
Expand All @@ -153,8 +149,7 @@ ASBScript = {
* @param - response - (Response) the XMLHTTP response object
* @return: n/a
*/
observeInputs: function ()
{
function observeInputs() {
if ($('hook_selector')) {
$('hook_selector').observe('change', function(event) {
$('hook').value = this.value;
Expand All @@ -173,5 +168,24 @@ ASBScript = {
});
}
}
};
Event.observe(window, 'load', ASBScript.init);

/**
* setCurrent()
*
* public setter
*
* @param - value - (String) the current file name
* @return: n/a
*/
function setCurrent(value) {
current = value || '';
}

Event.observe(window, 'load', init);

a.scripts = {
setCurrent: setCurrent,
};

return a;
})(ASB || {});
17 changes: 17 additions & 0 deletions Upload/admin/jscripts/asb/asb_scripts.min.js

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

Loading

0 comments on commit 59840b4

Please sign in to comment.