MediaWiki:Chat.js/ChatOptions.js

/*  Font Font family  Arial Courier new Georgia Palatino linotype Comic sans Tahoma Trebuchet MS Verdana Lucida Console  Added functionality Enable chathacks     Enable multi PM <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 <input type="checkbox" name="notifications" value="notifications" id="notifications" />Enable notifications <input type="checkbox" name="ping" value="ping" id="ping" />Enable ping on every message <input type="checkbox" name="chatlogger" value="chatlogger" id="chatlogger" />Chatlogger ', { id: "optionsWindow", width: 600, buttons: [ {			id: "cancel", message: "Cancel", handler: function { cancelChanges; }		},		{			id: "updateCookie", defaultButton: true, message: "Update!", handler: function { updateCookie; }	   }		]	});	$(".close").click(cancelChanges);	// Check if various modules have been enabled by the user, and check their boxes if so	if (chatOptions.modules.chatHacks.enabled)		$("#chatHacks").attr("checked",true);	if (chatOptions.modules.multiPM.enabled)		$("#multiPM").attr("checked",true);	if (chatOptions.modules.tabComplete.enabled)		$("#tabComplete").attr("checked",true);	if (chatOptions.modules.searchBar.enabled)		$("#searchBar").attr("checked",true);	if (chatOptions.modules.multiKick.enabled)		$("#multiKick").attr("checked",true);	if (chatOptions.modules.ignoreURL.enabled)		$("#ignoreURL").attr("checked",true);	if (chatOptions.modules.stopSideScroll.enabled)		$("#stopSideScroll").attr("checked",true);	if (chatOptions.modules.notifications.enabled)		$("#notifications").attr("checked",true);	if (chatOptions.modules.ping.enabled)		$("#ping").attr("checked",true);	if (chatOptions.modules.chatlogger.enabled) $("#chatlogger").attr("checked",true); if (typeof window.customFonts !== "undefined" && window.customFonts.length) { for (var i = 0; i < window.customFonts.length; i++) { var font = window.customFonts[i]; $("#fontList").append('<option value="' + font+ '" style="font-family:' + font + ';">' + font.slice(0,1).toUpperCase + font.slice(1) + ' '); }	}	// Set certain modules' checkboxes to disabled if specific conditions are not met if (!wgUserGroups.indexOf("chatmoderator") && !wgUserGroups.indexOf("sysop") && !wgUserGroups.indexOf("staff") && !wgUserGroups.indexOf("helper") && !wgUserGroups.indexOf("vstf")) $("#multiKick").attr("disabled",true); $("select option[value='" + chatOptions.look.fontFamily + "']").attr("selected","selected"); // sets the font selector to the one chosen currently }

/** * Close the options window without saving any changes */ function cancelChanges { var dialog = $('#optionsWindow'); dialog.closeModal; } /** * Saves user options and stores them in a cookie for persistence across sessions */ 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; }		}	}	// Set the cookies 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 +", "+ chatOptions.modules.notifications.enabled+", "+ chatOptions.modules.ping.enabled +", "+ chatOptions.modules.chatlogger.enabled); updateChatSkin; cancelChanges; }

// Add Options button if (!$("#chatOptionsButton").length) { $('#ChatHeader h1').append('<span id="chatOptionsButton" onclick="openOptions;">Options '); // Prevent multiple buttons from being appended }

window.onload = updateChatSkin;