您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
For each of the blurbers listed on a work, this script creates a link to their author page (assumes it exists)
- // ==UserScript==
- // @name LibraryThing blurber author pages
- // @namespace https://gf.qytechs.cn/en/users/11592-max-starkenburg
- // @description For each of the blurbers listed on a work, this script creates a link to their author page (assumes it exists)
- // @include http*://*.librarything.tld/work/*
- // @include http*://*.librarything.com/work/*
- // @version 2
- // @grant none
- // ==/UserScript==
- var blurbers = document.querySelector("[fieldname=blurbers]").getElementsByClassName("fwikiItemText");
- if (blurbers.length) {
- for (var i=0; i<blurbers.length; i++) {
- var blurber = blurbers[i];
- var string = blurber.textContent.trim();
- if (string != "") {
- var parens = new RegExp("\\(.*\\)","g");
- if (string.replace(parens,"") != "") { // Remove any parenthetical text, unless the string is entirely parenthetical (probably unnecessary for blurbers, but who knows)
- string = string.replace(parens,"");
- }
- if (string.indexOf(",") == -1) { // Since sometimes people have written them as "First Last" instead of "Last, First" (though these should really just be fixed)
- var lastspace = string.lastIndexOf(" ");
- string = string.substring(lastspace) + string.substring(0,lastspace);
- }
- string = string.toLowerCase().replace(/[^a-z]/g,"").substring(0,20); // Remove non-alpha character, lower-case it, and limit it to 20 characters
- if (string.length) { // Just in case it was all non-Latin characters, whose number generation is a mystery to me
- var aLink = document.createElement("span");
- aLink.style.cssFloat = "right";
- aLink.style.fontSize = ".9em";
- aLink.innerHTML = '(<a href="/author/' + string + '">author page</a>)';
- blurber.insertBefore(aLink, blurber.firstChild); // Attach it somewhere that won't get in the way while editing
- }
- }
- }
- }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址