Collapsit

Enables collapsing (and expanding) of comments on Removeddit.

目前為 2022-02-25 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT
/* eslint-env browser, greasemonkey */
/* jshint asi: true, esversion: 11 */

// ==UserScript==
// @name            Collapsit
// @name:de         Collapsit
// @name:en         Collapsit
// @namespace       https://github.com/TheLastZombie/
// @version         1.0.8
// @description     Enables collapsing (and expanding) of comments on Removeddit.
// @description:de  Ermöglicht das Ein- und Ausklappen von Kommentaren auf Removeddit.
// @description:en  Enables collapsing (and expanding) of comments on Removeddit.
// @homepageURL     https://thelastzombie.github.io/userscripts/
// @supportURL      https://github.com/TheLastZombie/userscripts/issues/new?labels=Collapsit
// @contributionURL https://ko-fi.com/rcrsch
// @author          TheLastZombie <[email protected]>
// @match           *://*.removeddit.com/r/*/comments/*
// @grant           none
// @icon            https://raw.githubusercontent.com/TheLastZombie/userscripts/main/icons/Collapsit.ico
// @copyright       2020-2022, TheLastZombie (https://github.com/TheLastZombie/)
// @license         MIT; https://github.com/TheLastZombie/userscripts/blob/main/LICENSE
// ==/UserScript==

// ==OpenUserJS==
// @author          TheLastZombie
// ==/OpenUserJS==

(function () {
  "use strict";

  document.addEventListener("click", function (event) {
    if (
      event.target &&
      event.target.matches(".comment-head .author:not(.comment-author)")
    ) {
      event.preventDefault();
      if (event.target.textContent === "[–]") {
        Array.from(event.target.parentNode.parentNode.children)
          .slice(1)
          .forEach((x) => {
            x.style.display = "none";
          });
        event.target.textContent = "[+]";
      } else {
        Array.from(event.target.parentNode.parentNode.children)
          .slice(1)
          .forEach((x) => {
            x.style.display = "";
          });
        event.target.textContent = "[–]";
      }
    }
  });
})();

// @license-end