setInterval(() => { changeCheck() }, 3000) //默认开始显示域名 var autourldefault = [] //泛解析域名 var mdomain = [] //默认渠道ID var domainKeys = { 'domain.com': '654321' } //默认CID var defaultCid = '' var currentDomain = window.location.hostname var reparams = { cid: domainKeys[currentDomain] || defaultCid //默认CID } function changeCheck() { var list = document.querySelectorAll('.ms') list.forEach((item) => { item.innerHTML = getRandom(10, 20) + 'ms' }) var listSITE = document.querySelectorAll('.site') var lobby_domain = [...autourldefault, ...(window.COMBODOMAIN || [])] var listdomain = lobby_domain.concat(mdomain) listSITE.forEach((item, index) => { var rand = getRandom(0, listdomain.length - 1) var showLink = listdomain[rand] //获取link地址 var link = document.getElementById(`link${index}`) if (link) { var linkUrl = link.getAttribute('data-url') if (linkUrl) { showLink = linkUrl } } //剔除协议 if (showLink.indexOf('://') != -1) { showLink = showLink.split(':')[1].replace('//', '') } //item.innerHTML = showLink //设置地址 if (link) { var goUrl = showLink if (mdomain.includes(goUrl)) { goUrl = 'www' + generateDomain() + '.' + goUrl } link.href = 'https://' + goUrl + location.search } }) } //随机生成临时域名 自动生成前缀5-16位字母+数字组合域名,且 不可修改 function generateDomain() { var randomNumber = getRandom(5, 16) return randomString(randomNumber) } /** * 随机生成字符串 */ function randomString(letterNumber = 4) { var getNum = [] for (let i = 0; i < letterNumber; i++) { //生成小写字母 var ranNum = Math.ceil(Math.random() * 25) var downerCase = String.fromCharCode(97 + ranNum) //生成随机0-9的数字 var numberCase = Math.floor(Math.random() * 10) //0-1开关 var flowType = Math.floor(Math.random() * 2) getNum.push(flowType == 1 ? downerCase : numberCase) } return getNum.join('') } function getRandom(n, m) { var num = Math.floor(Math.random() * (m - n + 1) + n) return num } function getUrlParam(n) { var n = n || window.location.href, o = {} return ( n.replace(/(\w+)=([\w-@]+)/gi, function (n, r, e) { return (o[r] = e) }), o ) }