aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/styles/script.js
diff options
context:
space:
mode:
authorCallum Macrae <callum@lynxphp.com>2011-07-20 18:28:14 +0100
committerIgor Wiedler <igor@wiedler.ch>2012-03-31 02:09:09 +0200
commit8fd86717e1320cb3160515fe786869c80e6771f9 (patch)
treea0af1ffa8ca7c5b2f1e25363c413abe1576f1d61 /phpBB/styles/script.js
parent2f2ec1096b6288c032e276c75c849bb1cc820674 (diff)
downloadforums-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
Diffstat (limited to 'phpBB/styles/script.js')
-rw-r--r--phpBB/styles/script.js17
1 files changed, 15 insertions, 2 deletions
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');