TagPro Report Submit Button

Show a submit button in the Report popup.

目前為 2018-09-13 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         TagPro Report Submit Button
// @description  Show a submit button in the Report popup.
// @author       Ko
// @version      1.0
// @include      *.koalabeast.com:*
// @include      *.jukejuice.com:*
// @include      *.newcompte.fr:*
// @supportURL   https://www.reddit.com/message/compose/?to=Wilcooo
// @website      https://redd.it/no-post-yet
// @license      MIT
// @namespace https://greasyfork.org/users/152992
// ==/UserScript==

tagpro.ready(function() {

    // Find the existing popup, selection dropdown and cancel button.
    var player = $("div#kick").attr("data-id"),
        select = $("#kickSelect"),
        cancel = $("#kickCancelButton");

    // Remove the event handler that votes on selecting a reason
    select.unbind("change");

    // Clone the "Cancel" button right above it.
    var submit = cancel.clone(true).insertBefore(cancel)

    // Change the ID and text to "Submit" of the cloned button.
    submit.prop("id", "kickSubmitButton").text("Submit");

    // Make a click on the button send a report
    submit.click(function(t) {
        tagpro.socket.emit("kick", {
            playerId: parseInt(player),
            reason: parseInt(select.val())
        });
    });
});