Search Results

Search found 1 results on 1 pages for 'user577363'.

Page 1/1 | 1 

  • Jscript help? What is the main purpose of this Javascript?

    - by user577363
    Dear All, I don't know Javascript, can you please show me the main purpose of this Javascript? Many Thanks!! <script> var QunarUtil=new function(){var prefix='/scripts/';var suffix='';var host='';if(location.host.indexOf('src.')!=-1){prefix='/scripts/src/';host='http://hstatic.qunar.com';suffix='.js';}else if(location.host.indexOf('enc.')!=-1){prefix='/scripts/';host='http://hstatic.qunar.com';suffix='.js';}else if(location.host.substring(0,10)=='sdev-'){prefix=location.host.substring(5,location.host.indexOf('.'));prefix='/'+prefix.replace(/\-/ig,'/');host='http://hstatic.qunar.com';suffix='.js';}else if(location.host.indexOf("h.qunar.com")!=-1){host='http://hstatic.qunar.com';suffix='';} this.getScriptURL=function(name,isList){if(name.charAt(0)!='/') return this.getScript(prefix+name,isList);else return this.getScript(name,isList);} this.getScript=function(src,isList){return'<'+'script type="text/javascript" src="'+host+src+(isList?suffix:'.js')+'?'+__QUNARVER__+'"></'+'script>';} this.writeScript=function(name,isList){document.write(this.getScriptURL(name,isList));} this.writeScriptList=function(list){for(var i=0;i<list.length;i++) document.write(this.getScriptURL(list[i]));} var cssRoot='/styles/';this.writeCSS=function(cssList){for(var i=0;i<cssList.length;i++){document.write('<link rel="stylesheet" href="'+cssRoot+cssList[i]+'?'+__QUNARVER__+'">');}} this.writeStaticScript=function(src){document.write('<scr'+'ipt type="text/javascript" src="'+src+'"></'+'scr'+'ipt>');} this.writeStaticList=function(src){document.write('<scr'+'ipt type="text/javascript" src="'+src+suffix+'?'+__QUNARVER__+'"></'+'scr'+'ipt>');}} $include=function(){for(var i=0;i<arguments.length;i++){QunarUtil.writeScript(arguments[i],true);}} </script> Uncompressed version: <script> var QunarUtil = new function() { var prefix = '/scripts/'; var suffix = ''; var host = ''; if (location.host.indexOf('src.') != -1) { prefix = '/scripts/src/'; host = 'http://hstatic.qunar.com'; suffix = '.js'; } else if (location.host.indexOf('enc.') != -1) { prefix = '/scripts/'; host = 'http://hstatic.qunar.com'; suffix = '.js'; } else if (location.host.substring(0, 10) == 'sdev-') { prefix = location.host.substring(5, location.host.indexOf('.')); prefix = '/' + prefix.replace(/\-/ig, '/'); host = 'http://hstatic.qunar.com'; suffix = '.js'; } else if (location.host.indexOf("h.qunar.com") != -1) { host = 'http://hstatic.qunar.com'; suffix = ''; } this.getScriptURL = function(name, isList) { if (name.charAt(0) != '/') return this.getScript(prefix + name, isList); else return this.getScript(name, isList); } this.getScript = function(src, isList) { return '<' + 'script type="text/javascript" src="' + host + src + (isList ? suffix : '.js') + '?' + __QUNARVER__ + '"></' + 'script>'; } this.writeScript = function(name, isList) { document.write(this.getScriptURL(name, isList)); } this.writeScriptList = function(list) { for (var i = 0; i < list.length; i++) document.write(this.getScriptURL(list[i])); } var cssRoot = '/styles/'; this.writeCSS = function(cssList) { for (var i = 0; i < cssList.length; i++) { document.write('<link rel="stylesheet" href="' + cssRoot + cssList[i] + '?' + __QUNARVER__ + '">'); } } this.writeStaticScript = function(src) { document.write('<scr' + 'ipt type="text/javascript" src="' + src + '"></' + 'scr' + 'ipt>'); } this.writeStaticList = function(src) { document.write('<scr' + 'ipt type="text/javascript" src="' + src + suffix + '?' + __QUNARVER__ + '"></' + 'scr' + 'ipt>'); } } $include = function() { for (var i = 0; i < arguments.length; i++) { QunarUtil.writeScript(arguments[i], true); } } </script>

    Read the article

1