1(function () { 2 if (location.search && location.search.indexOf("debug") >= 0) { 3 return; 4 } 5 // åè https://github.com/matthewhudson/device.js/blob/master/lib/device.js 6 var userAgent = window.navigator.userAgent.toLowerCase(); 7 function find(needle) { 8 return userAgent.indexOf(needle) !== -1; 9 } 10 var iphone = function () { 11 return !windows() && find("iphone"); 12 }; 13 var ipod = function () { 14 return find("ipod"); 15 }; 16 var ipad = function () { 17 return find("ipad"); 18 }; 19 var android = function () { 20 return !windows() && find("android"); 21 }; 22 var androidPhone = function () { 23 return android() && find("mobile"); 24 }; 25 var androidTablet = function () { 26 return android() && !find("mobile"); 27 }; 28 var blackberry = function () { 29 return find("blackberry") || find("bb10") || find("rim"); 30 }; 31 var blackberryPhone = function () { 32 return blackberry() && !find("tablet"); 33 }; 34 var blackberryTablet = function () { 35 return blackberry() && find("tablet"); 36 }; 37 var windows = function () { 38 return find("windows"); 39 }; 40 var windowsPhone = function () { 41 return windows() && find("phone"); 42 }; 43 var windowsTablet = function () { 44 return windows() && find("touch") && !windowsPhone(); 45 }; 46 var fxos = function () { 47 return (find("(mobile;") || find("(tablet;")) && find("; rv:"); 48 }; 49 var fxosPhone = function () { 50 return fxos() && find("mobile"); 51 }; 52 var fxosTablet = function () { 53 return fxos() && find("tablet"); 54 }; 55 var meego = function () { 56 return find("meego"); 57 }; 58 var mobile = function () { 59 return ( 60 androidPhone() || 61 iphone() || 62 ipod() || 63 windowsPhone() || 64 blackberryPhone() || 65 fxosPhone() || 66 meego() 67 ); 68 }; 69 var tablet = function () { 70 return ( 71 ipad() || 72 androidTablet() || 73 blackberryTablet() || 74 windowsTablet() || 75 fxosTablet() 76 ); 77 }; 78 var landscape = function () { 79 return window.innerHeight / window.innerWidth < 1; 80 }; 81 82 var conf = document.getElementsByTagName("html")[0]; 83 var pcurl = conf.getAttribute("pc-url"); 84 var h5url = conf.getAttribute("h5-url"); 85 var isLandscape = landscape(); 86 87 // 跳转æ¶ä¿æ query string å hash 88 function redirect(url) { 89 if (url.indexOf("?") == -1) { 90 url = url + location.search; 91 } 92 if (url.indexOf("#") == -1) { 93 url = url + location.hash; 94 } 95 location.href = url; 96 } 97 // å½åå½ç±»ï¼å¹³æ¿ç«å±ï¼æ¨ªå±å为 h5 98 if (mobile() || tablet()) { 99 if (h5url) { 100 if ( 101 window.location.href.includes("Pre-registration") || 102 window.location.href.includes("pre-registration") 103 ) { 104 redirect("/h5/Pre-registration"); 105 } else if (/news\?id=\d+/.test(window.location.href)) { 106 const matchResult = window.location.href.match(/news\?id=(\d+)/); 107 if (matchResult[1]) { 108 redirect("/h5/news?id=" + matchResult[1]); 109 } else { 110 redirect("/h5/news"); 111 } 112 } else if (window.location.href.includes("news")) { 113 redirect("/h5/news"); 114 } else { 115 redirect(h5url); 116 } 117 } 118 } else { 119 if (pcurl) { 120 if ( 121 window.location.href.includes("Pre-registration") || 122 window.location.href.includes("pre-registration") 123 ) { 124 redirect("/Pre-registration"); 125 } else if (/h5\/news\?id=\d+/.test(window.location.href)) { 126 const matchResult = window.location.href.match(/h5\/news\?id=(\d+)/); 127 if (matchResult[1]) { 128 redirect("/news?id=" + matchResult[1]); 129 } else { 130 redirect("/news"); 131 } 132 } else if (window.location.href.includes("news")) { 133 redirect("/news"); 134 } else { 135 redirect(pcurl); 136 } 137 } 138 } 139})();
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.