'use strict'; // ==UserScript== // @name 虎牙Plus // @namespace http://tampermonkey.net/ // @icon https://www.huya.com/favicon.ico // @version 1.0.23 // @description 虎牙自动领取任务经验、开宝箱,复制直播流链接,简化页面,去广告, 夜间模式,自动进入剧场模式, 我的订阅页面视频预览 // @author Francis // @match *://*.huya.com/* // @grant GM_setClipboard // @grant GM_xmlhttpRequest // @license MIT // @require https://cdn.jsdelivr.net/hls.js/latest/hls.min.js // @downloadURL none // ==/UserScript== let $; function addUi(){ let style = document.createElement('style'); style.appendChild(document.createTextNode(` span.copy-stream-link:after { display: none; position: absolute; content: ""; right: -20px; top: 6px; width: 18px; height: 18px; overflow: hidden; background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4RpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo0YjMyYjVhNy1jMThjLTg2NDItYjRlMy04NzdmMjFiZjkzZTciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MEJCNDhFNEIxMDZBMTFFN0IzQUNGNTM3RTZBMjEyRTQiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MEJCNDhFNEExMDZBMTFFN0IzQUNGNTM3RTZBMjEyRTQiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTQgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MmFlNTQ3NDgtZjlmZS04NjQwLTg0ZTgtMmY4ZTcwYjc2YTkyIiBzdFJlZjpkb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6NWE5YjI1YjQtZmE1ZC0xMWU2LWI1MmYtYWM2NWYxZGRlZjQ2Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+KzIZ1wAAAz9JREFUeNqslm1IU1EYx5/dzSW+pWVZppimzV7pzZWVIhGFZiIEgmFlREGmH4qEJOhFqEVf+tCXviiCZC/4Icga0ocwIyURcmnO2ZIyM9+auqnb1NnzXM5sm7u719wffrC7c+7zP+fc55zzyDQN+0BEMiQNOYYcQBKRCNZmQr4iH5A6pBGZ8xVM4aONQwqRMmbiTVEMGkgpM9cgVYhDKKg3xSPNSIUPM29KZO80sxiSDDOQj0gK/L9SWIx0McMjSD0SCUsXxXiDHBUyVCG1iBL8JyWLqfI0lCPVSCj4WWtDN4ekxp6uZh7zWXpmid9sYfpzSkhbfwHU6/JBJuNSekZbCn+bOysUbJ+V+dNsTYgKspNvQmRQPMw4bKDt0gCaXcOmSgXLpER/GMnwC+2NLYD09eeBkylganoMajuuQt94u3PLpJNhlj/MgpUrISf5FsSF7+GfLfZheKIrhpHJ767dsshwv1gwGm3YstUwav3ltT0ufDea3eZNSeO2ATQrAdNUr2fXVDJM8j3yFZC76Q6sCk6AZ58vQ7/5i1u7OuYkZMQX4aD4JASzbRBq2i7h4Pq8hdvIuRzECxQdugUKd1ZB7PIdEKgIg/ztD/nfzizMSS6HQwkl82a2GQs8b78iZEaKEDy8t0ZlQmZSGci5gH+7WB4EedseQH33fdgVfYIfkFPTDismSCkMTRhB7LYwsRPfTQOWLrDOmPkldVUAFwjZqhseveegTl8OvWOfxNLBREva7a1laOIb1OiK+GwTU0PPI+gafislmQ1k2CTUSilNCUBZJ6SOwXpo6q2WunuayPCVrx5/pn6gaRGMWfth4bIbQGu4K3bJu+o1Gb5jN7WgaP89bruI++rn/H+UkS86r+PRZZdqRh6NHBvePbHetKz0TWnGJK1B4zYACSIPh/zw2Rh60LEjLtrXG/bZSdBjclhsQ6AbeLkYs1akmCbnvA9nkVN0BIq9OWEfgZa+p4sxo5gFzMPtxtcjeTQRP95UdhZTL1TTaJFcKTOVOLNcFtNn1aZlt3/rEsxaWQyt1LqUlkCNnEOMizAysnfUrssotfKmyrmSVdEHkePs7tzgUeobWalPafteqOJ26q8AAwB8rQG0tt5ioQAAAABJRU5ErkJggg==); background-size: 18px 18px; } span.copy-stream-link.copy-success:after { display: block; } .huya-plus-btn{ display: block; font-size: 11px; padding:0 10px; color:#b08444; background:#FFD29E; border-radius:15px; margin-left: 30px; user-select: none; transition:all .5s; } .huya-plus-btn:hover{ color:#FFF; background:#ffa801; } #huya-ab, .player-banner-gift, #player-marquee-wrap, .room-gg-chat, .room-mod-ggTop, #hy-nav-download, .hy-nav-kaibo, .hy-nav-item:nth-child(2), #J_roomGameBuy, .jump-to-phone, #week-star-btn, .g-gift, #J_bigStreamerStage, #J_hySide, .room-business-game, #J_hostChannel, #J_BusinessGameRoot, #sidebarBanner, .mod-news-section, .mod-index-list>.live-box, #J_adCategory { display:none !important; } body, .duya-header-wrap, #main_col, .room-hd-l, .player-gift-wrap, .chat-room__ft, .jspPane, #J_profileNotice>div, .week-rank__btn, .J_msg, .chat-room__list, .msg-nobleEnter, .msg-nobleEnter>div, .msg-nobleSpeak, .player-face-arrow, #player-gift-tip, .jspVerticalBar, .illegal-report, .subscribe-hd.sub-on, .huya-plus-btn, #player-gift-tip bottom, #player-gift-tip btn, .fansBadge-box, .nav-expand-list, .tt-user-card, .share-entrance, .search-suggest, .u-links, .entrance-expand, .gameBuy-bd, .guide-to-app, .chat-room__wrap, #J_profileNotice, .msg-onTVLottery, .room-core, .msg-noble, #J_box_msgOfKing, .msg-of-king, .subscribe-hd.sub-on, .huya-plus-btn, .nav-expand-game dd a, .subscribe-hd.sub-on, .huya-plus-btn, .match-item, .hy-nav-link, .hy-nav-title, .nav-user-title, #J_roomTitle, .msg, .subscribe-hd.sub-on, .huya-plus-btn, .cont-item, .week-rank__btn, .week-rank-name, .msg-nobleEnter, .peo-name, .search-item, .history-bd .new-clickstat, .from, .to, .nav-expand-game dd a, .hy-header-match-preview-name, #pub_msg_input, #search-bar-input:focus, .msg-noble, #J_box_msgOfKing, #J_hyUserCard .u-assets, .room-sidebar, .duya-header-wrap, .week-rank__unit, .chat-room__input, .chatNotice, #J_profileNotice, .plaer-face-icon-bg, .chat-room__ft__chat, #tipsOrchat, .week-rank__btn.active, #pub_msg_input, #search-bar-input, .week-rank__bd li, .subscribe-live-item, .subscribe-live-item .txt .msg-row .nick, .list-hd .title, .match_body_wrap { transition: background .3s, background-color .3s, color .3s, border-color .3s; } .live-box .box-hd .more-list li, .live-box .box-hd .more-list li:hover, .night-mode .mod-list .box-hd .filter dd .tag-layer, .nav-expand-game dd a{ border-color: #464646 !important; } body.night-mode, .night-mode .duya-header-wrap, .night-mode #main_col, .night-mode .room-hd-l, .night-mode .player-gift-wrap, .night-mode .chat-room__ft, .night-mode .jspPane, .night-mode #J_profileNotice>div, .night-mode .week-rank__btn, .night-mode .J_msg, .night-mode .chat-room__list, .night-mode .msg-nobleEnter, .night-mode .msg-nobleEnter>div, .night-mode .msg-nobleSpeak, .night-mode .player-face-arrow, .night-mode #player-gift-tip, .night-mode .jspVerticalBar, .night-mode .illegal-report, .night-mode .subscribe-hd.sub-on, .night-mode .huya-plus-btn, .night-mode #player-gift-tip bottom, .night-mode #player-gift-tip btn, .night-mode .fansBadge-box, .night-mode .nav-expand-list, .night-mode .tt-user-card, .night-mode .share-entrance, .night-mode .search-suggest, .night-mode .u-links, .night-mode .entrance-expand, .night-mode .gameBuy-bd, .night-mode .guide-to-app, .night-mode .chat-room__wrap, .night-mode #J_profileNotice, .night-mode .msg-onTVLottery, .night-mode .room-core, .night-mode .msg-noble, .night-mode .match_body_wrap, .night-mode #J_roomHdR, .night-mode .msg-watchTogetherVip, .night-mode .room-weeklyRankList-content>div, .night-mode .room-weeklyRankList-nav-item, .night-mode .huya-footer, .night-mode .program-preview-box, .night-mode .program-preview-box .preview-bd, .night-mode .star-box .star-content { background-color: rgb(47, 48, 53) !important; } .night-mode #J_box_msgOfKing, .night-mode .msg-of-king { background: rgb(47, 48, 53) !important; } .night-mode .subscribe-hd.sub-on, .night-mode .huya-plus-btn, .night-mode .nav-expand-game dd a, .night-mode .subscribe-live-item, .night-mode .room-weeklyRankList-nav-item.room-weeklyRankList-nav-item-active, .night-mode .game-live-item, .night-mode .game-live-item .txt .num, .night-mode .j_anchor_label, .night-mode .g-gameCard-item, .night-mode .mod-list .box-hd .filter dd .tag-layer { background-color: #464646 !important; } .night-mode .subscribe-hd.sub-on, .night-mode .huya-plus-btn, .night-mode .match-item, .night-mode .mod-list .box-hd .title a, .night-mode .game-live-item a.title, .night-mode .j_index-game-title, .night-mode .live-box .box-hd .more-list li a, .night-mode .live-box_funny .box-hd .title span, .night-mode .g-gameCard-fullName { color: #8e8a8a !important; } .night-mode .hy-nav-link, .night-mode .hy-nav-title, .night-mode .nav-user-title, .night-mode #J_roomTitle, .night-mode .msg, .night-mode .subscribe-hd.sub-on, .night-mode .huya-plus-btn, .night-mode .cont-item, .night-mode .week-rank__btn, .night-mode .week-rank-name, .night-mode .msg-nobleEnter, .night-mode .peo-name, .night-mode .search-item, .night-mode .history-bd .new-clickstat, .night-mode .from, .night-mode .to, .night-mode .nav-expand-game dd a, .night-mode .hy-header-match-preview-name, .night-mode #pub_msg_input, .night-mode #search-bar-input:focus, .night-mode .msg-noble, .night-mode #J_box_msgOfKing, .night-mode #J_hyUserCard .u-assets, .night-mode .follow-ctrl, .night-mode .subscribe-live-item .txt .msg-row .nick, .night-mode .list-hd .title, .night-mode .nick, .night-mode .fansBadge-hig, .night-mode .room-weeklyRankList-nav-item, .night-mode .room-weeklyRankList-content>div, .night-mode .g-gameCard-fullName:hover { color: #E7E7E7 !important; } .night-mode .room-sidebar, .night-mode .duya-header-wrap, .night-mode .week-rank__unit, .night-mode .chat-room__input, .night-mode .chatNotice, .night-mode #J_profileNotice, .night-mode .plaer-face-icon-bg, .night-mode .chat-room__ft__chat, .night-mode #tipsOrchat { border-color: #3e3e3e !important; } .night-mode .week-rank__btn.active, .night-mode #pub_msg_input, .night-mode #J_weekRankList li:hover, .night-mode #J_fansRankList li:hover, .night-mode .seat-item:hover, .night-mode #search-bar-input, .night-mode .search-item:hover, .night-mode .video-link:hover, .night-mode .history-bd .new-clickstat:hover, .night-mode .video-item:hover, .night-mode .match-item:hover, .night-mode .hy-header-match-preview li:hover, .night-mode .week-rank__bd li:hover, .night-mode .follow-ctrl, .night-mode #J_roomWeeklyRankListRoot ul>li:hover, .night-mode [class^="seat-item-"]:hover { background-color: #565656 !important; } .night-mode .subscribe-live-item:hover{ box-shadow: 2px 2px 10px #565656 !important; } .night-mode-btn-wrapper,.setting-btn-wrapper{ float: left; position: relative; margin-left:15px; height: 100%; display: flex; align-items: center; justify-content: center; } .night-mode-switch-btn,.setting-btn{ width: 26px; height: 26px; border-radius: 13px; } .huyaplus-page-full-mode #player-wrap{ height: 100% !important; } .huyaplus-page-full-mode #player-gift-wrap{ position: relative; bottom: 0px !important; transition: all .5s; } .huyaplus-page-full-mode #player-ctrl-wrap{ position: relative; bottom: 0 !important; transition: all .5s !important; } #player-ctrl-wrap.show, #player-gift-wrap.show{ bottom: 100px !important; } .night-mode-icon,.setting-icon{ fill: #8A8A8A; } .night-mode .night-mode-icon,.night-mode .setting-icon{ fill: #AEAEAE; } .setting-panel-wrapper{ visibility: hidden; width: 200px; height: 0; position: absolute; top: 100%; background: #777777; padding: 10px; transition: height .3s; border-bottom-right-radius:5px; border-bottom-left-radius:5px; } .setting-btn-wrapper:hover .setting-panel-wrapper{ visibility: visible; height: 200px; } .video-previewing .item-mask, .video-previewing .btn-link__hover_i{ visibility: hidden; } `)); document.head.appendChild(style); let copyStreamLinkNode = document.createElement('div'); copyStreamLinkNode.style = "cursor: pointer;display:inline-flex;vertical-align:top;"; const openWithPlayerBtn = isMacOS() ? `使用IINA打开`: `使用PotPlayer打开`; copyStreamLinkNode.innerHTML = `复制直播流${openWithPlayerBtn}`; let titleRigion = document.querySelector('.host-title'); if(titleRigion){ titleRigion.appendChild(copyStreamLinkNode); document.querySelector('.copy-stream-link').onclick = async e=>{ GM_setClipboard(await getStreamUrl()); showCopySuccessIcon(); }; $(".open-with-iina").click(async ()=>{ openStreamWithIINA(await getStreamUrl()); }); $(".open-with-potplayer").click(async ()=>{ openStreamWithPotPlayer(await getStreamUrl()); }); } } async function getStreamUrl(){ let url = window.location.href; let streamUrl = sessionStorage.getItem(url) if(!streamUrl || streamUrl.length === 0){ streamUrl = await doGetStreamUrl(url).catch(e=>{}); if(streamUrl && streamUrl.length > 0){ sessionStorage.setItem(url, streamUrl); } else { alert("获取直播流失败"); throw new Error("获取直播流失败"); } } let ibitrate = getCurrentIbitrate(); return convertStreamIbitrate(streamUrl, ibitrate) } function getCurrentIbitrate(){ return $(".player-videotype-list>li.on").attr('ibitrate') } function convertStreamIbitrate(streamUrl, ibitrate){ let ibit = parseInt(ibitrate); if(!isNaN(ibit)){ streamUrl = streamUrl.replace(/(ratio=)(\d+)/, `$1${ibit}`); } console.log(streamUrl) return streamUrl; } async function doGetStreamUrl(url){ try{ let mobileHtml = await new Promise((resolve,reject)=>{ GM_xmlhttpRequest({ method: 'GET', headers: { 'user-agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' }, url: url, responseType: 'text', onload: resp=>{ resolve(resp.responseText); }, onerror: e => { reject(e); } }) }); let streamUrl = /\\s*var liveLineUrl = "(.+)";\s*\<\/script\>/.exec(mobileHtml)[1]; if(!streamUrl.startsWith('//')){ streamUrl = Base64.decode(streamUrl); } return `https:${streamUrl}`; }catch(e){ throw e; } } function isMacOS(){ var UserAgent = navigator.userAgent.toLowerCase(); return /mac os/.test(UserAgent); } function showCopySuccessIcon(){ $('span.copy-stream-link').addClass('copy-success'); setTimeout(()=>{$('span.copy-stream-link').removeClass('copy-success');},1000) } function autoReceiveBoxReward(){ let rewardBtns = $(".player-box-list .player-box-stat3").filter((i,it)=>$(it).css("visibility") === 'visible'); if(rewardBtns.size() > 0){ let btn = $(rewardBtns[0]); btn.click(); let waitComplete = ()=>{ if(btn.css("visibility") === 'hidden'){ $("#player-box").hide(); console.log("开启宝箱"); autoReceiveBoxReward(); } else { setTimeout(waitComplete,1000); } }; setTimeout(waitComplete,1000); } } function autoReceiveTaskXP(){ let taskBtns = $(".tasks .status .status-get"); if(taskBtns.size() > 0){ $.each(taskBtns,(_,btn)=>{ $(btn).click(); }); console.log(`自动领取经验,本次完成${taskBtns.length}个任务`) } } function cleanPage(){ $(".room-gg-chat").remove(); $(".room-footer").remove(); } function completeChatTask(){ const taskInfo = $(".tasks .tit").filter((i,it)=>$(it).text() === '在1场直播中发送弹幕'); const taskDone = taskInfo.siblings(".status").find(".status-ing").size() === 0; if(!taskDone){ chat('66666') } } function chat(msg){ $("#pub_msg_input").val(msg).keyup(); $("#msg_send_bt").click(); } function openStreamWithPotPlayer(streamUrl){ openStreamWithPlayer("PotPlayer://", streamUrl); } function openStreamWithIINA(streamUrl){ openStreamWithPlayer("iina://weblink?url=", encodeURIComponent(streamUrl)) } function openStreamWithPlayer(playerUrlSchema, streamUrl){ window.open(`${playerUrlSchema}${streamUrl}`, "_self") } function jqueryLoaded(){ $ = unsafeWindow.$ return $; } function pageLoaded(){ if($(".tasks .status").size() == 0){ $(".nav-user-title").mouseenter() } return $(".box-icon-word").size() > 0 && $(".tasks .status").size() > 0 } async function waitLoad(conditionFunc){ return new Promise(function(resolve,reject){ let w = ()=>{ if(conditionFunc()){ resolve(); } else { setTimeout(w,1000); } } w(); }); } function nightMode(){ $("#J_global_user_tips").before(`
`) let switchDay = ()=>{ document.body.classList.remove('night-mode'); localStorage.setItem("night-mode",false); } let switchNight = ()=>{ document.body.classList.add('night-mode'); localStorage.setItem("night-mode",true); } $(".night-mode-switch-btn").click(()=>{ if(document.body.classList.contains("night-mode")){ switchDay(); } else { switchNight(); } }) if(localStorage.getItem("night-mode") === 'true'){ switchNight(); } } function settings(){ $("#J_global_user_tips").before(`
`) } // 自动领取礼物掉落的宝箱 let receiveTimer; function autoReceiveTreasure(){ if($("#J_treasureChestContainer .btn").size() === 0){ return; } let alreadyChat = false; let receive = ()=>{ if($("#J_treasureChestContainer .btn.usable").size() > 0){ $("#J_treasureChestContainer .btn.usable").click() clearInterval(receiveTimer); receiveTimer = undefined; } else if($("#J_treasureChestContainer .btn").size() > 0) { if(!alreadyChat){ chat('666') alreadyChat = true; } } else { clearInterval(receiveTimer); receiveTimer = undefined; } } if(!receiveTimer){ receiveTimer = setInterval(receive,1000); } } function addEventListener(){ $("#player-fullpage-btn").click(()=>{ if($(".player-narrowpage").size() > 0){ $("#videoContainer").addClass("huyaplus-page-full-mode"); } else { $("#videoContainer").removeClass("huyaplus-page-full-mode"); $("#player-ctrl-wrap, #player-gift-wrap").removeClass("show"); } }) $("#player-fullscreen-btn").click(()=>{ if($(".player-narrowscreen").size() > 0 && $(".player-narrowpage").size() > 0){ console.log("add") $("#videoContainer").removeClass("huyaplus-page-full-mode"); $("#player-ctrl-wrap, #player-gift-wrap").removeClass("show"); } else if($(".player-narrowpage").size() > 0){ console.log("remove") $("#videoContainer").addClass("huyaplus-page-full-mode"); } }) $("#player-video").dblclick(()=>{ if($(".player-narrowpage").size() > 0){ $("#videoContainer").addClass("huyaplus-page-full-mode"); } else { $("#videoContainer").removeClass("huyaplus-page-full-mode"); $("#player-ctrl-wrap, #player-gift-wrap").removeClass("show"); } }) let hideTimeout; $(".room-player").on("mousemove",".huyaplus-page-full-mode", ()=>{ $("#player-ctrl-wrap, #player-gift-wrap").addClass("show"); clearTimeout(hideTimeout); hideTimeout = setTimeout(()=>{ $("#player-ctrl-wrap, #player-gift-wrap").removeClass("show"); },2000); }).on("mouseleave",".huyaplus-page-full-mode", ()=>{ $("#player-ctrl-wrap, #player-gift-wrap").removeClass("show"); }) } function addStreamVideoPreview(){ let previewTimeout,hls; $("body").on('mouseenter','.subscribe-live-item', function(e){ previewTimeout = setTimeout(()=>{ let streamUrl = $(e.target).parent().get(0).href; $(e.target).parent().prepend(``) doGetStreamUrl(streamUrl).then(videoUrl=>{ if(Hls.isSupported()) { videoUrl = convertStreamIbitrate(videoUrl, 500); var video = document.getElementById('video-preview'); hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.MANIFEST_PARSED,function() { let video = document.getElementById('video-preview'); if(video){ $(video).show(); video.play(); toggleLiveItemMask($(e.target).parent(), false) } }); } }).catch(e=>{ console.log("Video Preview failed") }) }, 1000) }); $("body").on('mouseleave','.subscribe-live-item', function(e){ clearTimeout(previewTimeout); $("#video-preview").remove(); toggleLiveItemMask($(".video-previewing"), true) if(hls){ hls.destroy(); } }); } function toggleLiveItemMask(liveItemEle, show){ if(show){ liveItemEle.removeClass('video-previewing') } else { liveItemEle.addClass('video-previewing') } } function autoMaxIbitrate(){ let el = $('.player-videotype-list>li:first'); if(el.length === 1){ el.click(); } } function initPlayer(){ autoMaxIbitrate(); $(".player-fullpage-btn").click(); } let timer,treasureTimer; (async function() { await waitLoad(jqueryLoaded); cleanPage(); nightMode(); //settings(); addUi(); addStreamVideoPreview(); if(treasureTimer) clearInterval(treasureTimer) treasureTimer = setInterval(autoReceiveTreasure, 30000) await waitLoad(pageLoaded); addEventListener(); initPlayer(); completeChatTask(); let intervalInMills = 60 * 1000; let task = ()=>{ autoReceiveBoxReward(); autoReceiveTaskXP(); }; task(); if(timer) clearInterval(timer); timer = setInterval(task,intervalInMills); })();