AO3: Hide Summaries

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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);