您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Adds AO3 publication date i.e. date of publication of first chapter to AO3 search/sort page
// ==UserScript== // @name AO3 Publication date // @namespace http://greasyfork.icu/en/scripts/455343/ // @version 2.1 // @description Adds AO3 publication date i.e. date of publication of first chapter to AO3 search/sort page // @author MM // @match https://archiveofourown.org/tags/* // @match https://archiveofourown.org/works?commit=Sort+and+Filter* // @match https://archiveofourown.org/works?utf8=%E2%9C%93&commit=Sort+and+Filter* // @grant none // @license none // ==/UserScript== (function ao3firstpubdate() { 'use strict'; // Define the HTML template for the date display with a span for styling var html_date_heading = ' <span class="date-published" style="font-size: 12px; color: #555; font-family: monospace;"> Date Published: <strong><span style="font-size: 14px; font-family: inherit;">'; // Check for story headings in the index page if (jQuery('.header h4.heading').length) { jQuery('.header h4.heading').each(function() { var sStoryPath = jQuery(this).find('a').first().attr('href'); var oHeader = this; // Check if link is for an individual work var aMatch = sStoryPath.match(/works\/(\d+)/); if (aMatch !== null) { var iStoryId = aMatch[1]; // Fetch the work page jQuery.get('https://archiveofourown.org/works/' + iStoryId, function(oData) { // Extract and reformat the publication date var rawDate = jQuery(oData).find('dd.published').text().trim(); if (rawDate) { // Reformat the date to '05 Oct 2020' var formattedDate = new Intl.DateTimeFormat('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }).format(new Date(rawDate)); // Append the formatted date to the story header jQuery(oHeader).append(html_date_heading + ' ' + formattedDate + '</span></strong></span> '); } }).fail(function() { console.log('Failed to fetch publication date for story ID:', iStoryId); }); } }); } })();