} // 我已知晓按钮 - 核心修改:移除刷新页面代码,仅关闭弹窗 $("#btnRefreshContinue").on('click', function(e){ e.preventDefault(); $('#userAgreementModal').modal('hide'); localStorage.setItem("lastPopupTime", Date.now().toString()); localStorage.removeItem("sevenDaysExpire"); }); // 今日不再提醒按钮 $("#btnSevenDays").on('click', function(e){ e.preventDefault(); $('#userAgreementModal').modal('hide'); const oneDayLater = Date.now() + SEVEN_DAYS; localStorage.setItem("sevenDaysExpire", oneDayLater.toString()); localStorage.setItem("lastPopupTime", Date.now().toString()); }); // 弹窗关闭按钮 $(".user-agreement-modal .close").on('click', function(e){ e.preventDefault(); $('#userAgreementModal').modal('hide'); localStorage.setItem("lastPopupTime", Date.now().toString()); }); }); // 原生JS实现:筛选特定颜色文本并添加渐变色动画 document.addEventListener('DOMContentLoaded', function() { // 1. 获取所有.xst类的元素,并筛选出颜色不是rgb(51, 51, 51)的元素 const xstElements = document.querySelectorAll('.xst'); const animatedTextElements = []; // 存储需要添加动画的元素 xstElements.forEach(function(element) { // 获取元素的计算样式(兼容不同浏览器) const computedStyle = window.getComputedStyle(element); const color = computedStyle.color; // 筛选条件:颜色不等于rgb(51, 51, 51) if (color !== 'rgb(51, 51, 51)') { element.classList.add('animated-text'); // 添加动画类 animatedTextElements.push(element); // 存入数组备用 console.log(color); // 打印筛选出的元素颜色 } }); // 2. 定义渐变颜色数组 const colors_hxq = ['#23ff26', '#0700ff', '#ff0080', '#c2c219']; let count_hxq = 0; // 3. 定时切换渐变色背景 setInterval(function() { animatedTextElements.forEach(function(element) { // 拼接渐变色背景样式(和原jQuery逻辑一致) const gradient = `linear-gradient(45deg, ${colors_hxq[count_hxq % 4]}, ${colors_hxq[(count_hxq + 1) % 4]}, ${colors_hxq[(count_hxq + 2) % 4]}, ${colors_hxq[(count_hxq + 3) % 4]} )`; // 设置背景图片(渐变) element.style.backgroundImage = gradient; // 可选:添加背景裁剪,让渐变只作用于文字(原代码可能遗漏,补充更完整) element.style.webkitBackgroundClip = 'text'; element.style.backgroundClip = 'text'; element.style.color = 'transparent'; // 文字透明显示渐变 }); count_hxq++; }, 300); });