FANDOM


//
/* MessageBlocker v1.0
 * Documentation at: http://dzy.wikia.com/wiki/Blockmsgs
 * Justin Stallings (User:Dzylon), 2012 
 */
 
function blockMessages() {
    "use strict";
 
    var timescalled = 0;
 
    function createul() {
        $('.regular-actions').after('<hr class="separator"></hr><ul class="i1d"><li class="ignore"><span class="icon"></span><span class="label">Block Messages</span></li></ul>');
        $("li.ignore").on("click", block);
        if (timescalled === 0) {
            var ulstyle = document.createElement("style");
            ulstyle.innerHTML = ".UserStatsMenu .actions li.ignore .icon { background-image: url('http://images.wikia.com/dzy/images/8/81/Sprite-chat-ignore.png');  } .UserStatsMenu .actions li.ignore .icon { background-position: -0px 0; } .UserStatsMenu .actions li.ignore:hover .icon { background-position: -31px 0; } .UserStatsMenu .actions li.ignore.blue .icon { background-position: -67px 0; } .UserStatsMenu .actions li.ignore.blue:hover .icon { background-position: -98px 0; } #WikiChatList>li.blockee { background: #FFE6D8; !important } .ignore span.label { position: relative; bottom: 5px; left: 3px; } ";
            document.head.appendChild(ulstyle);
            timescalled++;
        }
    }
 
    function createul_init() {
        setTimeout('createul()', 1);
    }
 
    $("#WikiChatList li.User").on("click", createul_init);
 
    function block() {
        var blockee = $('<div/>').append($(this).parents().parents().siblings().children('ul').children('.username').clone()).text().replace("'","\\'").replace("!","\\!").replace("$","\\$").replace("%","\\%").replace("&","\\&").replace("*","\\*").replace("+","\\+").replace(",","\\,").replace("-","\\-").replace(".","\\.").replace(":","\\:").replace("?","\\?").replace("^","\\^").replace("~","\\~").replace("`","\\`").replace("(","\\(").replace(")","\\)");
        var blockee_alt = blockee.replace(/ /g,"_"); 
        var isblocked = $("#WikiChatList>li#user-"+blockee_alt).hasClass("blockee");
        var ismod = $("#WikiChatList>li#user-"+blockee_alt).hasClass("chat-mod");
        if (ismod === false) {
            if (isblocked === false) {
                var blockstyle = document.createElement("style");
                blockstyle.innerHTML = ("li[data-user='"+blockee+"']:not(.User){display: none;}");
                blockstyle.setAttribute("id", "blockstyle-"+blockee_alt);
                document.head.appendChild(blockstyle);
                $("#WikiChatList>li#user-"+blockee_alt).addClass("blockee");
                $("li.ignore").addClass("blue");
                $(".UserStatsMenu li.ignore>span.label").replaceWith("<span class='label'>Allow Messages</span>");
            } else {
                var blockstyle = document.getElementById("blockstyle-"+blockee_alt);
                blockstyle.parentNode.removeChild(blockstyle); 
                $("#WikiChatList>li#user-"+blockee_alt).removeClass("blockee");
                $("li.ignore").removeClass("blue");
                $(".UserStatsMenu li.ignore>span.label").replaceWith("<span class='label'>Block Messages</span>");
            }
        } else {
            // replace with write to main chat window
            alert("You cannot block chat moderators, administrators, or Wikia staff members.");
        }
    }
}
 
if (wgPageName == 'Special:Chat') {
    addOnloadHook(blockMessages);
}
 
//

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.