Use jQuery.getScript to dynamically load script

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2018-10-09 09:04:42 +02:00 committed by Roeland Jago Douma
parent 5b61ef9213
commit 365f68372f
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 3 additions and 9 deletions

View File

@ -368,15 +368,9 @@ var OCP = {},
addScript:function(app,script,ready){ addScript:function(app,script,ready){
var deferred, path=OC.filePath(app,'js',script+'.js'); var deferred, path=OC.filePath(app,'js',script+'.js');
if(!OC.addScript.loaded[path]) { if(!OC.addScript.loaded[path]) {
deferred = jQuery.ajax({ deferred = $.Deferred();
url: path, $.getScript(path, function() {
cache: true, deferred.resolve();
success: function (content) {
window.eval(content);
if(ready) {
ready();
}
}
}); });
OC.addScript.loaded[path] = deferred; OC.addScript.loaded[path] = deferred;
} else { } else {