Merge pull request #4068 from nextcloud/use-eval-instead-of-get-script

Use eval instead of $.script
This commit is contained in:
Morris Jobke 2017-03-26 15:13:03 -06:00 committed by GitHub
commit 96d4e1cab5
1 changed files with 14 additions and 9 deletions

View File

@ -366,15 +366,20 @@ 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]) {
if(ready){ deferred = jQuery.ajax({
deferred=$.getScript(path,ready); url: path,
}else{ cache: true,
deferred=$.getScript(path); success: function (content) {
} eval(content);
OC.addScript.loaded[path]=deferred; if(ready) {
}else{ ready();
if(ready){ }
}
});
OC.addScript.loaded[path] = deferred;
} else {
if (ready) {
ready(); ready();
} }
} }