您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add a link on Reddit tab bar to remove posts on front page or subreddit which are older than N hours or has more than N number of comments.
当前为
// ==UserScript== // @name Add Link To Remove Old/Crowded Reddit Posts // @namespace AddLinkToRemoveOldCrowdedRedditPosts // @description Add a link on Reddit tab bar to remove posts on front page or subreddit which are older than N hours or has more than N number of comments. // @include https://www.reddit.com/* // @version 1 // @author jcunews // @grant none // ==/UserScript== (function() { //*** settings start *** var maxAge = 10; //in hours var maxComments = 500; //*** settings end *** //remove the posts function removePosts() { var posts = document.querySelectorAll(".content > .spacer > .sitetable > .thing"); var time = (new Date()).valueOf(), maxAgeMs = maxAge*3600000, i, postTime, comments, link; for (i = posts.length-1; i >= 0; i--) { //get post's time postTime = parseInt(posts[i].getAttribute("data-timestamp")); //get post's number of comments comments = parseInt(posts[i].querySelector(".comments").textContent.match(/\d+/)[0]); //main decision if (((time-postTime) > maxAgeMs) || (comments > maxComments)) { //click "hide" link link = posts[i].querySelector(".hide-button a"); if (link) { link.click(); } } } } //add the link var tabmenu = document.querySelector("#header-bottom-left .tabmenu"), link; if (!tabmenu) return; link = document.createElement("A"); link.textContent = "Remove Old/Crowded"; link.style.marginLeft = "3ex" link.href = "javascript:void(0)"; link.onclick = removePosts; tabmenu.appendChild(link); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址