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