// ==UserScript==
// @name 腾讯视频清爽脚本_new
// @namespace http://tampermonkey.net/
// @version 0.3
// @description 在腾讯视频页面生成一个设置按钮,可以设置修改进度判断。二是监测广告元素,并删除
// @author 果心豆腐酱
// @match https://v.qq.com/*
// @icon https://v.qq.com/favicon.ico
// @grant GM_addStyle
// ==/UserScript==
//全局变量配置
var 主题色;
var 深主题色;
var 浅主题色;
var VIP主题色;
var 备案字体颜色;
var 浅色字体;
var 亮色字体;
var 深色字体;
//var 主题 = "青色"
//初始化组件
(function () {
'use strict';
// 创建侧边栏开关按钮元素
const toggleButton = document.createElement('button');
toggleButton.className = 'toggle_button';
toggleButton.textContent = '<';
// 设置按钮样式
toggleButton.style.position = 'fixed';
toggleButton.style.top = '40%';
toggleButton.style.width = '15px';
toggleButton.style.height = '50px';
toggleButton.style.color = 'rgb(55, 99, 57)';
toggleButton.style.background = 'linear-gradient(to right, rgb(220, 240, 176), rgba(252, 247, 224, 0.5))';
toggleButton.style.cursor = 'pointer';
toggleButton.style.zIndex = '9999';
// 将按钮添加到页面的 body 元素中
document.body.appendChild(toggleButton);
// 创建设置按钮
var settingButton = document.createElement('div');
settingButton.className = 'main_button';
settingButton.style.position = 'fixed';
settingButton.style.top = '50%';
settingButton.style.width = '15px';
settingButton.style.height = '50px';
settingButton.innerHTML = '设置';
settingButton.style.color = '#376339';
settingButton.style.background = "linear-gradient(to right, #DCF0B0, rgba(252, 247, 224, 0.5))";
settingButton.style.cursor = 'pointer';
settingButton.style.zIndex = '9999';
settingButton.addEventListener('mousedown', function (e) {
dragMenu(settingButton, e);
});
document.body.appendChild(settingButton);
// setTimeout(function () {
// // 获取按钮元素透明
// toggleButton.style.opacity = "0.1";
// settingButton.style.opacity = "0.1";
// }, 10000); // 10秒后执行
// 创建设置界面
var settingPanel = document.createElement('div');
settingPanel.style.position = 'fixed';
settingPanel.style.top = '47%';
settingPanel.style.left = '20px';
settingPanel.style.padding = '10px';
settingPanel.style.color = '#376339';
settingPanel.style.background = "linear-gradient(to right, #DCF0B0, #FCF7E0)";
settingPanel.style.border = '1px solid #000';
settingPanel.style.zIndex = '9999';
settingPanel.style.display = 'none';
settingPanel.innerHTML = `
<input type="radio" class="percentage" name="progressType" value="percentage" checked style="cursor:pointer">
<label for="percentage">使用百分比</label>
<input type="number" id="percentageThreshold" value="85" style="width: 50px;">
<br>
<input type="radio" class="percentage" name="progressType" value="time" style="cursor:pointer">
<label for="time">使用分秒时间</label>
<input type="text" id="timeThreshold" placeholder="12:20" style="width: 50px;">
<br>
<input type="checkbox" id="removewatermark" style="cursor:pointer">
<label for="percentage">去除视频水印</label>
<br>
<input type="checkbox" id="closesidebar" style="cursor:pointer">
<label for="percentage">首次关闭侧边栏</label>
<br>
<input type="checkbox" id="advertisement" style="cursor:pointer">
<label for="percentage">屏蔽广告</label>
<br>
<input type="checkbox" id="htmlbackground" style="cursor:pointer">
<label for="percentage">替换背景</label>
<form action="/submit-form" method="post">
<select id="cars" name="cars">
<option value="月光色">月光色</option>
<option value="青色">青色</option>
<option value="神秘森林">神秘森林</option>
<option value="辣红色">辣红色</option>
<option value="芒果色">芒果色</option>
<option value="金黄色">金黄色</option>
<option value="金色">金色</option>
</select>
</form>
<br>
<button id="saveButton" class="button" style="font-weight: bold; color: #333333;cursor:pointer;">保存</button>
`;
// <br>
// <div style="width: 100%; height: 1px;background-color: #5c6e32; margin-bottom: 2px;"></div>
// <label for="percentage" style=" position: relative;top: 10px;">cookie:</label>
// <textarea class="cookie_textrea" placeholder="填写你需要加载到浏览器的cookie。" style="width: 110px;resize: none; height: 60px;"></textarea>
// <br>
// <button id="tiquButton" class="button" style="font-weight: bold; color: #333333;cursor:pointer;position: relative;left: 95px;">提取</button>
// <button id="jiazaiButton" class="button" style="font-weight: bold; color: #333333;cursor:pointer;position: relative;left: 100px;">加载</button>
document.body.appendChild(settingPanel);
settingPanel.addEventListener('mousedown', function (e) {
dragMenu(settingPanel, e);
});
// 定义一个变量用于保存计时器的 ID
var timerId;
// 给设置按钮绑定鼠标移入事件
settingButton.addEventListener('mouseenter', function () {
// 显示设置面板
settingPanel.style.display = 'block';
// 清除计时器
clearTimeout(timerId);
});
// 给设置面板绑定鼠标移入事件,避免鼠标移出设置按钮后立即隐藏设置面板
settingPanel.addEventListener('mouseenter', function () {
// 清除计时器
clearTimeout(timerId);
});
// 给设置按钮绑定鼠标移出事件
settingButton.addEventListener('mouseleave', function () {
// 开始计时,500 毫秒后隐藏设置面板
timerId = setTimeout(function () {
settingPanel.style.display = 'none';
}, 500);
});
// 给设置面板绑定鼠标移出事件,避免鼠标移入设置面板后立即隐藏设置面板
settingPanel.addEventListener('mouseleave', function () {
// 开始计时,500 毫秒后隐藏设置面板
timerId = setTimeout(function () {
settingPanel.style.display = 'none';
}, 500);
});
// 显示/隐藏设置界面
if (settingButton) {
settingButton.addEventListener('click', function () {
if (settingPanel.style.display === 'none') {
settingPanel.style.display = 'block';
console.log('开始设置');
} else {
settingPanel.style.display = 'none';
}
});
}
var tiquButton = document.querySelector('#tiquButton');
if (tiquButton) {
tiquButton.addEventListener("click", function () {
var cookieStr = document.querySelector('.cookie_textrea')
if (cookieStr) {
cookieStr.value = document.cookie
}
})
}
var jiazaiButton = document.querySelector('#jiazaiButton');
if (jiazaiButton) {
jiazaiButton.addEventListener("click", function () {
加载QQcookie();
})
}
function 加载QQcookie() {
var cookieDomain = ".qq.com"
// 设置cookie字符串
var cookieStr = document.querySelector('.cookie_textrea')
if (cookieStr) {
// 分割cookie字符串
if (cookieStr.value != "") {
var cookies = cookieStr.value.split(";");
if (cookies.length != 0) {
// 遍历每个cookie,并设置为对应的键值对
cookies.forEach(function (cookie) {
var keyValue = cookie.trim().split("=");
var key = keyValue[0];
var value = keyValue[1];
// 设置cookie
document.cookie = key + "=" + encodeURIComponent(value) + "; domain=" + cookieDomain + "; path=/;";
});
} else (showToast("请不包含有cookie信息。"))
} else (showToast("请填写cookie信息。"))
} else (showToast("编辑框元素丢失了。"))
}
//取进度百分比的编辑框元素
var percentageThresholdInput = document.getElementById('percentageThreshold');
// 读取缓存percentageThreshold的值
var savedPercentageThreshold = localStorage.getItem('percentageThreshold');
//如果缓存没有内容就使用默认的数值
if (savedPercentageThreshold) {
percentageThresholdInput.value = savedPercentageThreshold;
} else {
percentageThresholdInput.value = '85'; // 默认值
}
// 读取缓存的timeThreshold的值
var timeThresholdInput = document.getElementById('timeThreshold');
var savedTimeThreshold = localStorage.getItem('timeThreshold');
if (savedTimeThreshold) {
timeThresholdInput.value = savedTimeThreshold;
} else {
timeThresholdInput.placeholder = '12:20'; // 默认值
}
var percentageValue = parseInt(localStorage.getItem('percentage'));
if (isNaN(percentageValue) || percentageValue < 0) {
document.querySelectorAll(".percentage")[0].checked = true
} else {
document.querySelectorAll(".percentage")[percentageValue].checked = true
}
var removewatermarkchecked = localStorage.getItem('removewatermark');
if (removewatermarkchecked === "false") {
document.querySelector("#removewatermark").checked = false;
} else {
document.querySelector("#removewatermark").checked = true;
localStorage.setItem('removewatermark', true);
}
var closesidebarchecked = localStorage.getItem('closesidebar');
if (closesidebarchecked === "false") {
document.querySelector("#closesidebar").checked = false
} else {
document.querySelector("#closesidebar").checked = true
localStorage.setItem('closesidebar', true);
}
if (closesidebarchecked === "false") {
document.querySelector("#advertisement").checked = false
} else {
document.querySelector("#advertisement").checked = true
localStorage.setItem('advertisement', true);
}
var htmlbackground = localStorage.getItem('htmlbackground');
if (htmlbackground === "true") {
document.querySelector("#htmlbackground").checked = true;
var cars = localStorage.getItem('cars');
document.querySelector("#cars").selectedIndex = cars;
} else {
document.querySelector("#htmlbackground").checked = false;
localStorage.setItem('htmlbackground', false);
}
// 监听保存按钮的点击事件
var saveButton = document.getElementById('saveButton');
saveButton.addEventListener('click', function () {
// 保存percentageThreshold的值到localStorage
var percentageThresholdValue = percentageThresholdInput.value;
localStorage.setItem('percentageThreshold', percentageThresholdValue);
// 保存timeThreshold的值到localStorage
var timeThresholdValue = timeThresholdInput.value;
localStorage.setItem('timeThreshold', timeThresholdValue);
//保存去水印设置
localStorage.setItem('removewatermark', document.querySelector("#removewatermark")?.checked);
//保存屏蔽广告设置
localStorage.setItem('advertisement', document.querySelector("#advertisement")?.checked);
//保存侧边栏设置
localStorage.setItem('closesidebar', document.querySelector("#closesidebar")?.checked);
//主题替换功能
localStorage.setItem('htmlbackground', document.querySelector("#htmlbackground")?.checked);
//主题配色选择
localStorage.setItem('cars', document.querySelector("#cars")?.selectedIndex);
// // 判断是否所有的percentage都被选中
var percentageInputs = document.querySelectorAll(".percentage");
for (var i = 0; i < percentageInputs.length; i++) {
if (percentageInputs[i].checked) {
localStorage.setItem('percentage', i);
}
}
});
//需要直接执行的代码
函数存放("页面样式修改");
函数存放("去除游戏栏目");
函数存放("加载时可删除广告");
函数存放("轮播栏广告小图");
侧边栏调整();
监测全屏状态();
监测激活状态();
监测页面元素();
})();
// 检测视频进度达到阈值时执行点击下一个视频
function checkAndClickNext() {
var jindu = document.querySelector(".txp_time_current");
var changdu = document.querySelector(".txp_time_duration");
// 解析进度和长度的分钟和秒钟
if (jindu && changdu) {
var progressParts = jindu.textContent.split(":");
var durationParts = changdu.textContent.split(":");
var progressMinutes = parseInt(progressParts[0]);
var progressSeconds = parseInt(progressParts[1]);
var durationMinutes = parseInt(durationParts[0]);
var durationSeconds = parseInt(durationParts[1]);
// 将分钟和秒钟转换为总秒数
var progressTotalSeconds = progressMinutes * 60 + progressSeconds;
var durationTotalSeconds = durationMinutes * 60 + durationSeconds;
// 获取进度类型选择
var progressType = parseInt(localStorage.getItem('percentage'));
var nextButton = document.querySelector('.txp_btn.txp_btn_next_u');
// 根据进度类型执行相应的进度判断
if (progressType === 0) {
// 获取百分比阈值
var percentageThreshold = localStorage.getItem('percentageThreshold');
// 计算百分比
var percent = (progressTotalSeconds / durationTotalSeconds) * 100;
//txp_tooltip txp_none
// 如果进度达到阈值,则执行点击下一个视频的操作
if (percent >= percentageThreshold) {
if (nextButton) {
nextButton.click();
}
}
} else if (progressType === 1) {
// 获取分秒时间阈值
var timeThresholdParts = localStorage.getItem('timeThreshold');
var timeParts = timeThresholdParts.split(":");
var timeThresholdSeconds = parseInt(timeParts[0]) * 60 + parseInt(timeParts[1]);
// 如果进度达到阈值时间,则执行点击下一个视频的操作
if (progressTotalSeconds >= timeThresholdSeconds) {
if (nextButton) {
nextButton.click();
}
}
}
}
//clearInterval(intervalId);
}
//监测页面元素
function 监测页面元素() {
var oldURL = document.URL;
// 创建 Mutation Observer 实例
var observer = new MutationObserver(function (mutationsList) {
// console.log("蜀黍");
for (var mutation of mutationsList) {
// 遍历每个被添加的节点
for (var addedNode of mutation.addedNodes) {
// 判断是否为元素节点
if (addedNode.nodeType === Node.ELEMENT_NODE) {
监测去除广告(addedNode);
if (oldURL !== document.URL) {
console.log(oldURL, document.URL)
oldURL = document.URL;
}
}
}
}
});
// 监测整个文档树的变动
observer.observe(document, { childList: true, subtree: true });
}
var cartoonlistload;
function 监测去除广告() {
if (localStorage.getItem('advertisement') === "true") {
//暂停视频的弹窗广告
var video_material = document.querySelector('.txp_zt_video_material');
if (video_material) {
video_material.parentNode.removeChild(video_material);
} else {
// 暂停视频的弹窗广告
var pauseBanner = document.querySelector('.txp_zt_content.txp_ad_active_normal');
if (pauseBanner) {
pauseBanner.remove();
} else {
// 推荐视频里的广告
var pauseVideos = document.querySelectorAll(".video-card-module > div.card-wrap");
if (pauseVideos.length > 0) {
pauseVideos.forEach(function (video) {
video.remove();
});
} else {
// 推荐视频里的广告关闭按钮
var close_btn = document.querySelectorAll(".close-btn SPAN");
if (close_btn.length > 0) {
close_btn.forEach(function (button) {
if (button.textContent === "广告") {
button.parentNode.parentNode.remove();
}
});
} else {
// 暂停视频的弹窗广告
var pauselayer = document.querySelector('.creative-player-pause-layer');
if (pauselayer) {
pauselayer.remove();
} else {
var 侧边栏广告 = document.querySelector(".game_switch_page_next_wrapper.game-switch-ad")
if (侧边栏广告) {
侧边栏广告.remove();
} else {
var 挂件 = document.querySelector(".game_close_btn.svelte-a683jp")
if (挂件) {
挂件.click();
console.log("移除了挂件广告。")
} else {
var cartoonlist = document.querySelector(".card.vertical")
if (cartoonlist) {
}else {
var pauselayer = document.querySelector('[data-role="creative-player-full-screen-pause-layer"]')
if (pauselayer) {
pauselayer.remove()
}
}
}
}
}
}
}
}
}
}
var interactiframe = document.querySelector('.interact_entry.player__interact-iframe');
if (interactiframe) {
interactiframe.parentNode.removeChild(interactiframe);
console.log("未知广告", "interactiframe");
}
var txpzt = document.querySelector('.txp_zt');
if (txpzt) {
txpzt.remove();
console.log("未知广告", "txpzt");
}
}
//监测全屏状态
function 监测全屏状态() {
var targetNode = document.querySelector("body"); // 要监测的目标元素
// console.log("蜀黍", targetNode);
var observer = new MutationObserver(function (mutationsList) {
for (var mutation of mutationsList) {
if (mutation.type === 'attributes') {
// 如果发现目标元素的属性变化
if (mutation.attributeName === 'class') {
console.log('类名发生了变化:', targetNode.className);
const main_button = document.querySelector(".main_button");
const toggle_button = document.querySelector(".toggle_button");
if (targetNode.className === "tvplayer-fake-fullscreeen plugin_ctrl_fake_fullscreen") {
main_button.style.opacity = "0";
toggle_button.style.opacity = "0";
} else {
main_button.style.opacity = "1";
toggle_button.style.opacity = "1";
}
}
}
}
});
var config = { attributes: true, attributeFilter: ['class', 'dt-params'] };
observer.observe(targetNode, config);
}
//手动调整侧边剧集栏,初次打开网页,会自动收起侧边剧集栏
function 侧边栏调整() {
// 封装函数来处理侧边栏的显示和隐藏
function toggleSidebar(toggleButton) {
var 展开侧边栏;
//新版侧边栏,没有自带按钮
const 自带收缩按钮 = document.querySelector('.player__wide-btn');
const sidebar = document.querySelector('.page-content__right');
if (自带收缩按钮) {
dinglan = document.querySelector('.site_head.dd.site_head_channel');
var 播放器 = document.querySelector('#player-container');
var episode = document.querySelectorAll(".container-episode").length
//判断自带的关闭侧边栏按钮
var wideBtn = 自带收缩按钮;
if (episode) {
if (wideBtn) {
wideBtn.click();
展开侧边栏 = false;
}
} else {
if (wideBtn) {
wideBtn.click();
展开侧边栏 = true;
}
}
return;
} else {
var 播放器 = document.querySelector('#player-container');
if (!播放器) {
return;
}
if (sidebar.style.display === 'none') {
// 恢复侧边栏
sidebar.style.display = '';
展开侧边栏 = true;
} else {
// 关闭侧边栏
sidebar.style.display = 'none';
展开侧边栏 = false;
}
}
//收缩展开侧边栏,并重新调整播放器大小
if (展开侧边栏 === true) {
toggleButton.textContent = '<';
var 播放器框架 = document.querySelector(".container-main__left")
// 从元素中获取原始宽度和高度
const originalWidth = 播放器.style.width;
const originalHeight = 播放器.style.height;
//新的高度site_head dd site_head_channel top-nav-wrap head_inner
var dinglan = document.querySelector('.top-nav-wrap.head_inner');
var newVideoHeight = window.innerHeight - dinglan.offsetHeight - 30;
// 计算新的宽度
//const newWidth = (parseInt(originalWidth) / parseInt(originalHeight)) * newVideoHeight;
// 设置元素 player-container 的宽度
//播放器.style.width = `${newWidth}px`;
播放器.style.height = `${newVideoHeight}px`;
console.log("新的播放器宽度", newVideoHeight)
// 将修改后的宽度和高度保存在浏览器缓存中
//localStorage.setItem('modifiedWidth', `${newWidth}px`);
localStorage.setItem('modifiedHeight', `${newVideoHeight}px`);
} else {
toggleButton.textContent = '>';
// 从缓存中获取修改后的宽度和高度
//const cachedWidth = localStorage.getItem('modifiedWidth');
const cachedHeight = localStorage.getItem('modifiedHeight');
// 设置元素 player-container 的宽度和高度
//播放器.style.width = cachedWidth;
播放器.style.height = cachedHeight;
}
}
//侧边栏按钮点击
const toggleButton = document.querySelector('.toggle_button')
toggleButton.addEventListener('click', function () {
toggleSidebar(toggleButton);
});
//绑定按钮元素移动
toggleButton.addEventListener('mousedown', function (e) {
dragMenu(toggleButton, e);
});
if (localStorage.getItem('closesidebar') === "true") {
toggleSidebar(toggleButton);
}
}
//元素移动函数
function dragMenu(menuObj, e) {
e = e ? e : window.event;
// || e.target.tagName === 'BUTTON' 判断是否为按钮元素
if (e.target.tagName === 'TEXTAREA' || e.target.tagName === 'INPUT' || e.target.tagName === 'SELECT') {
return;
}
let dragData = {
startX: e.clientX,
startY: e.clientY,
menuLeft: menuObj.offsetLeft,
menuTop: menuObj.offsetTop
};
document.onmousemove = function (e) { try { dragMenu(menuObj, e); } catch (err) { } };
document.onmouseup = function (e) { try { stopDrag(menuObj); } catch (err) { } };
doane(e);
function stopDrag(menuObj) {
document.onmousemove = null;
document.onmouseup = null;
}
function doane(e) {
if (e.stopPropagation) {
e.stopPropagation();
} else {
e.cancelBubble = true;
}
if (e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false;
}
}
document.onmousemove = function (e) {
let mouseX = e.clientX;
let mouseY = e.clientY;
let menuLeft = dragData.menuLeft + mouseX - dragData.startX;
let menuTop = dragData.menuTop + mouseY - dragData.startY;
menuObj.style.left = menuLeft + 'px';
menuObj.style.top = menuTop + 'px';
doane(e);
}
}
//提示弹幕
var toastContainers = [];
function showToast(message, isError) {
// 创建新的提示框
const toastContainer = document.createElement('div');
toastContainer.style.position = "fixed";
toastContainer.style.top = "10%";
toastContainer.style.left = "40%";
toastContainer.style.fontSize = "20px";
toastContainer.style.position = "fixed";
toastContainer.style.zIndex = "999";
const toast = document.createElement('div');
toast.textContent = message;
toastContainer.appendChild(toast);
// 根据是否为错误提示框添加不同的样式
if (isError) {
toastContainer.classList.add('toast-container', 'success');
toastContainer.style.color = '#3fc91d';
} else {
toastContainer.classList.add('toast-container', 'error');
toastContainer.style.color = '#CC5500';
}
// 将提示框添加到页面中
document.body.appendChild(toastContainer);
toastContainers.push(toastContainer);
// 获取页面高度的 20vh
const windowHeight = window.innerHeight;
const height = windowHeight * 0.15;
// 设置当前提示框的位置
toastContainer.style.top = `${height}px`;
// 调整其他提示框的位置
for (let i = 0; i < toastContainers.length - 1; i++) {
const container = toastContainers[i];
container.style.top = `${height - (toastContainers.length - i - 1) * 30}px`;
}
// 在 3 秒后隐藏提示框
setTimeout(() => {
toastContainer.classList.add('hide');
// 过渡动画结束后移除提示框
setTimeout(() => {
const index = toastContainers.indexOf(toastContainer);
if (index !== -1) {
toastContainers.splice(index, 1);
}
toastContainer.parentNode.removeChild(toastContainer);
}, 300);
}, 3000);
}
//监测激活状态
function 监测激活状态() {
document.addEventListener("visibilitychange", function () {
if (document.visibilityState === "visible") {
// 浏览器窗口处于激活状态
console.log("浏览器已激活");
document.querySelector("body").click();
} else {
// 浏览器窗口处于非激活状态
console.log("浏览器已非激活");
}
});
window.addEventListener('load', function () {
// 页面加载完成后执行的操作
console.log('页面加载完成');
checkAndClickNext();
// 定时检测视频进度并执行操作
setInterval(checkAndClickNext, 1000);
if (localStorage.getItem('advertisement') === "true") {
函数存放("去除游戏栏目");
函数存放("轮播栏广告播放");
}
});
}
function 函数存放(函数) {
// txp_videos_container
if (函数 = "轮播栏广告小图") {
if (localStorage.getItem('removewatermark') === "true") {
var elements = document.querySelectorAll(".focus-item");
elements.forEach(function (element) {
if (element.tagName === "A") {
// console.log("蜀黍", element.href);
if (element.href === "javascript:;") {
var 关闭广告 = document.querySelector(".close-creative");
if (关闭广告) {
if (关闭广告.title === "关闭广告") {
关闭广告.click();
console.log("移除轮播栏的广告成功")
return;
} else {
console.log("删除轮播栏的广告成功")
element.remove();
关闭广告 = document.querySelector(".close-creative");
if (关闭广告.title === "关闭广告") {
关闭广告.click();
console.log("移除轮播栏的广告成功2")
return;
}
}
}
}
}
});
}
}
if (函数 = "轮播栏广告播放") {
if (localStorage.getItem('removewatermark') === "true") {
var 轮播广告栏 = document.querySelectorAll('.focus-wrap.large-focus')
if (轮播广告栏) {
var targetNode = document.querySelector(".close-creative");
if (targetNode) {
var adobserver = new MutationObserver(function (mutationsList, observer) {
for (var mutation of mutationsList) {
if (mutation.type === 'attributes' && mutation.attributeName === 'title') {
if (mutation.target.title === "关闭广告") {
mutation.target.click();
}
}
}
});
var config = { attributes: true };
adobserver.observe(targetNode, config);
}
}
}
}
if (函数 = "去除视频水印") {
if (localStorage.getItem('removewatermark') === "true") {
if (document.querySelector("#player > txpdiv")) {
document.querySelector("#player > txpdiv").remove();
console.log("视频水印已去除1")
}
var watermarkElement = document.querySelector('.txp-watermark');
if (watermarkElement) {
// 移除水印元素
watermarkElement.parentNode.removeChild(watermarkElement);
console.log("视频水印已去除2")
}
}
}
if (函数 = "页面样式修改") {
if (localStorage.getItem('htmlbackground') === "true") {
var 主题选择 = document.querySelector('#cars');
if (主题选择) {
主题色选择(主题选择.value);
} else {
主题 = "月光色";
主题色选择(主题);
}
var css = `
body {
background: ${主题色} url(//vm.gtimg.cn/z/static/vplay/child-bg.png) !important;
--background: ${主题色} !important;
}
/*视频列表*/
.list-page-wrap{
background: ${主题色} !important;
}
/*视频列表-返回*/
.list-page-wrap .kinds-list-wrap{
background: ${主题色} !important;
}
._footer-wrap_yjuq2_1 {
background: ${主题色} !important;
}
/*顶栏设置*/
.top-nav-wrap.top-nav-wrap-black {
/*background: linear-gradient(to bottom,${深主题色} ,${主题色});*/
background: ${主题色};
}
// .top-nav-wrap[data-v-063bf321]{
// background: ${主题色} ;
// }
.left-nav-wrap .logo-wrap{
/*background: linear-gradient(to bottom,${深主题色} ,${主题色});*/
background-image: linear-gradient(-90deg,rgba(20,20,20,0) 1%,rgba(20,20,20,0) 99%);
}
/*左侧菜单列表*/
.left-nav-wrap.let-nav-wrap-black{
background: ${主题色} !important;
}
// /*左侧菜单列表*/
// .left-nav-wrap .nav-wrap{
// background: ${主题色} ;
// }
.sub-nav-group{
background-color:${深主题色}d9 !important;
}
.video-card-wrap{
background: linear-gradient(to bottom, rgb(43, 43, 43), ${主题色}) !important;
}
/*视频图标变大*/
.video-card-wrap .video-card {
position: relative;
}
.video-card-wrap .video-card::before {
content: "";
border-radius: 16px;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.3); /* 设置遮罩层的颜色和透明度 */
z-index: 1; /* 确保遮罩层位于元素之上 */
opacity: 0; /* 初始时遮罩层透明 */
transition: opacity 0.3s ease; /* 添加过渡效果 */
box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3); /* 添加内阴影效果 */
}
.video-card-wrap .video-card:hover::before {
opacity: 1; /* 鼠标悬停时遮罩层完全显示 */
}
.content.fixed{
background: ${主题色}d9 !important;
}
/*客户端下载*/
.pop_info_content.pop_client_wrap{
background: ${主题色}d9 !important;
}
/*播放页面*/
/*VIP提示*/
.vip-button__main-title--v2 {
color: ${VIP主题色} !important;
}
.playlist-side-fuild__container{
background: ${主题色}d9 !important;
}
.general-banner-adapt.filter-labels-wrap{
background: ${主题色}d9 !important;
}
.focus-wrap.large-focus {
box-shadow: 0px 0px 20px 21px rgb(3 21 26) !important;
}
/*分享列表*/
.playlist-intro__btns{
background: ${主题色} !important;
}
/*全集列表*/
.playlist-overlay{
background: ${主题色} !important;
}
/*历史记录*/
.quick_pop_tabs{
background: ${浅主题色} !important;
}
.mod_quick_videolist.mod_quick_videolist_history{
background: ${主题色} !important;
}
.quick_pop_footer{
background: ${浅主题色} !important;
}
/*旧播放界面背景*/
.container-main__wrapper[data-v-e54bf460]:before {
background: ${浅主题色} !important;
}
/*提示框*/
.toast-wrap{
background: ${深主题色}d9 !important;
}
/*反馈按钮*/
.x_fixed_tool{
background: ${主题色}d9 !important;
}
/*备案字体颜色*/
._footer-wrap_yjuq2_1 * {
color: ${备案字体颜色} !important;
}
/*旧播放器页面*/
/*评论背景*/
.container-bottom{
background: ${主题色} !important;
}
/*顶栏*/
.new_vs_header{
background: ${深主题色}d9 !important;
}
/*顶栏字体*/
.site_channel .channel_nav {
color: ${亮色字体} ;
}
/*顶栏右边图标*/
.mod_quick .quick_link{
color: ${亮色字体} ;
}
.site_channel .channel_more{
color: ${亮色字体} !important;
}
.site_head.dd.site_head_simple {
background: ${深主题色}d9 !important;
}
/*备案栏*/
._footer-wrap_momhz_1{
background: ${主题色} !important;
}
._footer-wrap_momhz_1 * {
color: ${备案字体颜色} !important;
}
/*长文本按钮*/
.at-feed-stream-tab {
color: ${浅色字体} !important;
}
/*评论颜色*/
.at-feed__date{
color: ${浅色字体} !important;
}
/*未选择颜色*/
.at-feed-stream-tab__nav-item{
color: ${浅色字体} !important;
}
/*登陆颜色*/
.at-feed-stream-post__login{
color: ${浅色字体} !important;
}
.t-feed__date{
color: ${备案字体颜色} !important;
}
/*无评论颜色*/
.at-feed-stream-tab .at-net-error__title{
color: ${浅色字体} !important;
}
/*长文本编写框*/
.mod-page__editor{
background: ${浅主题色} !important;
}
/*正文*/
.ql-container.ql-snow *{
background: ${浅主题色} !important;
}
/**/
.mod-page__action{
background: ${浅主题色}00 !important;
}
.mod-card{
background: ${浅主题色}00 !important;
}
.mod-button.disabled {
background: ${深主题色} !important;
}
/*备案栏配置*/
.contentinfo_title{
color: ${深色字体} !important;
}
.mod_footer_contentinfo .foot_link{
color: ${浅色字体} !important;
}
.mod_footer_contentinfo .dl_list .item{
color: ${浅色字体} !important;
}
.mod_footer *{
color: ${浅色字体} !important;
}
.cookie_textrea {
width: 0px;
/* 设置滚动条宽度 */
}
.cookie_textrea::-webkit-scrollbar {
width: 0px;
/* 设置滚动条宽度 */
}
.button:hover::after {
border-radius: 5px;
background-color: rgba(255, 255, 255, 0.3) !important;
}
.button:hover {
border-radius: 5px;
background-color: #70B9E8;
}
.button:active {
border-radius: 5px;
background: #2db628;
/* position: fixed; */
/* margin-bottom: 9px; */
text-shadow: none;
box-shadow: 10px 10px 10px rgba(0, 0, 0, .3) inset;
}
/*视频图标变大*/
.card.vertical {
transition: transform 0.3s ease; /* 添加过渡效果 */
}
.card.vertical:hover {
transform: scale(1.2); /* 鼠标悬停时放大1.2倍 */
}
`;
var style = document.createElement('style');
style.type = 'text/css';
style.textContent = css;
document.head.appendChild(style);
}
}
if (函数 = "加载时可删除广告") {
// 顶栏的游戏广告关闭按钮
if (localStorage.getItem('removewatermark') === "true") {
var quick_games = document.querySelector('.quick_item.quick_games');
if (quick_games) {
quick_games.remove();
}
}
}
if (函数 = "去除游戏栏目") {
if (localStorage.getItem('removewatermark') === "true") {
removeElements();
function removeElements() {
var pauseVideos = document.querySelectorAll("._nav-item_ugz17_31");
if (pauseVideos.length > 0) {
pauseVideos.forEach(function (video) {
var span = video.querySelector('span').textContent.trim();
console.log(span);
if (span === "游戏" || span === "传奇游戏库" || span === "棋牌游戏库" || span === "游戏中心") {
video.remove();
// console.log(2, span);
}
});
}
}
var elementsWithDtCmd = document.querySelectorAll('[dt-cmd]');
// 遍历所有匹配的元素
elementsWithDtCmd.forEach(function (element) {
// 在这里对每个元素执行您的操作
var text = element.textContent.trim();
if (text === "游戏" || text === "传奇游戏库" || text === "棋牌游戏库" || text === "游戏中心") {
element.parentNode.remove();
// console.log(element);
}
});
// 顶栏的全部视频里的
var sub_nav_item = document.querySelectorAll(".sub-nav-item");
// 遍历所有匹配的元素
sub_nav_item.forEach(function (element) {
// 在这里对每个元素执行您的操作
var text = element.textContent.trim();
if (text === "游戏" || text === "传奇游戏库" || text === "棋牌游戏库" || text === "游戏中心") {
element.remove();
// console.log(element);
}
});
//顶栏上的
var nav_all_text = document.querySelectorAll(".nav-all-text");
// 遍历所有匹配的元素
nav_all_text.forEach(function (element) {
// 在这里对每个元素执行您的操作
var text = element.textContent.trim();
if (text === "游戏" || text === "传奇游戏库" || text === "棋牌游戏库" || text === "游戏中心") {
element.textContent = "体育"
console.log(element);
}
});
}
}
if (函数 = "轮播栏广告播放") {
}
if (函数 = "轮播栏广告播放") {
}
if (函数 = "轮播栏广告播放") {
}
}
function 主题色选择(主题) {
if (主题 === "青色") {
主题色 = "#083e4f";
深主题色 = "#052935";
浅主题色 = "#104353";
VIP主题色 = "#ffb300";
备案字体颜色 = '#5c96a9';
浅色字体 = '#5a8b9b';
亮色字体="#006f93";
深色字体="#002835";
} else {
if (主题 === "金色") {
主题色 = "#9d5901";
深主题色 = "#673b01";
浅主题色 = "#673b01";
VIP主题色 = "#ffb300";
备案字体颜色 = '#5c96a9';
浅色字体 = '#5a8b9b';
亮色字体="#22e56e";
深色字体="#00210d";
} else {
if (主题 === "金黄色") {
主题色 = "#ffa500";
深主题色 = "#e59503";
浅主题色 = "#e59503";
VIP主题色 = "#ffb300";
备案字体颜色 = '#5c96a9';
浅色字体 = '#5a8b9b';
亮色字体="#22e56e";
深色字体="#00210d";
} else {
if (主题 === "芒果色") {
主题色 = "#F5CBA3";
深主题色 = "#EB8F3B";
浅主题色 = "#F8D8BA";
VIP主题色 = "#ffb300";
备案字体颜色 = '#5c96a9';
浅色字体 = '#5a8b9b';
亮色字体="#22e56e";
深色字体="#00210d";
} else {
if (主题 === "神秘森林") {
主题色 = "#0F612F";
深主题色 = "#0A3E1E";
浅主题色 = "#5F9675";
VIP主题色 = "#ffb300";
备案字体颜色 = "#8bc1a0";
浅色字体 = '#5a8b9b';
亮色字体="#1ed163";
深色字体="#00210d";
}else {
if (主题 === "辣红色") {
主题色 = "#A91721";
深主题色 = "#6F0F15";
浅主题色 = "#B17D81";
VIP主题色 = "#ffb300";
备案字体颜色 = "#8bc1a0";
浅色字体 = '#5a8b9b';
亮色字体="#1ed163";
深色字体="#00210d";
}else {
if (主题 === "月光色") {
主题色 = "#0C4C7D";
深主题色 = "#072B47";
浅主题色 = "#98B3C8";
VIP主题色 = "#ffb300";
备案字体颜色 = "#769dbb";
浅色字体 = '#909ea9';
亮色字体="#1ed163";
深色字体="#00210d";
}
}
}
}
}
}
}
}