Report thread spammers

Adds button to report thread and user.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Report thread spammers
// @namespace    pxgamer
// @version      0.4
// @description  Adds button to report thread and user.
// @author       pxgamer
// @include      *kat.cr/community/show/*
// @require      https://greasyfork.org/scripts/19550-get-user-hash/code/Get%20User%20Hash.js?version=124786
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    $('a.ka.ka16.ka-report.ka-red[title="Report thread"]').after(' <a class="ka ka16 ka-report reportSpammer" style="background: #8B0000;" title="Report thread spammer"></a>');
    var threadRep = $('#report_thread_div form').attr('action');
    var username  = $('div[id^="post"]:first .commentbody div.userPicSize100px .badge .badgeInfo .badgeUsernamejs a.plain[href^="/user/"]').text();
    var userHash  = guh(username);

    $('.reportSpammer').on('click', function() {
        // Report thread
        $.ajax({
            type: "POST",
            url: threadRep,
            data: { reason: "Thread Spammer" }
        });

        // Report user
        $.ajax({
            type: "POST",
            url: "/account/report/"+userHash+"/",
            data: { reason: "Thread Spammer" }
        });

        //Refresh to complete.
        location.refresh();
    });

})();