// ==UserScript==
// @name Kanxue Forum Alert
// @namespace 875K9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8Y4c8S2L8i4m8W2M7X3#2G2L8X3E0W2P5g2)9J5k6h3&6W2N6q4)9J5c8R3`.`.
// @version 0.1
// @description 打开看雪论坛thread页面时弹出信息框
// @author You
// @match https://bbs.kanxue.com/thread-*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// 检查当前URL是否包含指定模式
const urlPattern = /^https:\/\/bbs\.kanxue\.com\/thread-/;
// 如果URL匹配,则弹出信息框
if (urlPattern.test(window.location.href)) {
// 选择第一个按钮并添加点击事件监听器
// 设置初始延迟,以确保页面和按钮都已经刷新完毕
setTimeout(() => {
//过滤掉自己的帖子
// 获取第一个标签内的img
const firstImg = document.querySelector('#body > div > div.row.mx-0 > div.col-lg-3.pr-0.hidden-sm.hidden-md > div > div.rightbox_card_hidden > div.card.mb-3.position-relative > div > div:nth-child(1) > div:nth-child(1) > a img');
// 获取第二个标签内的img
const secondImg = document.querySelector('#header > div > nav > div.text-right.nav_user_item > span.ml-2.xn-toggle.pointer > a img');
// 比较img标签的src属性
if (firstImg && secondImg) {
const firstImgSrc = firstImg.src;
const secondImgSrc = secondImg.src;
if (firstImgSrc === secondImgSrc) {
console.log('两个img的src属性是一样的:', firstImgSrc);
return;
} else {
console.log('两个img的src属性不一样. 第一个:', firstImgSrc, '第二个:', secondImgSrc);
}
} else {
console.log('一个或两个img元素未找到');
}
//return;
const icon003 = document.querySelector('#collection_thumb > div > div:nth-child(2) > div:nth-child(1) > a > .icon-thumbs-up.colorff842a');
if (icon003) {
console.log('找到按钮icon003,已点赞');
window.stop();
console.log('返回1111');
return;
}
console.log('22222222222222');
// 选择第一个按钮并添加点击事件监听器
const firstButton = document.querySelector('#collection_thumb > div > div:nth-child(2) > div:nth-child(1) > a');
if (firstButton) {
console.log('First button found:', firstButton);
firstButton.click();
//alert("您已打开一个看雪论坛的帖子页面!");
const secondButton = document.querySelector('#thumbModal > div > div > div.modal-footer > button.btn.btn-primary.thumbPost');
if (secondButton) {
secondButton.click();
const icon002 = document.querySelector('#collection_thumb > div > div:nth-child(2) > div:nth-child(1) > a > .icon-thumbs-o-up.color515a6e');
if (icon002) {
// 延迟刷新页面
setTimeout(() => {
console.log('Refreshing page');
location.reload();
}, 100); // 延迟半秒后刷新页面}
}
}
}
}, 1000); // 初始延迟2秒
}
})();
[培训]Windows内核深度攻防:从Hook技术到Rootkit实战!
最后于 2025-6-23 12:34
被道友请留步编辑
,原因: