User:PlasmaTime/chat.js

$('#ChatHeader').append(' Current Bans - UF - RfCM - RFA - Chat Stats   ') /////////////////////////////////////////////////////////// var refreshDate; function addDate { var UTCDate = ((new Date).toUTCString).replace("GMT", "(UTC)"); $('#showdate').empty.append(' ' + UTCDate.substring(5) + ' '); window.clearTimeout(refreshDate); refreshDate = window.setTimeout(addDate, 1000); } $(document).ready(function {   if (skin == 'oasis')         $(' ').appendTo('#GlobalNavigation');    else        $('#p-personal ul').prepend(' ');    addDate;    refreshDate = window.setTimeout(addDate, 1000);    $('#displayTimer').css({'font-size': "9px"}); }); //////////////////////////////////////////////////////// var pings = 'Hair|Hairball'; importScript('User:Joeytje50/chat-pings.js'); onchatmessage = function(text, rawtext) { text = unameBeep(text);//remove this line if you don't want username beeps text = badWordsBeep(text);//remove this line if you don't want bad words beeps return text; //DO NOT EDIT THIS LINE } function createGroupPM { var users = prompt('Enter comma seperated list of users to start a PM with',''); var users = users.split(','); mainRoom.openPrivateChat(users); } $('<a class="wikia-button" id="Pmrail" href="javascript:createGroupPM" style="left:50%;margin: 5px auto; text-align: center; cursor: pointer; display:inline;margin-left:2px;margin-right:2px;padding-top:2px;padding-bottom:2px;">PM</a>').prependTo('.Rail'); function addClearChatText{ if ($('.clearChatText').length <= 0) { var clearChatText = document.createElement('span'); $('<div class="clearChatText" onclick="clearChat" style="left:50%;margin-left: 2px auto; text-align: center; cursor: pointer; display:inline;"><a class="clearChatButton wikia-button">Clear chat</a> ').prependTo('.Rail'); } } function clearChat{ $('.Chat li').remove; } window.onload=addClearChatText; function kickUserButton { var kickuser = prompt('Please enter the chatmod, admin, or staff member you wish to kick.','Hairr'); if (kickuser.length != 0) { mainRoom.kick({name:kickuser}); } } $('<div onclick="kickUserButton" style="left:50%; margin-left:2px;margin-right:2px; display:inline; text-align: center; cursor: pointer;" align="center"><a class="wikia-button">Kick</a> ').prependTo('.Rail'); function awayButton { mainRoom.setAway; } $('<div onclick="awayButton" style=" margin-left:2px;margin-right:2px; margin-bottom:2px; text-align: center; cursor: pointer;" align="center"><a class="wikia-button">Away</a> ').prependTo('.Rail'); /////////////////////////////////////////////////////// var chatTopic = '&nbsp' $(function {	$('#ChatHeader .public.wordmark').prepend('<div class="chattopic" style="text-align:center;position:absolute;width:100%;z-index:0;font-size:14px;color:#3A3A3A"> ')	.find('a').attr('style','position:relative;text-decoration:underline;') }) $('#ChatHeader .public.wordmark div:not(:first-child)').remove var cgscriptloc = cgscriptloc?cgscriptloc:"ul.tools"; var excludeuser = excludeuser?excludeuser:"Wikia"; var refresh = refresh?refresh:30000; var isChat = wgCanonicalSpecialPageName=="Chat" && skin=="oasis"?true:false; function watchlistupdate { $.getJSON('http://runescape.wikia.com/api.php?action=query&list=watchlist&wllimit=1&wldir=older&format=json&wlexcludeuser=' + excludeuser + '&wlprop=ids|user|title|comment', function(wlid) {	$('#WatchlistNotify').html('<a id="WLNotifyLink" href="/wiki/Special:Watchlist#id=' + wlid.query.watchlist[0].revid + '" title="“' + wlid.query.watchlist[0].comment + '”"'+(isChat?' target="new"':'')+'>' + wlid.query.watchlist[0].user + ' changed ' + wlid.query.watchlist[0].title + '</a> <a href="/wiki/' + wlid.query.watchlist[0].title + '"'+(isChat?' target="new"':)+'>[1]</a> <a href="/wiki/' + wlid.query.watchlist[0].title + '?diff=' + wlid.query.watchlist[0].revid + '"'+(isChat?' target="new"':)+'>[2]</a>') }); } /////////////////////////////////////////////// $(document).ready(function{ if (isChat) {	$('#ChatHeader h1.public.wordmark').prepend('<div id="WatchlistNotify" style="font-size:8pt;height:13px;line-height:15px;float:right;clear:right;margin:1px 5px 6px 0;"> ');	$('head').append('<style type="text/css">#WatchlistNotify a:hover {text-decoration:underline;} sup {vertical-align:super;font-size:smaller;} '); } else if (skin == "oasis") {	$(cgscriptloc).append('</li>');	$('head').append('<style type="text/css">a#WLNotifyLink:visited {color:#77F !important;} '); } else if (skin == "monobook") {	$('#p-personal .pBody ul:first-child').prepend('</li>');	$('head').append('<style type="text/css">#p-personal li a#WLNotifyLink {color:#F00 !important;} #p-personal li a#WLNotifyLink:visited {color:#77F !important;} '); } watchlistupdate }) setInterval('watchlistupdate', refresh); //////////////////////////////////////////// /* Function to color nicknames of users in the chat, based on their nickname. */ function colorNickNames { if ($('.username:not([style])').length) { $('.username:not([style])').replaceWith(function { var string = this.innerHTML; var strlen = string.length var asciistr = 0; var addnum = 0; for (i = 0; i < strlen; i++) { if (string.charAt(i).match(/[a-z]/i)) { asciistr += string.charCodeAt(i) - 96; } else if (string.charAt(i).match(/\d/)) { asciistr += string.charCodeAt(i) - 47; } else { asciistr += string.charCodeAt(i); addnum += string.charCodeAt(i); }	}	var color = parseInt(asciistr/(26*string.replace(/[^a-zA-Z0-9]/g,'').length+addnum)*16777215).toString(16); var nickColor = [0,0,0]; nickColor[0] = parseInt(color.charAt(0)+color.charAt(1),16); nickColor[1] = parseInt(color.charAt(2)+color.charAt(3),16); nickColor[2] = parseInt(color.charAt(4)+color.charAt(5),16); nickColor[0] = nickColor[0]>200?nickColor[0]-100:nickColor[0]; nickColor[1] = nickColor[1]>200?nickColor[1]-100:nickColor[1]; nickColor[2] = nickColor[2]>200?nickColor[2]-100:nickColor[2]; nickColor = 'rgb('+nickColor[0]+','+nickColor[1]+','+nickColor[2]+')'; return '<a href="/wiki/Special:Contributions/'+encodeURIComponent(this.innerHTML.replace(/ ?<img[^>]*>/i,''))+'" class="username" style="color:'+nickColor+';font-weight:bold;">'+this.innerHTML+'</a>' }) } } onchatmessage = function(text, rawtext) {	setTimeout(colorNickNames, 20)	text = text.replace('<img src="http://i.imgur.com/DexQI.png" width="19" height="19"', '<img src="http://images2.wikia.nocookie.net/runescape/images/d/de/Quick_chat_button.png" width="13" height="10"')	return text; //DO NOT EDIT THIS LINE } function pad(n) {//Function to pad the timestamps with zeroes where needed	return (n<10?'0':'') + n; } function markAdmins {	$('.WikiChatList .User.chat-mod .username').each(function { if (!this.innerHTML.match(/N7 Elite|Casting Fishes\^\^|Cåm|Hairrazerrr|Hofmic|Haidro|Flaysian|Smithing|Touhou FTW|Vulpes Twigy/)) { $(this).addClass('admin'); }	}); } function markBots {       $('.WikiChatList .User .username').each(function { if (this.innerHTML.match(/RSChatBot/)) { $(this).addClass('bot'); }        }); } function markVstf {        $('.WikiChatList .User .username').each(function { if (this.innerHTML.match(/Deltaneos|Eulalia459678|Nifky|Ohmyn1|Randomtime|Rappy 4187|Sactage|Sulfur|VegaDark/)) { $(this).addClass('vstf'); }         }); } setInterval(markAdmins, 1000) setInterval(markBots, 1000) setInterval(markVstf, 1000) //Switch to irc button var irc_button = 'IRC Chat'; //Switch to citadel button var citadel_button = 'Citadel Chat'; // Start Function function addcitadelircButton{ var citadelircButton = document.createElement('div'); $('<div class="citadel-irc-div" onclick="switch_view" style="margin: 10px auto; text-align: center; cursor: pointer;"><a class="citadel-irc-button wikia-button">'+irc_button+'</a> ').prependTo('.Rail'); } function citadel_irc{ var styleElement = document.createElement('style'); styleElement.setAttribute("id", "irc"); styleElement.innerHTML='.WikiaPage{background:#FFFFFF;left:0px;right:0px;-webkit-box-shadow:0px 0px 0px #FFFFFF;border-right:1px solid transparent;border-left:1px solid transparent;border-bottom:1px solid transparent;border-top:1px solid black;bottom:0px;} .ChatHeader{background:#FFFFFF;border:1px solid black;-webkit-box-shadow:0px 0px 0px #FFFFFF;height:53px;margin:0px;position:relative;} .wordmark img {display:none;} a.wikia-button, .wikia-single-button a, .wikia-menu-button, input[type="submit"], input[type="reset"], input[type="button"], button, button {-webkit-border-radius:4px;background-color:lightgray;border:1px solid transparent;color:black;background-image:none;font-weight:bold;} .UserStatsMenu {background:#F2F2F2;border:2px solid black;} .UserStatsMenu .info {background:black;border:2px solid black;} .UserStatsMenu .actions li {border-top:1px solid black;} .Write {padding-left:2px;} body {background:white;}.Rail .selected {display:none;}.Chat li {font-family:consolas;color:#000;}.Chat >ul> li {padding:0px;margin:0px !important;margin-right:0px !important;position:static;min-height:0px;}.Chat .avatar {float:right;left:auto;right:10px;top:auto;}.Chat .time {display:inline;float:none;color:inherit;}.Chat .time:before {content:"[";}.Chat .time:after {content:"]";}.Chat .username {display:inline;font-weight:normal;}.Chat .username:before {content:"<";color:#000;text-decoration:none;}.Chat .username.chat-mod:before {content:"<@";} .Chat .username:after {content:">";color:#000;text-decoration:none;}.Chat .continued .time, .Chat .continued .username {display:inline;}.Chat li img {height:15px;width:15px;}.Chat .inline-alert {text-align:left;padding:0px;}.Chat .inline-alert:before {content:"== ";margin-left:50px;}.Chat .inline-alert:after {content:"";}.Chat a:not(.username) {color:#002BB8;text-decoration:underline;}.Chat a:not(.username):visited {color:#5A3696;}.Chat a:not(.username):active {color:#FAA700;content:" |Away"}.Chat a:not(.username):active:after{content:" | "}.Rail .User img {display: none;}#WikiChatList > li {padding: 1px;}.Write img {display: none;}.User.away .status:before {content:" | ";}.User.away. status:after {content:"";}.ChatHeader .User img {display: none;}.User.chat-mod .username:before {content:"@"} .User.chat-mod .username.admin:before {content:"&";}.User.chat-mod .username.bot:before {content:"+";}.User.chat-mod.staff .username:before { content:"#";}.User.chat-mod .username:after {content:"";}.User.chat-mod .username.admin:after{content:"";}.User.chat-mod.staff .username:after{content:"";}.Chat .avatar {display:none;}.User.chat-mod .username {float:left;}.User .username {float:left;}.User .details {padding-left: 2px;}.Rail .private {background: transparent;background-image: transparent;border-top:1px solid black;border-bottom:none;ffont-size:0px;}.Chat {border-right: 1px solid gray;border-bottom: 1px solid gray;} .Chat .you {background:#D9D9D9;border:none;} .wikia-menu-button ul a:hover{background-color:#D9D9D9;} .headerthings {display:none;} .User .username:after {display:none;} #WatchlistNotify {display:none;} .username {display:block;} a[href="/wiki/Special:Contributions/RSChatBot"]:before {content:"+";}'; $('head').append(styleElement); } function switch_view{ if ($('.Rail .citadel-irc-div .citadel-irc-button').text == irc_button){ $('.Rail .citadel-irc-button').text(citadel_button); citadel_irc; }else{ $('.Rail .citadel-irc-div .citadel-irc-button').text(irc_button); $('style#irc').remove } } if ($('.Rail .citadel-irc-button').text == ""){ addcitadelircButton; } while ($('.Rail .citadel-irc-div').size > 1){ $('.WikiaPage .Rail div:last-child').remove }