Commits

David Jean Louis committed fbfe066

Put the script loading in test in a try/catch because it was causing an error in certain cases with Opera.

Comments (0)

Files changed (1)

admin_tools/media/admin_tools/js/utils.js

     var head = document.getElementsByTagName('head')[0];
 
     function loadScript(index){
-
         if (index >= len){
             onComplete();
             return;
         }
 
-        if (js_files[index].test()){
-//            console.log('Loading ' + js_files[index].src);
+        try {
+            testOk = js_files[index].test();
+        } catch (e) {
+            // with certain browsers like opera the above test can fail 
+            // because of undefined variables...
+            testOk = true;
+        }
 
+        if (testOk) {
             var s = document.createElement('script');
             s.src = js_files[index].src;
             s.type = 'text/javascript';
             s.onload = function(){
                 loadScript(index+1);
             }
-        }
-        else{
+        } else {
             loadScript(index+1);
         }
     }