1// æ¥èæ´»å¨å¼¹çª start 2;(function (doc, win) { 3 let popupOpen = false 4 let msgItems = [] 5 6 const formatCountdown = seconds => { 7 const days = Math.floor(seconds / (24 * 3600)) 8 const hours = Math.floor((seconds % (24 * 3600)) / 3600) 9 const minutes = Math.floor((seconds % 3600) / 60) 10 const secs = seconds % 60 11 return `${days}天${hours}å°æ¶${minutes}å${secs}ç§` 12 } 13 14 // åå»ºè½®æææ 15 const createScrollingEffect = () => { 16 const msgListDom = document.getElementById("msg-list") 17 if (!msgListDom || msgItems.length <= 1) return 18 19 // å¦æåªæä¸æ¡æ¶æ¯ï¼ä¸éè¦è½®æ 20 if (msgItems.length === 1) { 21 msgListDom.innerHTML = `<div class="msg-list-item">${msgItems[0]}</div>` 22 msgListDom.classList.remove("scrolling") 23 return 24 } 25 26 // å¤å¶ä¸ä»½æ¶æ¯ä»¥å建æ ç¼è½®æææ 27 const allItems = [...msgItems, ...msgItems] 28 const itemWidth = 100 / msgItems.length 29 30 msgListDom.innerHTML = allItems 31 .map((item, index) => `<div class="msg-list-item" style="width: ${itemWidth}%">${item}</div>`) 32 .join("   ") 33 34 // 设置æ»å®½åº¦ 35 msgListDom.style.width = `${msgItems.length * 200}%` 36 37 // æ·»å è½®æå¨ç» 38 msgListDom.classList.add("scrolling") 39 40 // 设置å¨ç»æ¶é¿ï¼æ ¹æ®æ¶æ¯æ°éè°æ´é度 41 const animationDuration = msgItems.length * 3 42 msgListDom.style.animationDuration = `${animationDuration}s` 43 } 44 45 const renderMsgList = msgList => { 46 if (msgList.length > 0) { 47 const msgListWrap = document.querySelector(".msg-list-wrap") 48 if (msgListWrap) { 49 msgListWrap.classList.add("show") 50 } 51 } 52 setTimeout(() => { 53 const msgListDom = document.getElementById("msg-list") 54 const msgListContainer = document.querySelector(".msg-list-container") 55 56 if (msgList.length > 0 && msgListDom && msgListContainer) { 57 msgItems = msgList.map(item => `æå${item.nick_name}è·å¾äº${item.text}`) 58 createScrollingEffect() 59 } 60 }, 100) 61 } 62 63 const renderCountdown = (countdown, status) => { 64 const countDownDom = document.getElementById("count-down") 65 if (countDownDom) { 66 // if (status === 0) { 67 // countDownDom.textContent = "æ´»å¨æªå¼å§" 68 // return 69 // } 70 if (status === 2) { 71 countDownDom.textContent = "æ´»å¨å·²ç»æ" 72 return 73 } 74 let remainingSeconds = countdown 75 countDownDom.textContent = formatCountdown(remainingSeconds) 76 const intervalId = setInterval(() => { 77 remainingSeconds-- 78 if (remainingSeconds < 0) { 79 clearInterval(intervalId) 80 initPupupData() 81 return 82 } 83 countDownDom.textContent = formatCountdown(remainingSeconds) 84 }, 1000) 85 } 86 } 87 88 const initPupupData = () => { 89 window.parent.$Http({ url: "/api/activity/limited_index", data: {} }).then(res => { 90 if (res?.status === 1) { 91 // æ´»å¨åè®¡æ¶ 92 const countdown = res?.data?.remain_seconds || 0 93 // æ´»å¨ä¸å¥æ¶æ¯å表 94 const msgList = res?.data?.record_list || [] 95 // æ´»å¨ç¶æ 96 const status = res?.data?.status 97 98 renderCountdown(countdown, status) 99 if (msgList.length > 0) { 100 renderMsgList(msgList, status) 101 } 102 } 103 }) 104 } 105 106 function isFloatRecentlyClosed(localStorageKey) { 107 const lastClosedTimestamp = Number(localStorage.getItem(localStorageKey)); 108 if (!lastClosedTimestamp || isNaN(lastClosedTimestamp)) return false; 109 const currentTimestamp = Date.now(); 110 return (currentTimestamp - lastClosedTimestamp) < (24 * 60 * 60 * 1000); 111 } 112 113 function setFloatJustClosed(localStorageKey) { 114 localStorage.setItem(localStorageKey, Date.now()); 115 } 116 117 const handleListenEvent = () => { 118 doc.addEventListener("click", function (event) { 119 const target = event.target.closest("a.popup-activity-annual-26") 120 if (target) { 121 event.preventDefault() 122 if (!$UserManager.isLogin()) { 123 win.$WinOpen({ 124 event: "open", 125 datas: { 126 key: "LOGIN", 127 url: `/ai/login/?redirect=${encodeURIComponent(win.location.pathname + win.location.search)}` 128 } 129 }) 130 return 131 } 132 win.$WinOpen({ 133 event: "open", 134 datas: { key: "LOTTERY", url: "/my/activity/" } 135 }) 136 137 // å¢å æ´»å¨å ¥å£ç¹å»åç¹ 138 win.$Http({ url: "/api/activity/click", data: {id: 4} }) 139 140 $('#adFloat')?.hide() 141 popupOpen = true 142 } 143 144 const closeBtn = event.target.closest(".lottery-popup-btn") 145 if (closeBtn) { 146 window.parent.$WinClose({ 147 event: "allclose" 148 }) 149 window.parent.$('#adFloat').show() 150 popupOpen = false 151 } 152 }) 153 } 154 155 document.addEventListener("DOMContentLoaded", function () { 156 handleListenEvent() 157 const pupupDom = document.getElementById("lottery-popup-wrap") 158 if (pupupDom) { 159 initPupupData() 160 } 161 162 // å¹¿åæµ®çªãaiæµ®çªåè½å°é¡µå ¥å£æ ¹æ®æ¬å°å卿¾ç¤ºæéèï¼é»è®¤CSSå·²å ¨é¨éè 163 // è¥æªå ³éï¼åæ¾ç¤ºå ¥å£ãå ³éååå¨å ³éæ¶é´ï¼24å°æ¶åæåæ¾ç¤ºã 164 165 // å¹¿åæµ®çª
166 const adFloatClosedKey = 'ADFLOAT_CLOSED'; 167 const adFloatElement = document.querySelector('#adFloat'); 168 const adFloatCloseButton = adFloatElement?.querySelector('.on-close-btn'); 169 if (adFloatElement) { 170 if (!isFloatRecentlyClosed(adFloatClosedKey)) { 171 $(adFloatElement).show(); 172 } 173 if (adFloatCloseButton) { 174 adFloatCloseButton.addEventListener('click', function (e) { 175 e.stopPropagation(); 176 $(this).closest(".xqbj-component-adfloat").hide(); 177 setFloatJustClosed(adFloatClosedKey); 178 }); 179 } 180 } 181 182 // aiç§æå ¥å£æµ®çª 183 const aiFloatKey = 'AIFLOAT_CLOSED' 184 const aiFloatDom = document.querySelector('#aiFloat') 185 const aiFixedBtn = aiFloatDom?.querySelector('.on-close-btn') 186 if (aiFloatDom) { 187 if (!isFloatRecentlyClosed(aiFloatKey)) { 188 $(aiFloatDom).show() 189 } 190 if (aiFixedBtn) { 191 aiFixedBtn.addEventListener('click', function (e) { 192 e.stopPropagation() 193 $(this).closest(".xqbj-component-aifloat").hide() 194 setFloatJustClosed(aiFloatKey) 195 }) 196 } 197 } 198 199 // è½å°é¡µå ¥å£æµ®çª 200 const launchAppFloatKey = 'LAUNCHAPP_CLOSED' 201 const launchappFloatDom = document.querySelector('.launchapp-btn-container') 202 const launchappFixedBtn = launchappFloatDom?.querySelector('.launchapp-close-btn') 203 if (launchappFloatDom) { 204 if (!isFloatRecentlyClosed(launchAppFloatKey)) { 205 $(launchappFloatDom).show() 206 } 207 if (launchappFixedBtn) { 208 launchappFixedBtn.addEventListener('click', function (e) { 209 e.stopPropagation() 210 $(this).closest(".launchapp-btn-container").hide() 211 setFloatJustClosed(launchAppFloatKey) 212 }) 213 } 214 } 215 216 217 }) 218})(document, window) 219// æ¥èæ´»å¨å¼¹çª end
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.