1(function() { 2 'use strict'; 3 4 var Loader = (function() { 5 6 var scripts = {}, 7 queue = {}, 8 loadCount = 0, 9 head = document.getElementsByTagName('head')[0], 10 11 register = function( script, id ) { 12 if( id ) { 13 scripts[id] = script; 14 } 15 }, 16 17 isRegistered = function( id ) { 18 return scripts.hasOwnProperty(id) ? true : false; 19 }, 20 21 inQueue = function( id ) { 22 return queue.hasOwnProperty(id) ? true : false; 23 }, 24 25 require = function( ids, callback ) { 26 //check if each script is a registered callback 27 ids = ids['push'] ? ids : [ ids ]; 28 var totalRequired = ids.length, 29 currentScripts = []; 30 if( ids.every( isRegistered ) ) { 31 for( var i = 0; i < totalRequired; i++ ) { 32 if( !inQueue( ids[i] ) ) { 33 queue[ ids[i] ] = writeScript( scripts[ ids[i] ] ); 34 } 35 currentScripts.push( queue[ ids[i] ] ); 36 } 37 Promise.all( currentScripts ).then( function() { 38 callback.call(); 39 }); 40 } 41 42 }, 43 44 writeScript = function( src ) { 45 var currentSite = window.location.href; 46 if(currentSite.indexOf("https://")>-1){ 47 src = src.replace("http:", "https:"); 48 } 49 return new Promise( function(resolve, reject ) { 50 var s = document.createElement('script'); 51 s.type = "text/javascript"; 52 s.async = true; 53 s.src = src; 54 head.appendChild(s); 55 s.onload = resolve; 56 s.onerror = reject; 57 }); 58 }; 59 60 return { 61 register : register, 62 require : require 63 } 64 })(); 65 window.asyncloader = Loader; 66})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.