您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add a link to hide all Reddit posts listed in currently logged-on user's page tab (Overview, Submitted, Downvoted, etc.). This script will auto-navigate to the next page (if any) and will continue hiding any hideable posts until the last page.
- // ==UserScript==
- // @name Add A Link To Hide All Reddit Posts
- // @namespace AddALinkToHideAllRedditPosts
- // @version 1.0.1
- // @description Add a link to hide all Reddit posts listed in currently logged-on user's page tab (Overview, Submitted, Downvoted, etc.). This script will auto-navigate to the next page (if any) and will continue hiding any hideable posts until the last page.
- // @author jcunews
- // @include *://*.reddit.com/user/*/*/*
- // @grant none
- // ==/UserScript==
- var hideLinks = document.querySelectorAll('.thing .hide-button a'), linkIndex = 0, hidePostsInProgress = false;
- if (hideLinks.length) {
- var rActionsTrigger = r.actions.trigger;
- r.actions.trigger = function(name, object) {
- if (hidePostsInProgress && (name === "legacy:change-state")) {
- var oldPostCallback = object.post_callback;
- object.post_callback = function(){
- var result, nextLink;
- if (oldPostCallback) {
- result = oldPostCallback.apply(this, arguments);
- }
- if (hidePostsInProgress) {
- if (++linkIndex < hideLinks.length) {
- hideLinks[linkIndex].click();
- } else {
- nextLink = document.querySelector(".nav-buttons .next-button a");
- if (nextLink) {
- nextLink.click();
- } else {
- hidePostsInProgress = false;
- delete sessionStorage.hidePostsInProgress;
- }
- }
- return result;
- }
- };
- }
- return rActionsTrigger.apply(this, arguments);
- };
- var menuArea = document.querySelector(".menuarea > .spacer");
- var link = document.createElement("A");
- link.textContent = "Hide All Posts";
- link.style.marginLeft = "2ex";
- link.href = "#";
- link.onclick = function() {
- if (!hidePostsInProgress) {
- hidePostsInProgress = true;
- sessionStorage.hidePostsInProgress = 1;
- hideLinks[0].click();
- }
- return false;
- };
- menuArea.appendChild(link);
- if (hidePostsInProgress = sessionStorage.hidePostsInProgress) {
- hideLinks[0].click();
- }
- } else {
- hidePostsInProgress = false;
- delete sessionStorage.hidePostsInProgress;
- }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址