Memeflag hider

hides memeflags

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Memeflag hider
// @version      0.1
// @description  hides memeflags
// @author       britpol
// @grant        none
// @include      http*://*.4chan.org/pol/*
// @namespace https://greasyfork.org/users/250780
// ==/UserScript==

(function() {
    'use strict';
    var posts = document.getElementsByClassName("postContainer replyContainer"); //get all posts on page
    for (var currentPostNumber = 0; currentPostNumber < posts.length; currentPostNumber++) { //go through every post on the page
        if (posts[currentPostNumber].getElementsByClassName("countryFlag").length !== 0) { //a post only has countryFlag if it is a memeflag
            ReplyHiding.hide(posts[currentPostNumber].id.substr(2)); //it's a memeflag, hide it.
            //the hide(int postNum) function is called to gracefully hide the post instead of removing it,
            //as 4chan already supports post hiding, this script just automates it.
        }
    }
})();