Clanheart Shoutbox Nuker

Removes the shoutbox. Go to http://www.clanheart.com/settings and look for the "Hide shoutbox option".

当前为 2015-08-13 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Clanheart Shoutbox Nuker
// @namespace    fortytwo
// @version      0.2
// @description  Removes the shoutbox. Go to http://www.clanheart.com/settings and look for the "Hide shoutbox option".
// @author       fortytwo
// @match        http://www.clanheart.com/*
// @grant        GM_getValue
// @grant        GM_setValue
// ==/UserScript==
/***
	NOTICE: YOU ARE AGREEING THAT ANY USE OF THE FOLLOWING SCRIPT IS AT
	YOUR OWN RISK. I DO NOT MAKE ANY GUARANTEES THE SCRIPT WILL WORK, NOR
	WILL I PROVIDE SUPPORT FOR IT OR HOLD MYSELF ACCOUNTABLE IN CASE IT CAUSES
	ISSUES. IF YOU HAVE ISSUES WITH IT, UNINSTALL IT.
***/
//compatibility just in case
if(typeof GM_getValue === undefined){
    //this means we don't have the GM functions, create an equivalent
    //using HTML5 localstorage
    var GM_getValue = function(key, def){
        return localStorage[key] || def;
    }
    var GM_setValue = function(key, val){
        return localStorage[key] = val;
    }
}

var hideShoutbox = GM_getValue('hideShoutbox', false);
if(hideShoutbox){
    $("<style>.widget < #shoutbox-panel { display: none; }</style>").appendTo($("head"));
    var sBWidget = $('#shoutbox-panel').parent();
    sBWidget.remove();

    //break the ajax call from firing. injection
    var s = $("<script>clearInterval(shoutboxTimer);</script>").appendTo($("head"));
    s.remove();
}

//for settings page
if(window.location.pathname == "/settings"){
    //need to use the form to make sure we get the right button
    var button = $("form[action='http://www.clanheart.com/settings/update']").children("input[type='submit']");
    
    var content = $(
    '<div class="form-group">'+
        '<label for="name-in" class="col-md-3 label-heading">Hide shoutbox</label>'+
        '<div class="col-md-12">'+
             '<input type="checkbox" name="chss-enable" />'+
             '<span class="help-block">(Shoutbox Nuker) If you want to hide the shoutbox, check this. The change will be reflected on the next page.</span>'+
        '</div>'+
    '</div>').insertBefore(button);
    
    $('input[name="chss-enable"]')
    .attr('checked', GM_getValue('hideShoutbox', false))
    .on('click', function(){
        GM_setValue('hideShoutbox', this.checked);
    });
}