PageSourceSearch

https://apps.wuhaneduyun.cn/assets/ac/frontend/js/launch_rrt.js

js wuhaneduyun.cn collected 2026-10-08 21:00:43 UTC 6,384 bytes, 234 lines download raw bytes

1function _registerEvent(target, eventType, cb) {
2    if (target.addEventListener) {
3        target.addEventListener(eventType, cb);
4        return {
5            remove: function () {
6                target.removeEventListener(eventType, cb);
7            }
8        };
9    } else {
10        target.attachEvent(eventType, cb);
11        return {
12            remove: function () {
13                target.detachEvent(eventType, cb);
14            }
15        };
16    }
17}
18
19function _createHiddenIframe(target, uri) {
20    var iframe = document.createElement("iframe");
21    iframe.src = uri;
22    iframe.id = "hiddenIframe";
23    iframe.style.display = "none";
24    target.appendChild(iframe);
25
26    return iframe;
27}
28
29function openUriWithHiddenFrame(uri, failCb, successCb) {
30
31    var timeout = setTimeout(function () {
32        failCb();
33        handler.remove();
34    }, 3000);
35
36    var iframe = document.querySelector("#hiddenIframe");
37    if (!iframe) {
38        iframe = _createHiddenIframe(document.body, "about:blank");
39    }
40
41    var handler = _registerEvent(window, "blur", onBlur);
42
43    function onBlur() {
44        clearTimeout(timeout);
45        handler.remove();
46        successCb();
47    }
48
49    iframe.contentWindow.location.href = uri;
50}
51
52function openUriWithTimeoutHack(uri, failCb, successCb) {
53    var timeout = setTimeout(function () {
54        failCb();
55        handler.remove();
56    }, 3000);
57
58    //handle page running in an iframe (blur must be registered with top level window)
59    var target = window;
60    while (target != target.parent) {
61        target = target.parent;
62    }
63
64    var handler = _registerEvent(target, "blur", onBlur);
65
66    function onBlur() {
67        clearTimeout(timeout);
68        handler.remove();
69        successCb();
70    }
71
72    window.location = uri;
73}
74
75function openUriUsingFirefox(uri, failCb, successCb) {
76    var iframe = document.querySelector("#hiddenIframe");
77
78    if (!iframe) {
79        iframe = _createHiddenIframe(document.body, "about:blank");
80    }
81
82    try {
83        iframe.contentWindow.location.href = uri;
84        successCb();
85    } catch (e) {
86        if (e.name == "NS_ERROR_UNKNOWN_PROTOCOL") {
87            failCb();
88        }
89    }
90}
91
92function openUriUsingIEInOlderWindows(uri, failCb, successCb) {
93    if (getInternetExplorerVersion() === 10) {
94        openUriUsingIE10InWindows7(uri, failCb, successCb);
95    } else if (getInternetExplorerVersion() === 9 || getInternetExplorerVersion() === 11) {
96        openUriWithHiddenFrame(uri, failCb, successCb);
97    } else {
98        openUriInNewWindowHack(uri, failCb, successCb);
99    }
100}
101
102function openUriUsingIE10InWindows7(uri, failCb, successCb) {
103    var timeout = setTimeout(failCb, 3000);
104    window.addEventListener("blur", function () {
105        clearTimeout(timeout);
106        successCb();
107    });
108
109    var iframe = document.querySelector("#hiddenIframe");
110    if (!iframe) {
111        iframe = _createHiddenIframe(document.body, "about:blank");
112    }
113    try {
114        iframe.contentWindow.location.href = uri;
115    } catch (e) {
116        failCb();
117        clearTimeout(timeout);
118    }
119}
120
121function openUriInNewWindowHack(uri, failCb, successCb) {
122    var myWindow = window.open('', '', 'width=0,height=0');
123
124    myWindow.document.write("<iframe src='" + uri + "'></iframe>");
125
126    setTimeout(function () {
127        try {
128            myWindow.location.href;
129            myWindow.setTimeout("window.close()", 3000);
130            successCb();
131        } catch (e) {
132            myWindow.close();
133            failCb();
134        }
135    }, 3000);
136}
137
138function openUriWithMsLaunchUri(uri, failCb, successCb) {
139    navigator.msLaunchUri(uri,
140        successCb,
141        failCb
142    );
143}
144
145function checkBrowser() {
146    var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
147    var ua = navigator.userAgent.toLowerCase();
148    return {
149        isOpera   : isOpera,
150        isFirefox : typeof InstallTrigger !== 'undefined',
151        isSafari  : (~ua.indexOf('safari') && !~ua.indexOf('chrome')) || Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0,
152        isIOS     : /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream,
153        isChrome  : !!window.chrome && !isOpera,
154        isIE      : /*@cc_on!@*/false || !!document.documentMode // At least IE6
155    }
156}
157
158function getInternetExplorerVersion() {
159    var rv = -1;
160    if (navigator.appName === "Microsoft Internet Explorer") {
161        var ua = navigator.userAgent;
162        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
163        if (re.exec(ua) != null)
164            rv = parseFloat(RegExp.$1);
165    }
166    else if (navigator.appName === "Netscape") {
167        var ua = navigator.userAgent;
168        var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
169        if (re.exec(ua) != null) {
170            rv = parseFloat(RegExp.$1);
171        }
172    }
173    return rv;
174}
175
176var toast = null
177
178function launchFailed() {
179    console.log('=====================launchFailed')
180    //
181	myTips('检测到你还未安装客户端', 2);
182    if (typeof layer !== 'undefined') {
183        layer.closeAll();
184    }
185}
186
187function launchSuccess() {
188    console.log('=====================launchSuccess')
189    //
190    if (typeof closePcLoading === "function") {
191        closePcLoading();
192    }
193    if (typeof closePcDialog === "function") {
194        closePcDialog();
195    }
196}
197
198function unsupportedCb() {
199    console.log('=======================unsupportedCb')
200    if(toast) {
201        toast.style.display = 'none'
202        document.body.removeChild(toast)
203    }
204}
205
206function launchApp(ticket,platform) {
207	// if (!ticket || !platform) {
208	// 	alert('请提供ticket和platform信息')
209	// 	return
210	// }
211    if (!ticket) {
212        ticket = '';
213    }
214    if (typeof loadingPc === "function") {
215        loadingPc();
216    }
217	var url = 'tyrrt:?ticket='+ticket+'&platformCode='+platform
218	if(navigator.msLaunchUri) {
219		openUriWithMsLaunchUri(url, launchFailed, launchSuccess);
220	} else {
221		var browser = checkBrowser();
222		if (browser.isFirefox) {
223			openUriUsingFirefox(url, launchFailed, launchSuccess);
224		} else if (browser.isChrome || browser.isIOS) {
225			openUriWithTimeoutHack(url, launchFailed, launchSuccess);
226		} else if (browser.isIE) {
227			openUriUsingIEInOlderWindows(url, launchFailed, launchSuccess);
228		} else if (browser.isSafari) {
229			openUriWithHiddenFrame(url, launchFailed, launchSuccess);
230		} else {
231			unsupportedCb();
232		}
233	}
234}

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.