/* LoadLib Based on LazyLoad by Ryan Grove https://github.com/rgrove/lazyload/ Copyright (c) 2011 Ryan Grove All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ================================================== */ window.loadedJS = []; if(typeof VMM != 'undefined' && typeof VMM.LoadLib == 'undefined') { //VMM.LoadLib.js('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', onJQueryLoaded); //VMM.LoadLib.css('http://someurl.css', onCSSLoaded); VMM.LoadLib = (function (doc) { var env, head, pending = {}, pollCount = 0, queue = {css: [], js: []}, styleSheets = doc.styleSheets; var loaded_Array = []; function isLoaded(url) { var has_been_loaded = false; for(var i=0; i= 0) { if (styleSheets[i].href === css.urls[0]) { finish('css'); break; } } pollCount += 1; if (css) { if (pollCount < 200) { setTimeout(pollWebKit, 50); } else { finish('css'); } } } } return { css: function (urls, callback, obj, context) { if (isLoaded(urls)) { return callback; } else { load('css', urls, callback, obj, context); } }, js: function (urls, callback, obj, context) { if (isLoaded(urls)) { return callback; } else { load('js', urls, callback, obj, context); } } }; })(this.document); }