diff options
author | Callum Macrae <callum@lynxphp.com> | 2011-07-24 18:11:14 +0100 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-03-31 02:09:11 +0200 |
commit | 57fa45b0c43ba732886ada24dbd6a590fd55d717 (patch) | |
tree | b5f8e131fe373d9ea2dcdc17c515f1a42aa0ac73 | |
parent | efe872745faf2715b568a503384ea7f198809716 (diff) | |
download | forums-57fa45b0c43ba732886ada24dbd6a590fd55d717.tar forums-57fa45b0c43ba732886ada24dbd6a590fd55d717.tar.gz forums-57fa45b0c43ba732886ada24dbd6a590fd55d717.tar.bz2 forums-57fa45b0c43ba732886ada24dbd6a590fd55d717.tar.xz forums-57fa45b0c43ba732886ada24dbd6a590fd55d717.zip |
[ticket/10271] AJAXified Quick-mod tools.
Also made some improvements to the exceptions.
PHPBB3-10271
-rw-r--r-- | phpBB/styles/script.js | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/phpBB/styles/script.js b/phpBB/styles/script.js index 99a73769b4..b73c392312 100644 --- a/phpBB/styles/script.js +++ b/phpBB/styles/script.js @@ -103,14 +103,6 @@ phpbb.ajaxify = function(options, refresh, callback) { $(selector).click(function() { var act, data, path, that = this; - if (typeof options.exception !== 'undefined') - { - if (options.exception(this)) - { - return true; - } - } - function return_handler(res) { res = JSON.parse(res); @@ -153,6 +145,7 @@ phpbb.ajaxify = function(options, refresh, callback) { } } + var run_exception = typeof options.exception === 'function'; if (is_form) { act = /action\[([a-z]+)\]/.exec(this.name); @@ -165,10 +158,18 @@ phpbb.ajaxify = function(options, refresh, callback) { data += '&action=' + act; } + if (run_exception && options.exception($(this).parents('form'), act, data)) + { + return true; + } $.post(path, data, return_handler); } else { + if (run_exception && options.exception($(this).parents('form'))) + { + return true; + } $.get(this.href, return_handler); } @@ -223,4 +224,14 @@ $('[data-ajax]').each(function() { -phpbb.ajaxify('#quickmodform'); +phpbb.ajaxify({ + selector: '#quickmodform', + exception: function(el, act, data) { + var d = data.split('=')[1]; + if (d == 'make_normal') + { + return !(el.find('select option[value="make_global"]').length); + } + return !(d == 'lock' || d == 'unlock' || d == 'delete_topic' || d.slice(0, 5) == 'make_'); + } +}, true); |