Greasy Fork is available in English.
自動書籤,更改css,可以在看書頁(https://www.69shuba.com/txt/*/*)找到作者連結
当前为
/** @format */
// ==UserScript==
// @name 69shuba auto 書簽
// @namespace pl816098
// @version 2.6.0
// @description 自動書籤,更改css,可以在看書頁(https://www.69shuba.com/txt/*/*)找到作者連結
// @author pl816098
// @match https://www.69shuba.com/txt/*/*
// @match https://www.69xinshu.com/txt/*/*
// @match https://www.69xinshu.com/book/*.htm*
// @match https://www.69shuba.com/book/*.htm*
// @match https://www.69shuba.com/txt/*/end.html
// @match https://www.69xinshu.com/txt/*/end.html
// @icon https://www.google.com/s2/favicons?sz=64&domain=69shuba.com
// @grant window.close
// @license MIT
// ==/UserScript==
var url = window.location.href;
var pattern = {
book: /^(https?:\/\/)(www\.(69shuba|69xinshu)\.com)\/txt\/[0-9]*\/(?!end)[0-9]*$/gm,
info: /^(https?:\/\/)(www\.(69shuba|69xinshu)\.com)\/book\/[0-9]*\.htm.*$/gm,
end: /^(https?:\/\/)(www\.(69shuba|69xinshu)\.com)\/txt\/[0-9]*\/end\.html$/gm,
};
if (pattern.book.test(url)) {
// console.log("book");
document.querySelector("#a_addbookcase").click();
let author = "";
if (bookinfo.author) {
author = bookinfo.author;
} else {
author = document
.querySelector(
"body > div.container > div.mybox > div.txtnav > div.txtinfo.hide720 > span:nth-child(2)"
)
.textContent.trim()
.split(" ")[1];
}
let spanElement = document.querySelector(
"body > div.container > div.mybox > div.txtnav > div.txtinfo.hide720 > span:nth-child(2)"
);
let aElement = document.createElement("a");
aElement.href = `https://www.69xinshu.com/modules/article/author.php?author=${author}`;
aElement.textContent = author;
aElement.style.color = "#007ead";
spanElement.textContent = spanElement.textContent.trim().split(" ")[0];
spanElement.appendChild(aElement);
let style = document.createElement("style");
style.innerHTML = `
.container .mybox {
margin: -71px -75px;
width: auto;
}`;
document.head.appendChild(style);
document.querySelector("#pageheadermenu").remove();
document
.querySelector("body > div.container > div.mybox > div.top_Scroll")
.remove();
document
.querySelector("body > div.container > div.yuedutuijian.light")
.remove();
document.querySelector("#tuijian").remove();
document.querySelector("#ad").remove();
} else if (pattern.info.test(url)) {
// console.log("info");
document
.querySelector(
"body > div.container > ul > li.col-8 > div:nth-child(2) > ul > li:nth-child(2) > a"
)
.click();
document.querySelector(
"body > div.container > ul > li.col-8 > div:nth-child(1) > div > div.booknav2 > p:nth-child(2) > a"
).style.color = "#007ead";
document.querySelector(
"body > div.container > ul > li.col-8 > div:nth-child(1) > div > div.booknav2 > p:nth-child(3) > a"
).style.color = "#007ead";
} else if (pattern.end.test(url)) {
// console.log("end");
window.close();
}