nl_tokens: process the script request setup
pl_tokens: function do_script ( chain_opts , script_obj , chain_group , preload_this_script ) { var registry_item , registry_items , ready_cb = function ( ) { script_obj . ready_cb ( script_obj , function ( ) { execute_preloaded_script ( chain_opts , script_obj , registry_item ) ; } ) ; } , finished_cb = function ( ) { script_obj . finished_cb ( script_obj , chain_group ) ; } ; script_obj . src = canonical_uri ( script_obj . src , chain_opts [ _BasePath ] ) ; script_obj . real_src = script_obj . src + // append cache-bust param to URL? ( chain_opts [ _CacheBust ] ? ( ( / \?.*$ / . test ( script_obj . src ) ? "&_" : "?_" ) + ~ ~ ( Math . random ( ) * 1E9 ) + "=" ) : "" ) ; if ( ! registry [ script_obj . src ] ) registry [ script_obj . src ] = { items : [ ] , <mask> : false } ; registry_items = registry [ script_obj . src ] . items ; // allowing duplicates, or is this the first recorded load of this script? if ( chain_opts [ _AllowDuplicates ] || registry_items . length == 0 ) { registry_item = registry_items [ registry_items . length ] = { ready : false , finished : false , ready_listeners : [ ready_cb ] , finished_listeners : [ finished_cb ] } ; request_script ( chain_opts , script_obj , registry_item , // which callback type to pass? ( ( preload_this_script ) ? // depends on script-preloading function ( ) { registry_item . ready = true ; for ( var i = 0 ; i < registry_item . ready_listeners . length ; i ++ ) { registry_item . ready_listeners [ i ] ( ) ; } registry_item . ready_listeners = [ ] ; } : function ( ) { script_executed ( registry_item ) ; } ) , // signal if script-preloading should be used or not preload_this_script ) ; } else { registry_item = registry_items [ 0 ] ; if ( registry_item . finished ) { finished_cb ( ) ; } else { registry_item . finished_listeners . push ( finished_cb ) ; } } }