// ==UserScript== // @name 69shuba auto 書簽 // @namespace pl816098 // @version 2.2.0 // @description 自動書籤,更改css,可以在看書頁(https://www.69shuba.com/txt/*/*)找到作者連結 // @author You // @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* // @icon https://www.google.com/s2/favicons?sz=64&domain=69shuba.com // @grant none // @license MIT // @downloadURL none // ==/UserScript== var url = window.location.href; var pattern = [ /^(https?:\/\/)(www\.(69shuba|69xinshu)\.com\/txt\/.*\/.*)$/gm, /^(https?:\/\/)(www\.(69shuba|69xinshu)\.com\/book\/.*\.htm.*)$/gm, ]; if (pattern[0].test(url)) { 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]; } debug(`author: ${author}`); 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.69shuba.com/modules/article/author.php?author=${author}`; aElement.textContent = author; aElement.id = "auto_bookmark"; spanElement.textContent = spanElement.textContent.trim().split(" ")[0]; spanElement.appendChild(aElement); let style = document.createElement("style"); style.id = "69shuba_auto_書簽"; style.innerHTML = `.container { margin: -25px auto auto; width: auto; max-width: fit-content; } #auto_bookmark { color: #007ead; }`; document.head.appendChild(style); document.querySelector("#pageheadermenu").remove(); document .querySelector("body > div.container > div.mybox > div.top_Scroll") .remove(); document.querySelector("#ad").remove(); } else if (pattern[1].test(url)) { 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"; }