Use eval instead of $.script
Fixes https://github.com/nextcloud/server/issues/4067 Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
ec6853a2a6
commit
12a019d328
1 changed files with 23 additions and 8 deletions
|
@ -366,15 +366,30 @@ 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){
|
if(ready) {
|
||||||
deferred=$.getScript(path,ready);
|
deferred = jQuery.ajax({
|
||||||
}else{
|
url: path,
|
||||||
deferred=$.getScript(path);
|
cache: true,
|
||||||
|
success: function (content) {
|
||||||
|
eval(content);
|
||||||
|
eval(ready);
|
||||||
|
},
|
||||||
|
async: false
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
deferred = jQuery.ajax({
|
||||||
|
url: path,
|
||||||
|
cache: true,
|
||||||
|
success: function (content) {
|
||||||
|
eval(content);
|
||||||
|
},
|
||||||
|
async: false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
OC.addScript.loaded[path]=deferred;
|
OC.addScript.loaded[path] = deferred;
|
||||||
}else{
|
} else {
|
||||||
if(ready){
|
if (ready) {
|
||||||
ready();
|
ready();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue