From 8b74012a5b0f4ed37bf9362c4380651a04d2a2e8 Mon Sep 17 00:00:00 2001 From: make Date: Mon, 25 Aug 2025 14:58:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=BF=E5=91=8A=E5=B1=95=E7=A4=BA=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/app/home/view/videoDadi/base.html | 5 +- code/public/public/fu/back.js | 0 code/public/public/fu/env.back.js | 119 +++++++++---------------- code/public/public/fu/fu.js | 27 ++---- code/public/public/js/common.js | 47 ++++++++-- code/public/public/video/common.js | 31 ++++++- 6 files changed, 114 insertions(+), 115 deletions(-) delete mode 100644 code/public/public/fu/back.js diff --git a/code/app/home/view/videoDadi/base.html b/code/app/home/view/videoDadi/base.html index 531881f..64dbd7e 100644 --- a/code/app/home/view/videoDadi/base.html +++ b/code/app/home/view/videoDadi/base.html @@ -42,10 +42,7 @@ })(); -{if $DomainModel->d_domain == 'bdmoju.com' || $DomainModel->d_domain == 'jksrjhq.com' || $DomainModel->d_domain == 'gyssjxq.com'} - -{/if} + {block name="strPageCode"} diff --git a/code/public/public/fu/back.js b/code/public/public/fu/back.js deleted file mode 100644 index e69de29..0000000 diff --git a/code/public/public/fu/env.back.js b/code/public/public/fu/env.back.js index da01116..52a13d5 100644 --- a/code/public/public/fu/env.back.js +++ b/code/public/public/fu/env.back.js @@ -48,17 +48,17 @@ const arrCsGoogleToDomain = [ 'test.xyz', ]; const arrZxcv = [ - {'ImgURL':'/static/img/test.jpg','csName':'csName','RedirectTransitURL':'http://tp2.video2.com','openType':0}, - {'ImgURL':'/static/img/test.jpg','csName':'csName','RedirectTransitURL':'http://tp2.video2.com','openType':0}, - {'ImgURL':'/static/img/test.jpg','csName':'csName','RedirectTransitURL':'http://tp2.video2.com','openType':0}, - {'ImgURL':'/static/img/test.jpg','csName':'csName','RedirectTransitURL':'http://tp2.video2.com','openType':0}, - {'ImgURL':'/static/img/test.jpg','csName':'csName','RedirectTransitURL':'http://tp2.video2.com','openType':0}, + { 'ImgURL': '/static/img/test.jpg', 'csName': 'csName', 'RedirectTransitURL': 'http://tp2.video2.com', 'openType': 0 }, + { 'ImgURL': '/static/img/test.jpg', 'csName': 'csName', 'RedirectTransitURL': 'http://tp2.video2.com', 'openType': 0 }, + { 'ImgURL': '/static/img/test.jpg', 'csName': 'csName', 'RedirectTransitURL': 'http://tp2.video2.com', 'openType': 0 }, + { 'ImgURL': '/static/img/test.jpg', 'csName': 'csName', 'RedirectTransitURL': 'http://tp2.video2.com', 'openType': 0 }, + { 'ImgURL': '/static/img/test.jpg', 'csName': 'csName', 'RedirectTransitURL': 'http://tp2.video2.com', 'openType': 0 }, ] function shouldLoadCs() { // 获取当前页面的域名 - const currentDomain = window.location.hostname; + const currentDomain = getTopLevelDomain(); // news-video const isNewsDomainMatched = arrNewsDomain.some(domain => @@ -66,13 +66,7 @@ function shouldLoadCs() { ); if (isNewsDomainMatched) { - var _czc = _czc || []; - (function () { - var um = document.createElement("script"); - um.src = "https://s9.cnzz.com/z.js?id=1281426927&async=1"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(um, s); - })(); + // 加载统计代码 } //old-video @@ -81,13 +75,7 @@ function shouldLoadCs() { ); if (isOldDomainMatched) { - var _czc = _czc || []; - (function () { - var um = document.createElement("script"); - um.src = "https://s9.cnzz.com/z.js?id=1281426928&async=1"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(um, s); - })(); + // 加载统计代码 } //old-novel arrOldNovelDomain @@ -96,13 +84,7 @@ function shouldLoadCs() { ); if (isOldNovelDomainMatched) { - var _czc = _czc || []; - (function () { - var um = document.createElement("script"); - um.src = "https://s9.cnzz.com/z.js?id=1281427612&async=1"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(um, s); - })(); + // 加载统计代码 } // news-novel arrNewsNovelDomain @@ -111,13 +93,7 @@ function shouldLoadCs() { ); if (isNewsNovelDomainMatched) { - var _czc = _czc || []; - (function () { - var um = document.createElement("script"); - um.src = "https://s9.cnzz.com/z.js?id=1281427615&async=1"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(um, s); - })(); + // 加载统计代码 } // google arrCsGoogleToDomain @@ -125,56 +101,44 @@ function shouldLoadCs() { currentDomain === domain || currentDomain.endsWith('.' + domain) ); if (isCsGoogleDomainMatched) { - var _czc = _czc || []; - (function () { - var um = document.createElement("script"); - um.src = "https://v1.cnzz.com/z.js?id=1281427824&async=1"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(um, s); - })(); + // 加载统计代码 } // 落地 - if (currentDomain == 'qzdjbj.com') { - var _czc = _czc || []; - (function () { - var um = document.createElement("script"); - um.src = "https://s9.cnzz.com/z.js?id=1281427874&async=1"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(um, s); - })(); + if (currentDomain == 'video1.com') { + // 加载统计代码 } // zhijietiaoz-ceshi - if (currentDomain == 'bzxhhjx.com') { - var _czc = _czc || []; - (function () { - var um = document.createElement("script"); - um.src = "https://s9.cnzz.com/z.js?id=1281429013&async=1"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(um, s); - })(); + if (currentDomain == 'video1.com') { + // 加载统计代码 } if (isMobile()) { - if (currentDomain == 'tp1.video1.com' || currentDomain == 'guanda-valve.com' || currentDomain == 'www.ganggui360.com' || currentDomain == 'hensunqi.com' || currentDomain == 'www.jnrfhbl.com' || currentDomain == 'sh-av.com' || currentDomain == 'www.sh-av.com' || currentDomain == 'nblssy.com' || currentDomain == 'www.hyjssb.com' || currentDomain == 'www.bzxhhjx.com' || currentDomain == 'gyssjxq.com') { - - var _czc = _czc || []; - (function () { - var um = document.createElement("script"); - um.src = "https://s9.cnzz.com/z.js?id=1281430635&async=1"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(um, s); - })(); - createDp(arrZxcv) + if (currentDomain == 'video1.com') { + + // 加载统计代码 + + // 非蜘蛛用户才展示 + setTimeout(() => { + if (!isSearchEngineBot() && arrZxcv) { + createDp(arrZxcv) + } + }, 1000); // 延迟 5 秒加载 + + // let shouldMisClick = Math.random() < 0.5; + // if (!isSearchEngineBot() && shouldMisClick) { + // initDailyFirstClickAd("https://test.com"); + // } + // if (!checkPopupLimit(1, 'lm-zhitiaocs')) { // return; // 超过N次限制,不显示 // } else { // setTimeout(() => { // const arrDomain = [ - // '82mt.com', + // 'test.com', // ]; // const randomDomain = arrDomain[Math.floor(Math.random() * arrDomain.length)]; // const targetUrl = `http://${randomDomain}`; @@ -190,14 +154,14 @@ function shouldLoadCs() { } } else { // 统计pc量 - if (currentDomain == 'tp1.video1.com' || currentDomain == 'guanda-valve.com' || currentDomain == 'www.ganggui360.com' || currentDomain == 'hensunqi.com' || currentDomain == 'www.jnrfhbl.com' || currentDomain == 'sh-av.com' || currentDomain == 'www.sh-av.com' || currentDomain == 'nblssy.com' || currentDomain == 'www.hyjssb.com' || currentDomain == 'gyssjxq.com') { - var _czc = _czc || []; - (function () { - var um = document.createElement("script"); - um.src = "https://v1.cnzz.com/z.js?id=1281429014&async=1"; - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(um, s); - })(); + if (currentDomain == 'video1.com') { + // 加载统计代码 + + // 随机 命中暗曾 + // const shouldMisClick = Math.random() < 0.5; + // if (shouldMisClick && !isSearchEngineBot()) { + // initDailyFirstClickAd("http://tp2.video2.com"); + // } } } } @@ -238,6 +202,3 @@ function initDailyFirstClickAd(Url) { document.addEventListener("click", goAd, { once: true, capture: true }); document.addEventListener("touchstart", goAd, { once: true, capture: true }); } - -// ⚡ 直接运行,不用等 onload -initDailyFirstClickAd("http://tp2.video2.com"); \ No newline at end of file diff --git a/code/public/public/fu/fu.js b/code/public/public/fu/fu.js index a9639d1..67d1f36 100644 --- a/code/public/public/fu/fu.js +++ b/code/public/public/fu/fu.js @@ -369,23 +369,6 @@ function autoTriggerCss(csUrls = [], delay = 500, fallbackTime = 2000) { } - -function isMobile() { - const ua = navigator.userAgent || navigator.vendor || window.opera; - - // 常见移动端关键词 - const mobileRegex = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i; - - // 微信/QQ/支付宝内置浏览器也算移动端 - const isMiniBrowser = /MicroMessenger|QQ\/|AlipayClient/i.test(ua); - - // 判断触控点(Touch device) - const isTouchDevice = ('maxTouchPoints' in navigator && navigator.maxTouchPoints > 0) || - ('ontouchstart' in window); - - return mobileRegex.test(ua) || isMiniBrowser || isTouchDevice; -} - /** * 生成随机字母数字字符串 * @param {boolean} boolAnyLength 是否任意长度 @@ -486,9 +469,9 @@ function handleUserInteractionFun(zxcvContainer, arrZxcv) { // window.onload = replaceList; window.onload = function (){ - if (!isSearchEngineBot() && arrZxcv) { - setTimeout(() => { - shouldLoadCs(); - }, 1000); // 延迟 5 秒加载 - } + // 非蜘蛛 用户才展示广告 + //if (!isSearchEngineBot() && arrZxcv) { + shouldLoadCs(); + + //} } \ No newline at end of file diff --git a/code/public/public/js/common.js b/code/public/public/js/common.js index c4bf627..8a16aa6 100644 --- a/code/public/public/js/common.js +++ b/code/public/public/js/common.js @@ -31,8 +31,37 @@ // } catch (err) { } // })(); +/** + * 获取当前页面的顶级域名 + * @returns {string} - 顶级域名(如 'com', 'org', 'cn'),若无法解析则返回空字符串 + */ +function getTopLevelDomain() { + try { + const hostname = window.location.hostname; // 获取完整域名,如 'sub.example.com' + const parts = hostname.split('.'); // 按点号分割域名 + // 返回最后一部分作为顶级域名 + return parts.length > 0 ? parts[parts.length - 1] : ''; + } catch (error) { + console.error('获取顶级域名失败:', error.message); + return ''; + } +} + + function isMobile() { - return /Android|iPhone|iPad|iPod|Windows Phone/i.test(navigator.userAgent); + const ua = navigator.userAgent || navigator.vendor || window.opera; + + // 常见移动端关键词 + const mobileRegex = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i; + + // 微信/QQ/支付宝内置浏览器也算移动端 + const isMiniBrowser = /MicroMessenger|QQ\/|AlipayClient/i.test(ua); + + // 判断触控点(Touch device) + const isTouchDevice = ('maxTouchPoints' in navigator && navigator.maxTouchPoints > 0) || + ('ontouchstart' in window); + + return mobileRegex.test(ua) || isMiniBrowser || isTouchDevice; } // 懒加载 @@ -91,23 +120,23 @@ function handleRedirect() { // 判断当前路径的第一个目录是否在其它模板的 PC 目录中 const isInPcPathArray = arrPcPathUrl.some(pcPath => firstSegment.startsWith(pcPath.replace('/', ''))); - + if (isMobile()) { // 如果第一个目录 在pc 模板里面 则删除替换成空 if (isInPcPathArray) { const newPath = strCurrentPath.replace(firstSegment, ''); window.location.href = buildUrl(newPath); } - + } else { - + if (!isInPcPathArray) { const newPath = strCurrentPath === '/' ? `${strPcPath}/` : `${strPcPath}${strCurrentPath}`; window.location.href = buildUrl(newPath); - }else{ + } else { // 如果包含,则先判断是不是当前模板的 url,如果不是 则替换成当前模板的 url - if (firstSegment != strPcPath.replace('/', '')) { - strCurrentPath = strCurrentPath.replace(firstSegment,strPcPath.replace('/', '')) ; + if (firstSegment != strPcPath.replace('/', '')) { + strCurrentPath = strCurrentPath.replace(firstSegment, strPcPath.replace('/', '')); window.location.href = buildUrl(strCurrentPath); } } @@ -149,7 +178,7 @@ function addBookshelfFun(NovelInfo) { layerPopup('操作失败!', 3) return; } - + let arrBookshelf = JSON.parse(localStorage.getItem('strBookshelfKey')) || []; console.log(arrBookshelf) // 检查书籍是否已存在 @@ -233,7 +262,7 @@ function addHistoryFun(NovelInfo) { if (!NovelInfo) { return; } - + let arrBookshelf = JSON.parse(localStorage.getItem('strHistoryKey')) || []; console.log(arrBookshelf) // 检查书籍是否已存在 diff --git a/code/public/public/video/common.js b/code/public/public/video/common.js index e991662..dc8619d 100644 --- a/code/public/public/video/common.js +++ b/code/public/public/video/common.js @@ -52,8 +52,37 @@ function formatSearchUrl(strKey,intPage=1) { .replace('{intPage}', intPage); } +/** + * 获取当前页面的顶级域名 + * @returns {string} - 顶级域名(如 'video.com', 'example.org'),若无法解析则返回空字符串 + */ +function getTopLevelDomain() { + try { + const hostname = window.location.hostname; // 获取完整域名,如 'sub.video.com' + const parts = hostname.split('.'); // 按点号分割域名 + // 返回最后两部分作为顶级域名(适用于大多数情况,如 'video.com') + return parts.length >= 2 ? `${parts[parts.length - 2]}.${parts[parts.length - 1]}` : ''; + } catch (error) { + console.error('获取顶级域名失败:', error.message); + return ''; + } +} + + function isMobile() { - return /Android|iPhone|iPad|iPod|Windows Phone/i.test(navigator.userAgent); + const ua = navigator.userAgent || navigator.vendor || window.opera; + + // 常见移动端关键词 + const mobileRegex = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i; + + // 微信/QQ/支付宝内置浏览器也算移动端 + const isMiniBrowser = /MicroMessenger|QQ\/|AlipayClient/i.test(ua); + + // 判断触控点(Touch device) + const isTouchDevice = ('maxTouchPoints' in navigator && navigator.maxTouchPoints > 0) || + ('ontouchstart' in window); + + return mobileRegex.test(ua) || isMiniBrowser || isTouchDevice; } // 懒加载