summaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
authorSimon Rettberg2019-07-19 22:00:53 +0200
committerSimon Rettberg2019-07-19 22:00:53 +0200
commit79fe00fcb5143e5dce0bf06f1f49e5dc241e0979 (patch)
tree0dc5d82ac31a78a3e4b09111d481b15dc0322631 /script
parent[locationinfo] increased cached date span for backends: dummy, davinci and ex... (diff)
downloadslx-admin-79fe00fcb5143e5dce0bf06f1f49e5dc241e0979.tar.gz
slx-admin-79fe00fcb5143e5dce0bf06f1f49e5dc241e0979.tar.xz
slx-admin-79fe00fcb5143e5dce0bf06f1f49e5dc241e0979.zip
slx-fixes.js: Make .cachedScript more compatible to .getScript
Allow passing a success callback directly
Diffstat (limited to 'script')
-rw-r--r--script/slx-fixes.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/script/slx-fixes.js b/script/slx-fixes.js
index be35f56b..e8380702 100644
--- a/script/slx-fixes.js
+++ b/script/slx-fixes.js
@@ -108,11 +108,17 @@ $(document).ready(function() {
});
// Caching script fetcher (https://api.jquery.com/jQuery.getScript/); use exactly like $.getScript
-jQuery.cachedScript = function(url, options) {
+jQuery.cachedScript = function(url, callback, options) {
+ if (!$.isFunction(callback)) {
+ options = callback;
+ callback = undefined;
+ }
options = $.extend( options || {}, {
+ type: "get",
dataType: "script",
cache: true,
- url: url
+ url: url,
+ success: callback
});
return jQuery.ajax( options );
};