PageSourceSearch

https://ehall.nju.edu.cn/ywtb-portal/official/customFiles/adapterBrowser.js

js nju.edu.cn collected 2026-09-24 08:34:43 UTC 2,926 bytes, 76 lines download raw bytes

1function showBrowserWarningByGetAgent() {
2  var userAgent = navigator.userAgent.toLowerCase(); //取得浏览器的userAgent字符串
3  var isFireFox = userAgent.indexOf("firefox") > -1; //判断是否Firefox浏览器
4  var isSafari =
5    userAgent.indexOf("safari") > -1 && userAgent.indexOf("chrome") == -1; //判断是否Safari浏览器
6  var isChrome =
7    userAgent.indexOf("chrome") > -1 && userAgent.indexOf("safari") > -1; //判断Chrome浏览器
8  var isOpera = userAgent.indexOf("opera") > -1; //判断是否Opera浏览器
9  var isSolo = userAgent.indexOf("metasr") > -1; //判断是否搜狗浏览器
10
11  var isIE =
12    userAgent.indexOf("compatible") > -1 &&
13    userAgent.indexOf("msie") > -1 &&
14    !isOpera; //判断是否IE浏览器
15  var isEdge = userAgent.indexOf("windows nt 6.1; trident/7.0;") > -1 && !isIE; //判断是否IE的Edge浏览器
16  // IE11、Edge、Chrome、Firefox、Safari
17  var isIE11 =
18    userAgent.indexOf("trident") > -1 && userAgent.indexOf("rv:11.0") > -1;
19  var is360 = _mime("type", "application/vnd.chromium.remoting-viewer");
20  // 在搜狗,<ie11,opera,360上展示
21  if (isSolo || (isIE && !isIE11) || isOpera || (isChrome && is360)) {
22    return true;
23  } else if (isEdge || isFireFox || isSafari || isChrome || isIE11) {
24    return false;
25  } else {
26    return true;
27  }
28}
29//测试mime
30function _mime(option, value) {
31  var mimeTypes = navigator.mimeTypes;
32  for (var mt in mimeTypes) {
33    if (mimeTypes[mt][option] == value) {
34      return true;
35    }
36  }
37  return false;
38}
39function loadingAdapterBrowserWaningEvent() {
40  //没有关闭过且非以上浏览器时,展示提示
41  document.getElementById("browser-adapter-warning-box-1").style.display =
42    showBrowserWarningByGetAgent() &&
43    !localStorage.getItem("browserAdapterWarningHasClosed")
44      ? "block"
45      : "none";
46
47  //绑定关闭点击事件
48  document.getElementById(
49    "browser-adapter-warning-box-close-warning"
50  ).onclick = function(event) {
51    document.getElementById("browser-adapter-warning-box-1").style.display =
52      "none";
53    localStorage.setItem("browserAdapterWarningHasClosed", true);
54  };
55}
56//dom执行完执行回调方法
57function domHasReady(fn) {
58  if (document.addEventListener) {
59    document.addEventListener("DOMContentLoaded", function() {
60      document.removeEventListener("DOMContentLoaded", arguments.callee);
61      fn();
62    });
63  } else if (document.attachEvent) {
64    document.attachEvent("onreadystatechange", function() {
65      if (document.readystate == "complete") {
66        document.dispatchEvent("onreadystatechange", arguments.callee);
67        fn();
68      }
69    });
70  }
71}
72domHasReady(loadingAdapterBrowserWaningEvent);
73//浏览器适配提示
74// document.getElementById(
75//   "browser-adapter-warning-box-1"
76// ).style.display = showBrowserWarningByGetAgent() ? "block" : "none";

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.