Greasy Fork is available in English.
删除黑名单用户的视频评论、收藏夹备注、显示评分投票、标题封面完整显示、等级颜色、时间跳转、禁用动态头像
当前为
// ==UserScript==
// @name 爱上ASMR - Plus
// @namespace https://www.asasmr.top/
// @version 4.2
// @description 删除黑名单用户的视频评论、收藏夹备注、显示评分投票、标题封面完整显示、等级颜色、时间跳转、禁用动态头像
// @match http*://*.asasmr3.com/*
// @match http*://*.asasmr2.com/*
// @match http*://*.asasmr1.com/*
// @match http*://*.aisasmr.com/*
// @match http*://*.aisasmr.net/*
// @license MIT
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
(function() {
'use strict';
// 初始化黑名单列表
let blacklist = GM_getValue('blacklist', []);
let notes = GM_getValue('notes', {});
let isOn = GM_getValue('dttxbtn', false);
if (window.location.href.match(/^https:\/\/.*\/author\//) && window.location.href.match(/\?tab=collect.*/)) {
// 添加备注区域
const archiveContainers = document.querySelectorAll('#author-page .archive');
archiveContainers.forEach(container => {
const articleLink = container.querySelector('article > a');
const noteid = articleLink.href.match(/\/(video|sound)\/([\w-]+\.html)/)[0];// 提取ID
const notesArea = document.createElement('textarea');
notesArea.classList.add('hmd-notes-area');
notesArea.placeholder = '添加备注';
notesArea.value = getNotes(noteid) || '';
notesArea.addEventListener('input', () => {
setNotes(noteid, notesArea.value);
});
const saveNotesButton = document.createElement('button');
saveNotesButton.textContent = '保存备注';
saveNotesButton.classList.add('hmd-save-notes-button');
saveNotesButton.addEventListener('click', () => {
setNotes(noteid, notesArea.value);
alert('备注已保存!');
});
container.appendChild(notesArea);
container.appendChild(saveNotesButton);
});
}
function getNotes(id) {
if (!notes[id]) {
notes[id] = [];
}
return notes[id].join('\n');
}
function setNotes(id, value) {
notes[id] = value.split('\n');
GM_setValue('notes', notes);
}
// 创建<style>元素来保存CSS规则
const styleElement = document.createElement('style');
// 将<style>元素添加到文档的<head>部分
document.head.appendChild(styleElement);
// 定义CSS规则
const cssRules = `
/* 黑名单 */
.hmd-fbq {cursor: pointer;}
.hmd-blacklist {
max-width: 450px;
box-shadow: 2px 0px 8px 0 rgb(0 0 0 / 20%);;overflow: auto;display: none;width: 100%;height: 100%;z-index: 110;position: fixed;background: #eeeeee;padding: 10px !important;}
.hmd-blacklist-item > a {padding: 0px 5px;}
.hmd-blacklist-item:first-child {margin-top: 50px;}
.hmd-blacklist-item {display: flex;height: 45px;align-items: center;justify-content: space-between;}
.hmd-del {background: #fff;border: solid #aaa 1px;border-radius: 4px;padding: 5px 8px;font-size: 16px;}
.hmd-add-to-blacklist {font-size: 10px !important;padding: 6px 8px !important;border-radius: 4px !important;float: right !important;margin-left: 5px !important;}
.hmdclosebutton {
max-width: 450px;
z-index: 99999;color: #666;font-size: 30px;position: fixed;padding: 8px 20px;display: none;width: 100%;background-color: #ffffff;justify-content: flex-end;cursor: pointer;}
.hmd-blacklist-item > span {text-overflow: ellipsis;white-space: nowrap;overflow: hidden;font-size: 16px;}
.hmd-blacklist-item > button {white-space: nowrap}
/* 二次确认 */
.hmd-popup {position: fixed;inset: 0;background-color: rgba(0, 0, 0, 0.5);display: none;justify-content: center;align-items: center;z-index: 9999;}
.hmd-popup-content {background-color: #fff;padding: 20px;border-radius: 5px;text-align: center;}
.hmd-popup h3 {margin-top: 0;}
.hmd-popup p {margin-bottom: 20px;margin-top: 8px;}
.hmd-confirm-button,.hmd-cancel-button {padding: 8px 16px;border-radius: 4px;cursor: pointer;border: solid 1px #555;}
.hmd-confirm-button {background-color: #007bff;color: #fff;margin-right: 10px;}
.hmd-cancel-button {background-color: #ccc;}
/* 备注 */
.hmd-save-notes-button {float: right;margin-top: 20px;}
.hmd-notes-area {width: 100%;padding: 8px;max-width: 75%;height: 60px;border: 1px solid rgb(204, 204, 204);font-size: 14px;color: rgb(51, 51, 51);}
.archive-excerpt > p {height: 48px;}
/* 音视频 */
.daoyan.blcss,#breadcrumbs {display: none !important;}
#section > li:nth-child(2) {display: none !important;}
#single > div.content > div.sheader > div.data > div.sgeneros {display: none !important;}
#aplload {background: #666;border: solid 2px #444;border-radius: 22px;color: #fff;padding: 2px 22px;font-weight: bold;}
.testBtn-a {background: #666;}
.timeauto {padding: 20px 10px;margin-bottom: 10px;}
.starstruck-wrap {display: block;}
#single > .content > .sheader > .data {margin: 0;width: auto;}
#single > .content > .sheader > .poster {width: auto;padding-bottom: 8px;background: 0;}
#single > .content > .sheader > .poster > img {max-width: 100%;width: auto;}
#single > .content > .sheader {display: flex;flex-direction: column;}
#info > .wp-content > a {padding-right: 8px;}
/* 用户 */
.user-dashboard-dropdown,.user-dashboard-dropdown.show {transition: all 0.2s ease-out;box-shadow: -2px 4px 12px 0 rgb(0 0 0 / 20%);;}
.user-dashboard-dropdown ul {display: flex;flex-direction: column;align-items: center;justify-content: space-between;}
.user-dashboard-dropdown ul li:first-child {height: 60px;}
.user-dashboard-dropdown ul li:last-child {box-shadow: none;}
.user-dashboard-dropdown ul li {width: 100%;height: 50px;display: flex;align-items: center;justify-content: center;position: relative;align-self: stretch;}
.user-dashboard-dropdown a.top-my-home {background: 0;}
.user-dashboard-dropdown a {border: 0 !important;align-items: center;display: flex;justify-content: center;}
.user-dashboard-dropdown a i.asmr {position: absolute;left: 20px;}
.user-dashboard-dropdown p span.top-user-link-des {display: none !important;}
.iconk-tongzhi:before {zoom: 1.3;}
.iconk-tongzhi {left: 15px !important;}
.user-dashboard-dropdown > ul> li:nth-last-child(3) > a > i:before {content: "\u{e61f}";}
/* 分割线 */
.separator {height: 1px;align-self: stretch;margin: 5px 15px;background: rgba(0, 0, 0, 0.1);}
/* 等级颜色 */
.level-0,.level-1 {background: #C0C0C0;}
.level-2 {background: #8BD29B;}
.level-3 {background: #7BCDEF;}
.level-4 {background: #FEBB8B;}
.level-5 {background: #EE672A;}
.level-6 {background: #F04C49;}
.level-7 {background: #821CF9;}
.level-8 {background: #dddddd;color: #000;}
.level-admin {background: #FF1111;}
.level {opacity: .8 !important;}
/* 左侧栏 */
.dttx-switch {display: inline-flex;align-items: center;}
.dttx-switch span {font-size: 15px;color: #757A7D;margin: 0 8px;}
.dttxbtn .btntext {display: flex;align-items: center;padding: 8px 0;position: relative;transition: color linear 0.2s;}
.dttx-switch.dttxk i:before { left: 8px;}
.dttx-switch i {display: inline-block;position: relative;width: 24px;height: 12px;border-radius: 32px;background-color: rgba(120,130,140,0.2);line-height: 1;cursor: pointer;flex-shrink: 0;}
.dttx-switch i:before {
content: "";
display: block;
opacity: 1;
width: 16px;
height: 16px;
margin-top: -2px;
background-color: #fff;
box-shadow: 0px 2px 5px 0 rgba(0, 0, 0, 0.26);
position: absolute;
border-radius: 16px;
transition: all 0.2s;
left: 0;
}
.cban {text-align: center;position: fixed;top: 45%;left: 0;transform: translateY(-50%);font-family: asmr;z-index: 99999;}
.cban i:before {
content: "\u{e678}";
cursor: pointer;
display: flex;
width: 40px;
height: 40px;
background-color: #fff;
box-shadow: 0px 2px 6px 2px rgba(0, 0, 0, 0.26);
position: absolute;
border-radius: 20px;
transition: all 0.2s;
flex-direction: column;
justify-content: center;
transform: translateX(-120%);
}
.cban i {width: 60px;height: 60px;position: fixed;top: 45%;z-index: 1002;}
.cban i:hover::before {transform: translateX(0%);transition: transform 0.3s ease-out, opacity 0.3s ease-out;}
.mobile-nav.active {box-shadow: 2px 0px 12px 0px rgb(0 0 0 / 30%);}
/* 顶栏 */
.responsive .form-control:focus {border-color: #66afe9;box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);}
.responsive .form-control {border-radius: 20px 0 0 20px;border-right: 0 !important;border: 1px solid #ccc;padding: 6px 12px;width: 40vw;}
.responsive > #advc-menu > form > button {border-radius: 0 20px 20px 0;border: 1px solid #ccc;border-left: 1px solid #ddd;padding: 8px 12px 8px 8px;background-color: #fff;}
.responsive .search a.search-resp:before {content: "\ue606" !important;font-family: 'asmr' !important;}
.responsive .search {padding: 14px 13px 11px 13px;}
#form-search-resp {display:none !important;}
.responsive .logo {display:none !important;}
.responsive {box-shadow: 0px 2px 16px 0 rgb(0 0 0 / 15%);}
/* 底栏 */
.touchy-search-button.touchy-toggle-search {display: none !important;}
.touchy-by-bonfire-wrapper.mobile-show.touchy-menu-active {display: none !important;}
/* 深色模式 */
.dark .single_menu.sidblock {background: #232627;}
.dark .sidemenu h1 a {color:#fff;}
.dark .sidemenu .td-link-element-after .td-element-after,.dark .sidemenu .td-link-element-after {color:#fff !important;}
.dark .hmd-blacklist {background: #222;}
.dark .hmdclosebutton {background: #111;}
.dark .hmd-notes-area {color: #bbb;background: #333;}
body.dark::before {content: "";position: fixed;inset: 0;;background-color: rgba(0, 0, 0, 0.3);z-index: 9999;pointer-events: none;}
.dark p#breadcrumbsmove {background: #292b2c;color: #bbb;display: block !important;border-bottom: 1px solid #666;}
.dark p#breadcrumbsmove a {color: #888;}
.dark .hmd-popup-content {background: #292b2c;color: #bbb;}
.dark .cban i:before {background-color: #333;border: solid 1px #3f3f3f;}
.dark .responsive > #advc-menu > form > button {background-color: #232627;border-color: #666;color: #aaa;}
.dark .responsive .form-control {border-color: #666;color: #ccc !important;}
.dark input::placeholder {color: #ccc !important;}
/* 其他 */
input::-webkit-outer-spin-button,input::-webkit-inner-spin-button {-webkit-appearance: none !important;margin: 0;}
input[type="number"] {-moz-appearance: textfield;}
/* 媒体卡片 */
.iconk-play:before {content: "";}
.iconk-yinpin3:before {content: "";}
.poster:hover i.iconk-play:before {content: "\ue604";}
.poster:hover i.iconk-yinpin3:before {content: "\ue60c";}
body .module .content .items .item .poster .rating {
background: linear-gradient(180deg,transparent,rgba(0,0,0,.5) 99.32%) !important;
height: 40px;position: absolute;padding-top: 18px;inset: auto 0 0 0;
}
.module .content .items .item .poster .rating span {color: #fff;}
.vidtime {bottom: 5px;top: auto;background: 0 !important;}
.quality {inset: 0 0 auto auto !important;border-radius: 0 0 0 5px !important;}
`;
// 将CSS规则添加到<style>元素中
styleElement.appendChild(document.createTextNode(cssRules));
var cbanElement = document.createElement("div");
cbanElement.classList.add('cban');
var cbaniElement = document.createElement("i");
document.body.prepend(cbanElement);
cbanElement.appendChild(cbaniElement);
// 在页面顶部创建黑名单显示区域
var blackListArea = document.createElement('div');
blackListArea.classList.add('hmd-blacklist');
//二次确定
const popupContainer = document.createElement("div");
popupContainer.id = "hmd-popup";
popupContainer.className = "hmd-popup";
const popupContent = document.createElement("div");
popupContent.className = "hmd-popup-content";
const heading = document.createElement("h3");
heading.textContent = "确认";
const paragraph = document.createElement("p");
paragraph.textContent = "确定要将该用户加入黑名单吗?";
const confirmButton = document.createElement("button");
confirmButton.id = "hmd-confirm-button";
confirmButton.className = "hmd-confirm-button";
confirmButton.textContent = "确认";
const cancelButton = document.createElement("button");
cancelButton.id = "hmd-cancel-button";
cancelButton.className = "hmd-cancel-button";
cancelButton.textContent = "取消";
// 将所有元素追加到它们各自的父元素中
popupContent.appendChild(heading);
popupContent.appendChild(paragraph);
popupContent.appendChild(confirmButton);
popupContent.appendChild(cancelButton);
popupContainer.appendChild(popupContent);
// 将黑名单区域添加到页面顶部
document.body.prepend(blackListArea);
document.body.prepend(popupContainer);
// 渲染黑名单列表
renderBlacklist();
// 添加“加入黑名单”按钮到评论中
// 加载更多评论监听
const threadWrapper = document.getElementById('wcThreadWrapper');
const observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.type === 'childList') {
addBlacklistButtonToComments();
shijiantiaozhuan();
updatedttxbtn();
updateImages();
blockLinks();
}
});
});
// 检查传递给 observe 方法的参数是否是有效的节点对象
if (threadWrapper instanceof Node) {
// 如果是有效的节点对象,则调用 observe 方法
observer.observe(threadWrapper, { childList: true });
} else {
}
// '加入黑名单'按钮
function addBlacklistButtonToComments() {
const comments = document.querySelectorAll('.wc-comment-right');
comments.forEach(comment => {
const commentHeader = comment.querySelector('.wc-comment-header');
const commentHeaderadd = comment.querySelector('.wc-comment-link');
const addToBlacklistButton = commentHeader.querySelector('.hmd-add-to-blacklist');
if (addToBlacklistButton) return; // 避免重复添加按钮
const username = commentHeader.querySelector('.wc-comment-author > a').innerText;
const hmdlink = commentHeader.querySelector('.wc-comment-author > a');
const hmdlinkid = hmdlink.href.match(/\/author\/\d+/);
const popup = document.getElementById('hmd-popup');
const button = document.createElement('button');
button.textContent = '黑';
button.classList.add('hmd-add-to-blacklist');
button.addEventListener('click', () => {
popup.style.display = 'flex';
const confirmButton = document.getElementById('hmd-confirm-button');
const cancelButton = document.getElementById('hmd-cancel-button');
cancelButton.addEventListener('click', () => {
popup.style.display = 'none';
confirmButton.removeEventListener('click', confirmClickHandler); // 移除确认按钮的事件监听器
});
const confirmClickHandler = () => {
blacklist.push({ username, hmdlinkid });
GM_setValue('blacklist', blacklist);
blockLinks();
renderBlacklist();
popup.style.display = 'none';
confirmButton.removeEventListener('click', confirmClickHandler); // 移除确认按钮的事件监听器
};
confirmButton.addEventListener('click', confirmClickHandler);
});
commentHeaderadd.appendChild(button);
});
}
// 渲染黑名单列表
function renderBlacklist() {
blackListArea.innerHTML = '';
blacklist.forEach(item => {
const blacklistItem = document.createElement('div');
blacklistItem.classList.add('hmd-blacklist-item');
const blacklistusername = document.createElement('span');
blacklistusername.textContent = item.username;
const blacklistlink = document.createElement('a');
blacklistlink.href = item.hmdlinkid;
blacklistlink.textContent = item.hmdlinkid;
blacklistItem.appendChild(blacklistusername);
blacklistItem.appendChild(blacklistlink);
const deleteButton = document.createElement('button');
deleteButton.textContent = '删除';
deleteButton.classList.add('hmd-del');
deleteButton.addEventListener('click', () => {
blacklist = blacklist.filter(i => i.hmdlinkid !== item.hmdlinkid);
GM_setValue('blacklist', blacklist);
renderBlacklist();
blockLinks();
});
blacklistItem.appendChild(deleteButton);
blackListArea.appendChild(blacklistItem);
});
}
// 屏蔽黑名单中的链接
function blockLinks() {
const links = document.querySelectorAll('.wc-comment-author > a');
var hostname = window.location.hostname;
// 构建完整的 URL 列表
var urls = blacklist.map(item => "https://" + hostname + item.hmdlinkid);
links.forEach(link => {
const parentElement = link.parentElement.parentElement.parentElement.parentElement;
// 检查 URL 是否在 blacklist 中
var isBlocked = urls.includes(link.href);
if (isBlocked) {
parentElement.style.display = 'none';
} else {
parentElement.style.display = '';
}
});
}
// 简介
function jianjie() {
// 换行
const dateSpan = document.querySelector('#single > div.content > div.sheader > div.data > div.extra > span.date');
const br1 = document.createElement('br');
const br2 = document.createElement('br');
dateSpan.insertAdjacentElement('afterend', br1);
dateSpan.insertAdjacentElement('afterend', br2);
// 完整图片显示
// 获取<meta property="og:image">元素的内容
const ogImageMeta = document.querySelector('meta[property="og:image"]');
const ogImageUrl = ogImageMeta ? ogImageMeta.getAttribute('content') : '';
// 替换图片链接
const dplayerVideo = document.querySelector('#single > .content > .sheader > .poster > img');
if (dplayerVideo && ogImageUrl) {
dplayerVideo.setAttribute('src', ogImageUrl);
}
// youtube超链接
// 获取.wp-content下的所有<p>元素
const paragraphs = document.querySelectorAll('.wp-content p');
// 创建一个空数组来存储结果
const youtuberesult = [];
// 遍历每个<p>元素
paragraphs.forEach((p) => {
// 检查元素是否包含"油管:"
if (p.textContent.includes('油管:')) {
// 使用正则表达式匹配包含"油管:"的那一行
const regex = /油管:(.*)/;
const match = p.textContent.match(regex);
if (match && match[1].trim() !== '') {
// 获取匹配到的文本
const matchedText = match[1];
// 分割文本为单词
const words = matchedText.split(' ');
// 遍历每个单词
words.forEach((word) => {
// 检查单词是否为空字符串
if (word.trim() !== '') {
// 创建<a>标签并设置href属性为单词链接
const link = document.createElement('a');
link.href = "https://www.youtube.com/watch?v=" + word;
link.target="_blank";
// 设置<a>标签的文本为单词
link.textContent = word;
// 将<a>标签添加到结果数组中
youtuberesult.push(link);
}
});
}
}
});
const activityBtn = document.querySelector('#info > .wp-content > h3:nth-of-type(3)');
const activityBtnAlt = document.querySelector('#info > .wp-content > .activity-btn');
youtuberesult.forEach((link) => {
if (activityBtn) {
activityBtn.parentNode.insertBefore(link, activityBtn);
} else {
activityBtnAlt.parentNode.insertBefore(link, activityBtnAlt);
}
});
}
// 视频功能
// 评论区时间跳转
function shijiantiaozhuan() {
const paragraphs = document.querySelectorAll('.wc-comment-right > .wc-comment-text > p');
paragraphs.forEach((p) => {
const regex = /([0-9]|[1-9][0-9])[::;;.。分]([0-5][0-9])/g;
p.innerHTML = p.innerHTML.replace(regex, (match) => {
const [hours, minutes] = match.split(/[::;;.。分]/);
const totalSeconds = parseInt(hours) * 60 + parseInt(minutes);
return `<a href="javascript:dp.seek(${totalSeconds});">${match}</a>`;
});
});
// 将视图定位到 播放器
const linkElements = document.querySelectorAll('.wc-comment-right > .wc-comment-text > p > a');
linkElements.forEach((linkElement) => {
linkElement.addEventListener('click', () => {
const dplayerElement = document.querySelector('#dplayer');
window.scrollTo({
top: dplayerElement.offsetTop,
behavior: 'smooth' // 可以选择平滑滚动效果
});
});
});
}
// 禁用动态头像
// 更新开关容器文本和状态
function updatedttxbtn() {
const switchElement = document.querySelector('.dttx-switch');
if (isOn) {
switchElement.classList.add('dttxk');
} else {
switchElement.classList.remove('dttxk');
}
}
// 更新图像
function updateImages() {
const images = document.querySelectorAll('#wcThreadWrapper img');
if (isOn) {
images.forEach(image => {
if (image.src.includes('.gif')) {
const fileName = image.src.split('/').pop();
const letters = 'abcdefghijklmnopqrstuvwxyz';
const randomLetter = letters[Math.floor(Math.random() * letters.length)];
const newSrc = `https://www.asasmr3.com/wp-content/plugins/wp-first-letter-avatar/images/default/96/latin_${randomLetter}.png`;
image.src = newSrc;
}
});
}
}
// 切换开关状态
function toggleSwitch() {
isOn = !isOn;
GM_setValue('dttxbtn', isOn);
updatedttxbtn();
updateImages();
if (!isOn) {
location.reload();
}
}
// 页面加载完毕时执行一次
window.onload = function() {
// 媒体页
if (window.location.href.match(/https:\/\/.*\/(video|sound)\/(\d+)\.html.*/)) {
addBlacklistButtonToComments();
shijiantiaozhuan();
jianjie();
}
// 分割线
const firstListItems = document.querySelectorAll('.user-dashboard-dropdown ul li:first-child');
firstListItems.forEach((firstListItem) => {
const separator = document.createElement('div');
separator.classList.add('separator');
firstListItem.insertAdjacentElement('afterend', separator);
});
// 创建'黑名单'关闭按钮
var hmdcloseButton = document.createElement("i");
hmdcloseButton.innerHTML = "×"; // 使用HTML实体编码表示红色"x"
hmdcloseButton.style.display = "none";
hmdcloseButton.classList.add('hmdclosebutton');
hmdcloseButton.addEventListener("click", function() {
// 隐藏黑名单div
var blacklistDiv = document.querySelector(".hmd-blacklist");
blacklistDiv.style.display = "none";
hmdcloseButton.style.display = "none";
});
// 将关闭按钮添加到页面中
var blacklistDiv = document.querySelector(".hmd-blacklist");
blacklistDiv.parentNode.insertBefore(hmdcloseButton,blacklistDiv);
// 用户头像菜单
// 创建'黑名单'打开选项
const blacklistElement = document.querySelector('.hmd-blacklist');
const hqhmdcloseButton = document.querySelector(".hmdclosebutton");
var userlastlilist = document.querySelectorAll('.user-dashboard-dropdown ul li:last-child');
userlastlilist.forEach(function(userLastLi) {
var newuserLi = document.createElement('li');
var newuserliLink = document.createElement('a');
var newuserliLinkp = document.createElement('p');
var newuserliLinkicon = document.createElement('i');
newuserliLinkp.textContent = '黑名单';
newuserliLinkicon.classList.add('asmr');
newuserliLinkicon.classList.add('iconk-jianjie');
newuserliLink.classList.add('hmd-fbq');
newuserliLink.addEventListener('click', () => {
blacklistElement.style.display = 'block';
hqhmdcloseButton.style.display = 'flex';
});
newuserLi.appendChild(newuserliLink);
newuserliLink.appendChild(newuserliLinkicon);
newuserliLink.appendChild(newuserliLinkp);
// 将新的 li 元素插入到当前最后一个 li 元素之前
userLastLi.parentNode.insertBefore(newuserLi, userLastLi);
});
// 左侧栏
//热门
var rementargetElement = document.querySelector("#menu-item-22769 > a");
rementargetElement.href = "/rmen?timeframe=week";
var srementargetElement = document.querySelector("#arch-menu > div > div:nth-child(2) > ul > li:nth-child(4) > a");
if (srementargetElement) {
srementargetElement.href = "/rmen?timeframe=week";
}
var cban = document.querySelector('.cban');
var mobileNav = document.querySelector('.mobile-nav');
var mobileoverlay = document.querySelector('.mobile-overlay');
function toggleActiveClass() {
mobileNav.classList.toggle('active');
mobileoverlay.classList.toggle('active');
}
cban.addEventListener('click', toggleActiveClass);
// 开关
// 禁用动态头像开关
var darkbtnElement = document.querySelector('#dt_contenedor > .mobile-header-menu > div > .darkbtn');
var switchButton = document.createElement('div');
switchButton.classList.add('dttxbtn');
switchButton.innerHTML = '<a href="javascript:" class="btntext"><div class="dttx-switch"><i></i><span>禁用动态头像</span></div></a>';
var parentElement = darkbtnElement.parentNode;
parentElement.insertBefore(switchButton, darkbtnElement.nextSibling);
const toggleDiv = document.querySelector('.dttx-switch');
toggleDiv.addEventListener('click', toggleSwitch);
// 检查是否显示手动顶栏
var header = document.getElementById("header");
var headerStyle = window.getComputedStyle(header).getPropertyValue("display");
var cebianlanann = document.querySelector(".cban");
if (headerStyle === "none") {
cebianlanann.style.display = "none";
}
// 顶栏
var qiandaolement = document.querySelector(".responsive > .search > .search-resp");
qiandaolement.href = "https://www.asasmr3.com/mission";
// 创建搜索
var divElement = document.createElement("div");
divElement.id = "advc-menu";
divElement.className = "searchs";
divElement.style.cssText = "float: left; padding: 10px 0px 8px 5px;";
var formElement = document.createElement("form");
formElement.id = "searchform";
formElement.action = "https://www.asasmr3.com";
formElement.method = "get";
formElement.style.display= "flex";
// 搜索框
var inputElement = document.createElement("input");
inputElement.type = "text";
inputElement.className = "form-control";
inputElement.placeholder = "搜索...";
inputElement.name = "s";
inputElement.id = "s";
inputElement.value = "";
// 搜索按钮
var buttonElement = document.createElement("button");
buttonElement.type = "submit";
var spanElement = document.createElement("span");
spanElement.className = "olam";
spanElement.innerText = "\uE73B";
spanElement.style.cssText = "font-family: 'olam' !important;";
buttonElement.appendChild(spanElement);
formElement.appendChild(inputElement);
formElement.appendChild(buttonElement);
divElement.appendChild(formElement);
var responsiveElement = document.querySelector(".responsive");
responsiveElement.appendChild(divElement);
// 底栏
// 底部"首页"
var homedibu = document.createElement('a');
homedibu.href = 'https://www.asasmr3.com/';
homedibu.className = 'touchy-home-button';
var homedibuspan = document.createElement('span');
homedibuspan.className = 'touchy-call-text-label-offset';
var homedibuicon = document.createElement('i');
homedibuicon.className = 'fa fa-home';
var homedibub = document.createElement('b');
homedibub.textContent = '首页';
homedibuspan.appendChild(homedibuicon);
homedibu.appendChild(homedibuspan);
homedibu.appendChild(homedibub);
var searchButton = document.querySelector('.touchy-search-button');
searchButton.parentNode.insertBefore(homedibu, searchButton.nextSibling);
var touchymenu = document.querySelector('.touchy-menu-button.touchy-toggle-menu');
// 创建一个新的元素,并将原始元素的所有属性和子元素复制到新元素中
var newElement = touchymenu.cloneNode(true);
// 替换原始元素,从而删除所有事件监听器
touchymenu.parentNode.replaceChild(newElement, touchymenu);
// 添加新的点击事件监听器到新元素
newElement.addEventListener('click', function() {
mobileoverlay.classList.toggle('active');
mobileNav.classList.toggle('active');
});
updatedttxbtn();
updateImages();
blockLinks();
};
// 监听页面刷新事件,在刷新时保留黑名单列表
window.addEventListener('beforeunload', () => {
localStorage.setItem('blacklist', JSON.stringify(blacklist));
});
})();