Okoun.cz admin ban button

Adds Banuj button for Okoun

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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);

        }
    }

});