/*! * $script.js Async loader & dependency manager * https://github.com/ded/script.js * (c) Dustin Diaz, Jacob Thornton 2011 * License: MIT */ (function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&define.amd?define(a,b):this[a]=b()})("$script",function(){function q(a,b,c){for(c=0,j=a.length;c'); $script.path(serverPath+'../'); $script('angularFiles', function() { var index = 0, scripts = angularFiles.angularSrc; try { delete window.angularFiles; } catch(e) { window.angularFiles = undefined; } // initialize the window property cache for (var prop in window) { if (IGNORE[prop] || prop.match(/^moz[A-Z]/)) { //skip special variables which keep on changing continue; } try { globalVars[key(prop)] = window[prop]; } catch(e) {} //ignore properties that throw exception when accessed (common in FF) } (function next() { if (index < scripts.length) { var file = scripts[index++]; $script(file.replace(/\.js$/, ''), function() { angularClobberTest(file); next(); }); } else { // empty the cache to prevent mem leaks globalVars = {}; bindJQuery(); publishExternalAPI(window.angular); angularInit(document, angular.bootstrap); } })(); }); function key(prop) { return "ng-clobber_" + prop; } function angularClobberTest(file) { var varKey, prop, clobbered = {}; for (prop in window) { varKey = key(prop); if (IGNORE[prop] || prop.match(/^moz[A-Z]/)) { //skip special variables which keep on changing continue; } else if (!globalVars.hasOwnProperty(varKey)) { //console.log('new global variable found: ', prop); try { globalVars[varKey] = window[prop]; } catch(e) {} //ignore properties that throw exception when accessed (common in FF) } else if (globalVars[varKey] !== window[prop] && !isActuallyNaN(window[prop]) && prop != 'jqLite') { clobbered[prop] = true; console.error("Global variable clobbered by script " + file + "! Variable name: " + prop); globalVars[varKey] = window[prop]; } } for (varKey in globalVars) { prop = varKey.substr(11); if (prop === 'event' || prop.match(/^moz[A-Z]/)) { //skip special variables which keep on changing continue; } if (!clobbered[prop] && prop != 'event' && prop != 'jqLite' && !isActuallyNaN(globalVars[varKey]) && globalVars[varKey] !== window[prop]) { delete globalVars[varKey]; console.warn("Global variable unexpectedly deleted in script " + file + "! " + "Variable name: " + prop); } } function isActuallyNaN(val) { return (typeof val === 'number') && isNaN(val); } }; })(window, document);