您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
In the AO3 inbox, display what chapter a comment is on
- // ==UserScript==
- // @name AO3: Display what chapter a comment is on in inbox
- // @version 2024-04-20
- // @description In the AO3 inbox, display what chapter a comment is on
- // @author ceiaOfSilence
- // @license MIT
- // @match https://archiveofourown.org/users/*/inbox*
- // @run-at document-idle
- // @namespace https://greasyfork.org/users/1291350
- // ==/UserScript==
- (function () {
- 'use strict';
- jQuery(('.heading.byline')).each(function () {
- var commentHeader = this;
- var url = jQuery(this).find("a[href^='/works']").attr('href');
- url = "https://archiveofourown.org" + url;
- jQuery.get(url, function(response) {
- var chapterNumberContainer = jQuery(response).find('span.parent').first();
- if (chapterNumberContainer.length > 0) {
- var chapterNumber = chapterNumberContainer.text().trim().match(/\d+/)[0];
- }
- else {
- chapterNumber = "1";
- }
- var chapter = document.createElement('span');
- chapter.className = 'parent';
- chapter.innerText = `at Chapter ${chapterNumber}`;
- jQuery(commentHeader).append(chapter);
- }).fail(function () {
- console.log('failed to retrieve chapter number');
- });
- })
- })();