summaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
authorSimon Rettberg2019-10-09 17:28:48 +0200
committerSimon Rettberg2019-10-09 17:28:48 +0200
commit470944a65cca0a1fd67b0f13bfe4436820d7e145 (patch)
treeefcaa749f43dc269e628a368cf623543b8986a76 /script
parent[locationinfo] Rework from HTML blocks to Jquery Clone (diff)
downloadslx-admin-470944a65cca0a1fd67b0f13bfe4436820d7e145.tar.gz
slx-admin-470944a65cca0a1fd67b0f13bfe4436820d7e145.tar.xz
slx-admin-470944a65cca0a1fd67b0f13bfe4436820d7e145.zip
slx-fixes: Expose function for adding additional automatic confirm handlers
Diffstat (limited to 'script')
-rw-r--r--script/slx-fixes.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/script/slx-fixes.js b/script/slx-fixes.js
index e3b42812..992ca337 100644
--- a/script/slx-fixes.js
+++ b/script/slx-fixes.js
@@ -54,10 +54,12 @@ $('a.disabled').each(function() {
$hax.append($this);
});
+var slxModalConfirmHandler;
+
// Modern confirmation dialogs using bootstrap modal
$(document).ready(function() {
- var $title, $body, $button, $function, $modal = null, $cache = {};
- $function = function (e) {
+ var $title, $body, $button, $modal = null, $cache = {};
+ slxModalConfirmHandler = function (e) {
e.preventDefault();
var $this = $(this);
if ($modal === null) {
@@ -70,9 +72,9 @@ $(document).ready(function() {
$button = $('#modal-autogen-button');
}
$title.text($this.data('title') || $this.text());
- $button.html($this.html()).attr('class', $this.attr('class')).removeClass('btn-xs btn-sm btn-lg').off('click').click(function() {
+ $button.html($this.data('close') || $this.html()).attr('class', $this.attr('class')).removeClass('btn-xs btn-sm btn-lg').off('click').click(function() {
// Click and reconnect click handler so pressing "back" on the next page works
- $this.off('click').click().click($function);
+ $this.off('click').click().click(slxModalConfirmHandler);
});
var $wat, str = $this.data('confirm');
if (str.substr(0, 9) === '#confirm-') {
@@ -87,7 +89,7 @@ $(document).ready(function() {
}
$modal.modal();
};
- $('button[data-confirm]').click($function);
+ $('button[data-confirm]').click(slxModalConfirmHandler);
});
// Taskmanager callbacks for running tasks