Clanheart Shoutbox Nuker

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

目前為 2015-08-13 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Clanheart Shoutbox Nuker
// @namespace    fortytwo
// @version      0.1
// @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 Shooter) 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);
    });
}