Greasy Fork

Greasy Fork is available in English.

AO3 Publication date

Adds AO3 publication date i.e. date of publication of first chapter to AO3 search/sort page

当前为 2022-11-26 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         AO3 Publication date
// @namespace    http://greasyfork.icu/en/scripts/455343/
// @version      1.2
// @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*
// @grant        none
// @license      none
// ==/UserScript==

(function ao3firstpubdate() {
    'use strict';

var html_date_heading ='&nbsp;&nbsp;&nbsp;<span style="font-size: 12px;">Date published :</span><strong><span style="font-size: 14px;">&nbsp;';
if(jQuery('.header h4.heading').length)
        {
            // Near as I can figure, the best way of identifying actual stories in an index page is with the h4 tag with class 'heading' within a list of type 'header'
            jQuery('.header h4.heading').each(function() {
                var sStoryPath = jQuery(this).find('a').first().attr('href');
                var oHeader = this;

                // If link is from collections, get proper link
                var aMatch = sStoryPath.match(/works\/(\d+)/);
                if(aMatch !== null)
                {
                    var iStoryId = aMatch[1];
                    jQuery.get('https://archiveofourown.org/works/' + iStoryId, function(oData) {
                         var status = jQuery(oData).find('dd.published').text();
                        //console.log(status);
                        jQuery(oHeader).append(html_date_heading + status + '</span></strong>&nbsp;');
                    }).fail(function() {
                        console.log('failed');
                    });


                }
            });
        }

})();