Hack Forums - Notify xadamxk with reports

Adds buttons to post to 'quick report' them; sends PM of reported post.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name            Hack Forums - Notify xadamxk with reports
// @namespace       Snorlax
// @description     Adds buttons to post to 'quick report' them; sends PM of reported post.
// @require         http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
// @grant           GM_getValue
// @grant           GM_setValue
// @grant           GM_xmlhttpRequest
// @include         *hackforums.net/showthread.php*
// @version         1.0
// ==/UserScript==

username = "xadamxk";
my_post_key = unsafeWindow.my_post_key;

$(".post_management_buttons").prepend("<a href='javascript:void(0)' class='bitButton quickReport'>S Report</a>");

$(".quickReport").on("click", function() {
    message = "[url=http://hackforums.net/" + encodeURIComponent($(this).parentsUntil("table[id*='post_']").parent().find("a[href*='showthread.php?tid=']").attr("href")) + "]This post needs moderation[/url]";
    if(confirm("Are you sure you wish to report this?") == true) {
        console.log("Sending PM to " + username + " with message: " + message);
        GM_xmlhttpRequest({
            method: "POST",
            url: "http://hackforums.net/private.php",
            data: "my_post_key=" + my_post_key + "&to=" + username + "&bcc=&subject=Quick%20Report&message_new=" + message + "&message=" + message + "&options%5Bsignature%5D=1&options%5Bsavecopy%5D=1&options%5Breadreceipt%5D=1&action=do_send&pmid=&do=&submit=Send+Message",
            headers: {
                "Content-Type": "application/x-www-form-urlencoded",
                "Referer": "http://www.hackforums.net/private.php?action=send"
            }
        });
    }
});