1(function () { 2 var DOWNLOAD_MAP = { 3 ios: ".iphone", 4 macos: ".mac-download-btn", 5 appstore: ".app-store-btn", 6 android: ".android", 7 windows: ".window-download-btn", 8 }; 9 10 var ITEMS = [ 11 { type: "ios", icon: "icon1.png", label: "è¹æææºä¸è½½", tabKey: "ios", tabName: "iOSä¸è½½" }, 12 { type: "macos", icon: "icon2.png", label: "MACä¸è½½", tabKey: "macos", tabName: "Macä¸è½½" }, 13 { type: "appstore", icon: "icon3.png", label: "APPååºä¸è½½", tabKey: "appstore", tabName: "AppStoreä¸è½½" }, 14 { type: "android", icon: "icon4.png", label: "å®åææºä¸è½½", tabKey: "android", tabName: "Androidä¸è½½" }, 15 { type: "windows", icon: "icon5.png", label: "Windowsä¸è½½", tabKey: "windows", tabName: "Windowsä¸è½½" }, 16 ]; 17 18 function assetUrl(name) { 19 return "/static/landing-v3/assets/" + name; 20 } 21 22 function isMobile() { 23 return window.matchMedia("(max-width: 800px)").matches; 24 } 25 26 function triggerDownload(type) { 27 if (typeof window.__triggerLandingDownload === "function") { 28 window.__triggerLandingDownload(type); 29 return; 30 } 31 var btn = downloadTargets[type]; 32 if (btn) btn.click(); 33 } 34 35 function buildItem(item) { 36 return ( 37 '<button type="button" class="frame48-item tjtagmanager" data-download-type="' + 38 item.type + 39 '" data-event="landing_page_click" data-landing_page_id="TJ-004" data-tab_key="' + 40 item.tabKey + 41 '" data-tab_name="' + 42 item.tabName + 43 '">' + 44 '<img class="frame48-icon" src="' + 45 assetUrl(item.icon) + 46 '" alt="' + 47 item.label + 48 '">' + 49 "<p>" + 50 item.label + 51 "</p>" + 52 "</button>" 53 ); 54 } 55 56 var originalContent = null; 57 var downloadTargets = {}; 58 59 function cacheDownloadTargets(root) { 60 downloadTargets = {}; 61 Object.keys(DOWNLOAD_MAP).forEach(function (type) { 62 var btn = root.querySelector(DOWNLOAD_MAP[type]); 63 if (btn) downloadTargets[type] = btn; 64 }); 65 } 66 67 function bindActions(container) { 68 container.querySelectorAll("[data-download-type]").forEach(function (btn) { 69 btn.addEventListener("click", function () { 70 triggerDownload(btn.getAttribute("data-download-type")); 71 }); 72 }); 73 } 74 75 function revert(container) { 76 if (!container || container.dataset.frame48 !== "1") return; 77 78 container.innerHTML = ""; 79 if (originalContent) { 80 while (originalContent.firstChild) { 81 container.appendChild(originalContent.firstChild); 82 } 83 originalContent = null; 84 downloadTargets = {}; 85 } 86 container.classList.remove("frame48"); 87 delete container.dataset.frame48; 88 } 89 90 function upgrade(container) { 91 if (!container || container.dataset.frame48 === "1") return false; 92 93 originalContent = document.createDocumentFragment(); 94 while (container.firstChild) { 95 originalContent.appendChild(container.firstChild); 96 } 97 cacheDownloadTargets(originalContent); 98 99 var inner = document.createElement("div"); 100 inner.className = "frame48-inner"; 101 inner.innerHTML = ITEMS.map(buildItem).join(""); 102 103 container.appendChild(inner); 104 container.classList.add("frame48"); 105 container.dataset.frame48 = "1"; 106 bindActions(container); 107 return true; 108 } 109 110 function sync() { 111 var container = document.querySelector("footer .device-container"); 112 if (!container) return false; 113 114 if (isMobile()) { 115 upgrade(container); 116 } else { 117 revert(container); 118 } 119 return true; 120 } 121 122 function waitAndSync() { 123 if (sync()) return; 124 125 var observer = new MutationObserver(function () { 126 if (sync()) observer.disconnect(); 127 }); 128 observer.observe(document.body, { childList: true, subtree: true }); 129 130 setTimeout(function () { 131 sync(); 132 observer.disconnect(); 133 }, 8000); 134 } 135 136 window.addEventListener("resize", sync); 137 138 if (document.readyState === "loading") { 139 document.addEventListener("DOMContentLoaded", waitAndSync); 140 } else { 141 waitAndSync(); 142 } 143})();
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.