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){
var deferred, path=OC.filePath(app,'js',script+'.js');
if(!OC.addScript.loaded[path]) {
deferred = jQuery.ajax({
url: path,
cache: true,
success: function (content) {
window.eval(content);
if(ready) {
ready();
}
}
deferred = $.Deferred();
$.getScript(path, function() {
deferred.resolve();
});
OC.addScript.loaded[path] = deferred;
} else {