Okoun.cz admin ban button

Adds Banuj button for Okoun

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Okoun.cz admin ban button
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Adds Banuj button for Okoun
// @author       eso
// @include        https://*.okoun.cz/boards/*
// @include        https://*.okoun.cz/updateBoard.jsp*
// @require https://code.jquery.com/jquery-3.3.1.min.js
// @license MIT
// @grant        none
// ==/UserScript==

$( document ).ready(function() {

    var okounUsSetLink = $('div.settings a').filter(function(index) { return $(this).text() === "Nastavení klubu"; }).attr("href");

    if (okounUsSetLink !== undefined) {
        $( "div.meta span.user" ).each(function( index ) {
            var item = $( this );
            item.before( '<span class="yui-button"><a href="' + okounUsSetLink + '&uuName=' + item.text() +'&uuAction=banishHim" target="_blank">Banuj!</a></span>' );
        });
    }

    if (window.location.href.indexOf('okoun.cz/updateBoard.jsp?boardId=') !== -1) {

        var urlParams = new URLSearchParams(window.location.search);
        if (urlParams.get('uuAction') == 'banishHim') {

            $('input[name="newPermUserLogin[0]"]').val(urlParams.get('uuName'));
            $('input[name="newPermRead[0]"]').prop('checked', false);
            $('input[name="newPermWrite[0]"]').prop('checked', false);
            $('input[name="newPermDeleteOwn[0]"]').prop('checked', false)

            $('html, body').animate({scrollTop: $(document).height()},500);

            $('fieldset#owners button.submit').stop().css("background-color", "#ff0000")
                .animate({ backgroundColor: ''}, 1500);

        }
    }

});