User:Benjaminthewill123123/style.js

function setCookie( cookie_name, data ) { var domain = wgServer.split("//")[1]; document.cookie = cookie_name + "=" + data + "; max-age=" + 60*60*24*150 + "; path=/; domain=" + domain; } function getCookie( cookie_name, pos ) { var x, y, cookie_array = document.cookie.split(";"); for (var i=0; i < cookie_array.length; i++) { x = cookie_array[i].substr(0,cookie_array[i].indexOf("=")); y = cookie_array[i].substr(cookie_array[i].indexOf("=")+1); x = x.replace(/^\s+|\s+$/g,""); if (x == cookie_name) { var style_objects = y.split(", "); return unescape(style_objects[pos]); }	} } var chatOptions = { look: { fontColor: getCookie("customisation", 1), fontFamily: getCookie("customisation", 3), surroundColor: getCookie("customisation", 10), selfPostColor: getCookie("customisation", 11), backgroundColor: getCookie("customisation", 0), modalIcon: "http://www.derehamreclaim.co.uk/_images-pages/icon-hammerSpanner.jpg" }

function updateChatSkin { $('body').css({"background-color":chatOptions.look.surroundColor}); $('.WikiaPage').css({"background-color":chatOptions.look.backgroundColor, "color":chatOptions.look.fontColor, "font-family":chatOptions.look.fontFamily}); $('.Chat').css({"font-family":chatOptions.look.fontFamily}); $('.Rail').css({"font-family":chatOptions.look.fontFamily}); $('.ChatHeader').css({"background-color":chatOptions.look.backgroundColor, "font-family":chatOptions.look.fontFamily}); var selfPostElement = document.createElement('style'); selfPostElement.innerHTML = '.Chat .you{background:' + chatOptions.look.selfPostColor + ' !important;}'; $('head').append(selfPostElement); $('.Write [name="message"]').css({"color":chatOptions.look.fontColor}); $('.Write .message').css({"background-color":chatOptions.look.backgroundColor}); $('.ChatHeader .User .username').css({"color":chatOptions.look.fontColor}); }	} } function openOptions { // TODO: Kill this with fire? There has to be a better way to do this - perhaps use $.showModal var $optionsWindowHTML = $.showCustomModal( "Options", ' Colour changes Enter a colour name or colour hex Chat background   Self-post background    Surround    Font colour   Font  Font family Arial Courier new Georgia <option value="palatino linotype" style="font-family:palatino linotype;">Palatino linotype <option value="Comic Sans MS" style="font-family:Comic Sans MS;">Comic sans <option value="tahoma" style="font-family:tahoma;">Tahoma <option value="Trebuchet MS" style="font-family:Trebuchet MS;">Trebuchet MS <option value="Verdana" style="font-family:Verdana;">Verdana <option value="Lucida Console" style="font-family:Lucida Console;">Lucida Console   <p style="font-size:120%; font-weight:bold; font-style:italic;">Added functionality <input type="checkbox" name="chatHacks" value="chatHacks" id="chatHacks"/> Enable chathacks</a>    <input type="checkbox" name="multiPM" value="multiPM" id="multiPM"/> Enable multi PM</a> <input type="checkbox" name="tabComplete" value="tabComplete" id="tabComplete"/>Enable tab complete</a>   <input type="checkbox" name="searchBar" value="searchBar" id="searchBar"/>Enable search bar</a> <input type="checkbox" name="multiKick" value="multiKick" id="multiKick" />Enable multi kick</a>    <input type="checkbox" name="ignoreURL" value="ignoreURL" id="ignoreURL"/>Ignore URL in main chat <input type="checkbox" name="stopSideScroll" value="stopSideScroll" id="stopSideScroll"/>Stop the sidescroll bar to appear after someone spams ', { id: "optionsWindow", width: 600, buttons: [ {			id: "cancel", message: "Cancel", handler: function { cancelChanges; }		},		   {			    id: "updateCookie", defaultButton: true, message: "Update!", handler: function { updateCookie; }	   }	]	});	$(".close").click(cancelChanges); function cancelChanges {	$('#optionsWindow').remove;	$('.blackout').remove; function updateCookie {	chatOptions.look.backgroundColor = $('#backgroundColourinput').val;	chatOptions.look.fontColor = $('#fontColourinput').val;	chatOptions.look.fontFamily = $('#fontList').val;	chatOptions.look.surroundColor = $('#surroundColourinput').val;     chatOptions.look.selfPostColor = $('#selfPostColourinput').val;	for (var m in chatOptions.modules) {		if ( chatOptions.modules.hasOwnProperty( m ) ) {			var module = chatOptions.modules[m];			if (typeof module.element != 'undefined' && $(module.element).attr("checked")) {				module.enabled = true;			} else {				module.enabled = false;			}		}	} setCookie("customisation", chatOptions.look.backgroundColor + ", " + chatOptions.look.fontColor + ", " + chatOptions.modules.chatHacks.enabled + ", " + chatOptions.look.fontFamily + ", " + chatOptions.modules.tabComplete.enabled + ", " +  chatOptions.modules.multiKick.enabled + ", " + chatOptions.modules.multiPM.enabled + ", " + chatOptions.modules.searchBar.enabled + ", " + chatOptions.modules.ignoreURL.enabled + ", " + chatOptions.modules.stopSideScroll.enabled + ", " + chatOptions.look.surroundColor + ", " + chatOptions.look.selfPostColor); updateChatSkin; cancelChanges; } if (!$("#chatOptionsButton").length) { $('.Rail').prepend('<div id="chatOptionsButton" onclick="openOptions;" style="margin:auto; cursor: pointer; font-size:150%; bottom:4px; padding-bottom:2px; border-bottom: 1px solid #CCCCCC; width:90%;" align="center"><img src="' + chatOptions.look.modalIcon + '" width="18px"/> Options '); } window.onload = updateChatSkin;