CS.RIN.RU - Quality Posts

Only view "quality" posts from verified/pre-defined users in a topic. You can change the verified users, by modifying the verified_users array.

目前為 2016-04-27 提交的版本,檢視 最新版本

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         CS.RIN.RU - Quality Posts
// @version      0.2
// @description  Only view "quality" posts from verified/pre-defined users in a topic. You can change the verified users, by modifying the verified_users array.
// @author       Royalgamer06
// @match        http://cs.rin.ru/forum/viewtopic.php?*t=*
// @grant        none
// @namespace https://greasyfork.org/users/13642
// ==/UserScript==

function addJQuery(callback) {
    var script = document.createElement("script");
    script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js");
    script.addEventListener('load', function() {
        var script = document.createElement("script");
        script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
        document.body.appendChild(script);
    }, false);
    document.body.appendChild(script);
}

function addButton() {
    function showQualityPosts() {
        var verified_users = [".Rar",
                              "b00t",
                              "bongsmoke1989",
                              "BzinhoGames",
                              "Christsnatcher",
                              "Demde",
                              "DMN32",
                              "Haoose",
                              "I am AWESOME",
                              "jAck_h!De",
                              "john2s",
                              "kevinyang225",
                              "kortal",
                              "Lordw007",
                              "Machine4578",
                              "Marti",
                              "Mr.Deviance",
                              "NoWayMan",
                              "pakrat",
                              "prudislav",
                              "RessourectoR",
                              "RezMar",
                              "Royalgamer06",
                              "Sam2k8",
                              "SCS Bot",
                              "sosilent",
                              "Steam006",
                              "steamCooker",
                              "Steve Jobs",
                              "syahmixp",
                              "Testtestom",
                              "Timo654",
                              "toto621",
                              "TwelveCharzzz",
                              "Voksi_Bulgarian"];

        var curr_posts = jQ(".postauthor");
        for (var i = 0; i < curr_posts.length; i++) {
            if (jQ.inArray(curr_posts[i].innerHTML, verified_users) == -1) {
                jQ(curr_posts[i].parentNode.parentNode.parentNode.parentNode).remove();
            }
        }

        //if (document.querySelectorAll("#pageheader > p.gensmall > b > a").length !== 0) {
        //var pages = document.querySelectorAll("#pageheader > p.gensmall > b > a");
        //var lastpage = pages[pages.length-2].innerHTML;

        var currpage = jQ("#pagecontent > table:nth-child(1) > tbody > tr > td.nav > strong:first").text();
        var lastpage = jQ("#pagecontent > table:nth-child(1) > tbody > tr > td.nav > strong:last").text();
        if (lastpage > currpage) {

            jQ("#pagecontent table").last().remove();
            jQ("#pagecontent table").last().remove();

            loadPage(currpage, lastpage);
            //for (var p = currpage; p < lastpage; p++) {

            function loadPage(p, end) {
                jQ.get(location.href + "&start=" + parseInt(p)*15, function(data) {
                    var posts = jQ(data).find(".postauthor");
                    for (var i = 0; i < posts.length; i++) {
                        if (jQ.inArray(posts[i].innerHTML, verified_users) > -1) {
                            jQ("#pagecontent").append(posts[i].parentNode.parentNode.parentNode.parentNode);
                        }
                    }
                    if (p < end) {
                        var n = parseInt(p) + 1;
                        loadPage(n, end);
                    }
                });
            }
        }
    }
    var button = document.createElement("a");
    button.setAttribute("title", "Quality posts view");
    button.innerHTML = "Quality posts view";
    button.addEventListener("click", showQualityPosts, false);

    jQ("#pagecontent > table:nth-child(2) > tbody > tr > td > table > tbody > tr > td:nth-child(1)").append(" | ").append(button);
}
addJQuery(addButton);