baxitv_preview
As of
// ==UserScript==
// @name baxi_preview
// @namespace com.oldtan.preview
// @version 1.1.0
// @description baxitv_preview
// @author oldtan
// @include https://www.baxi.tv/forum-54-*.html
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
// function sleep(time){
// var timeStamp = new Date().getTime();
// var endTime = timeStamp + time;
// while(true){
// if (new Date().getTime() > endTime){
// return;
// }
// }
// }
window.addEventListener('load', function() {
console.log(123111111111111111111111111111)
// // 获取所有的超链接元素
// var links = document.querySelectorAll('a');
// // 遍历这些超链接并检查文本内容
// links.forEach(function(link) {
// // 检查超链接文本是否等于 '预览'
// if (link.textContent === '预览') {
// // 获取超链接所在的 tbody 元素的 ID
// var tbodyElement = link.closest('tbody');
// if (tbodyElement.id.includes('stick')){
// return
// }
// if (tbodyElement) {
// // 提取 tid,这里假设 tbody 的 ID 是 'thread_' + tid
// var tid = tbodyElement.id.replace('normalthread_', '');
// // 调用 forum.js 中的 previewThread 函数
// previewThread(tid, tbodyElement.id);
// // 确保预览元素可见
// var previewDiv = document.getElementById('threadPreviewTR_' + tid);
// if (previewDiv) {
// previewDiv.style.display = 'revert';
// }
// }
// }
// });
// 获取所有的超链接元素
var links = document.querySelectorAll('a');
// 遍历这些超链接并检查文本内容
links.forEach(function(link) {
// 检查超链接文本是否等于 '预览'
if (link.textContent === '预览') {
// 获取超链接所在的 tbody 元素的 ID
var tbody = link.closest('tbody').getAttribute('id');
if (tbody.includes('stick')){
return
}
if (tbody) {
// 提取 tid,这里假设 tbody 的 ID 是 'thread_' + tid
var tid = tbody.split('_')[1];
// 调用 forum.js 中的 previewThread 函数
previewThread(tid, tbody);
// 确保预览元素可见
var previewDiv = document.getElementById('threadPreviewTR_' + tid);
if (previewDiv) {
previewDiv.style.display = 'revert';
}
}
}
});
});
function Toast(msg,duration){
duration=isNaN(duration)?3000:duration;
var m = document.createElement('div');
m.innerHTML = msg;
m.style.cssText="max-width:60%;min-width: 150px;padding:0 14px;height: 60px;color: rgb(255, 255, 255);line-height: 60px;text-align: center;border-radius: 4px;position: fixed;top: 40%;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: rgba(0, 0, 0,.7);font-size: 16px;";
document.body.appendChild(m);
setTimeout(function() {
var d = 0.5;
m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
m.style.opacity = '0';
setTimeout(function() { document.body.removeChild(m) }, d * 1000);
}, duration);
}
function Toast2(msg,duration){
duration=isNaN(duration)?3000:duration;
var m = document.createElement('div');
m.innerHTML = msg;
m.style.cssText="max-width:60%;min-width: 150px;padding:0 14px;height: 60px;color: rgb(255, 255, 255);line-height: 60px;text-align: center;border-radius: 4px;position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 999999;background: rgba(0, 0, 0,.7);font-size: 16px;";
document.body.appendChild(m);
setTimeout(function() {
var d = 0.5;
m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
m.style.opacity = '0';
setTimeout(function() { document.body.removeChild(m) }, d * 1000);
}, duration);
}