Collapsit

Enables collapsing (and expanding) of comments on Removeddit.

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

// @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.7
// @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 () {
  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

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址