diff options
author | Callum Macrae <callum@lynxphp.com> | 2011-07-20 18:28:14 +0100 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-03-31 02:09:09 +0200 |
commit | 8fd86717e1320cb3160515fe786869c80e6771f9 (patch) | |
tree | a0af1ffa8ca7c5b2f1e25363c413abe1576f1d61 | |
parent | 2f2ec1096b6288c032e276c75c849bb1cc820674 (diff) | |
download | forums-8fd86717e1320cb3160515fe786869c80e6771f9.tar forums-8fd86717e1320cb3160515fe786869c80e6771f9.tar.gz forums-8fd86717e1320cb3160515fe786869c80e6771f9.tar.bz2 forums-8fd86717e1320cb3160515fe786869c80e6771f9.tar.xz forums-8fd86717e1320cb3160515fe786869c80e6771f9.zip |
[ticket/10271] Added ability for exceptions to phpbb.ajaxify.
Also made it easy for additional options to be added in the future.
PHPBB3-10271
-rw-r--r-- | phpBB/styles/prosilver/template/viewtopic_body.html | 2 | ||||
-rw-r--r-- | phpBB/styles/script.js | 17 |
2 files changed, 16 insertions, 3 deletions
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 856ee6962c..9e333cf5ec 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -263,7 +263,7 @@ <!-- INCLUDE jumpbox.html --> <!-- IF .quickmod --> - <form method="post" action="{S_MOD_ACTION}"> + <form method="post" action="{S_MOD_ACTION}" id="quickmodform"> <fieldset class="quickmod"> <label for="quick-mod-select">{L_QUICK_MOD}:</label> <select name="action" id="quick-mod-select"> diff --git a/phpBB/styles/script.js b/phpBB/styles/script.js index 32b12bdd34..e7a7c44d10 100644 --- a/phpBB/styles/script.js +++ b/phpBB/styles/script.js @@ -79,12 +79,12 @@ phpbb.confirm = function(msg, callback) { /** * Makes a link use AJAX instead of loading an entire page. * - * @param string condition The element to capture. + * @param object options Options, if a string will be the selector. * @param bool/function refresh If we are sent back a refresh, should it be * acted upon? This can either be true / false / a function. * @param function callback Callback. */ -phpbb.ajaxify = function(selector, refresh, callback) { +phpbb.ajaxify = function(options, refresh, callback) { //private function to handle refreshes function handle_refresh(data, refresh, div) @@ -109,9 +109,20 @@ phpbb.ajaxify = function(selector, refresh, callback) { }, data.time * 1000); } + var selector = (typeof options === 'string') ? options : options.selector; + var is_form = $(selector).is('form'); $(selector + ((is_form) ? ' input:submit' : '')).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); @@ -209,3 +220,5 @@ phpbb.ajaxify('.rightside a[href*="mark="]'); //captures topics and forums phpbb.ajaxify('.mcp_approve', false, function(el, act) { $(el).parents((act === 'approve') ? '.rules' : '.post').remove_anim(); }); + +phpbb.ajaxify('#quickmodform'); |