您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Display only the 1st post of a game thread. This completely removes all replies (and more) from the thread.
当前为
// ==UserScript== // @name F95 Game Post Only // @namespace 1330126-edexal // @match http*://f95zone.to/threads/* // @grant none // @icon https://external-content.duckduckgo.com/ip3/f95zone.to.ico // @license Unlicense // @version 1.1 // @author Edexal // @description Display only the 1st post of a game thread. This completely removes all replies (and more) from the thread. // ==/UserScript== (async function(){ function deleteEls(el){ if (el instanceof NodeList){ el.forEach((curVal,curIndex)=>{ curVal.remove(); }); } else if (el instanceof Element) { el.remove(); }else{ console.error(`Unable to delete ${el}! Element is of type: ${typeof el}.`); } } async function removeFooter(){ let footer = document.querySelector("#footer"); await deleteEls(footer); } async function removeBreadcrumbs(){ let breadcrumb = document.querySelectorAll(".breadcrumb"); await deleteEls(breadcrumb); } async function removeAccountItems(){ let accIcon = document.querySelector("a.p-navgroup-link--user, .offCanvasMenu"); await deleteEls(accIcon); } async function removeReplyItems() { let replyForm = document.querySelector('form.js-quickReply'); await !!replyForm ? deleteEls(replyForm) : null; let replyActions = document.querySelectorAll('a.actionBar-action--mq, a.actionBar-action--reply'); await !!replyActions ? deleteEls(replyActions) : null; } async function removeRecomendations() { let recomendationSection = document.querySelector('div.block--similarContents'); await !!recomendationSection ? deleteEls(recomendationSection) : null; } async function showFirstPostOnly() { //Thread Post Container Ref let opContainer = document.querySelector("article.message-threadStarterPost").parentNode; opContainer.replaceChildren(opContainer.children.item(0)); let paginations = document.querySelectorAll('.pageNavWrapper--mixed'); //top pagination let topPageContainer = paginations[0].parentNode.parentNode; await !!topPageContainer ? deleteEls(topPageContainer) : null; //bottom pagination let bottomPageContainer = paginations[1].parentNode.parentNode; await !!bottomPageContainer ? deleteEls(bottomPageContainer) : null; //Scrollbar buttons let scrollbarContainer = document.querySelector('div.u-scrollButtons').parentNode; await !!scrollbarContainer ? deleteEls(scrollbarContainer) : null; } function isGameThread(){ let breadcrumbID = document.querySelectorAll("ul.p-breadcrumbs li:nth-of-type(3) a span[itemprop=name]"); let isGame = false; if (!!breadcrumbID.length){ breadcrumbID.forEach((curVal, curIndex) => { if (curVal.textContent.toLowerCase() === "Games".toLowerCase()){ isGame = true; } }); } return isGame; } /*Checks if thread is a GAME type*/ if(isGameThread()){ await showFirstPostOnly();// /*-----------------------(Optional) Delete '//' for each option to activate----------------*/ await removeBreadcrumbs(); await removeFooter(); await removeRecomendations();//Removes the similar threads section at the bottom of the page await removeReplyItems();//Removes reply related elements from the page //await removeAccountItems(); } })().catch((err)=> console.error(err));