AO3: Hide Summaries

Hides summaries by default, and adds a button to show them

Tính đến 15-09-2022. Xem phiên bản mới nhất.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         AO3: Hide Summaries
// @description  Hides summaries by default, and adds a button to show them
// @version      1.0

// @author       Nexidava
// @namespace    https://greasyfork.org/en/users/725254

// @match        *://*.archiveofourown.org/*
// @require      https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js
// @grant        none
// @license      GPL-3.0 <https://www.gnu.org/licenses/gpl.html>
// ==/UserScript==

var hideSummaries = true;

function setSummaries($, button, hide) {
    var summaries = $("blockquote.summary")
    if(hide) {
        button.prop("value", "Show Summaries")
        summaries.hide()
    } else {
        button.prop("value", "Hide Summaries")
        summaries.show()
    }
}

function toggleSummaries($, button) {
    hideSummaries = !hideSummaries;
    setSummaries($, button, hideSummaries);
    button.blur()
}

(function($) {
    var button = $('<input class="button" type="button" value="Show Summaries" style="margin:0.3em">')
    setSummaries($, button, hideSummaries)
    button.click(x => { toggleSummaries($, button) })
    $("li.search").prepend(button)
})(jQuery);