MediaWiki:Chat.js

/* chat entrance policy agreement */ /*	alerts a message that asks the user to confirm that he \/ she have read the wiki's policy and agree to follow the rules. reset every 2 months or when the user is kicked \/ banned // set \/ check Widget Widget = typeof Widget === "undefined" ? {} : Widget; // create object for the warning widget Widget.policyWarning = {}; // markup Widget.policyWarning.markup = ' \n\ \n\ \t<div style=\"width: 370px; margin: auto; padding: 3px 7px; background: #f6f6f6; background: -moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(47%,#f6f6f6), color-stop(100%,#ededed)); background: -webkit-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); background: -o-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); background: -ms-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%); background: linear-gradient(to bottom, #ffffff 0%,#f6f6f6 47%,#ededed 100%); border: 1px solid #cccccc; border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px;\">\n\ \t\tPlease read carefully before proceeding!  \n\ \t\t\n\ \t\t\tBy entering chat, you agree to follow the Lab Rats Wiki\'s policy and its guidelines. \n\ \t\t\t\n\ \t\t \n\ \t \n\ '; // do this when pressing "agree" Widget.policyWarning.agree = function { if (confirm("I've read the policy and promise to follow the wiki's rules") === true) { // agree - close notice and disable message for the next 60 days setCookie("chatPolicy", "agree", 60); $('#policy-notice-blackout, #policy-notice').remove; Widget.policyWarning.clear; } else { // disagree - close window and try again later window.close; } } // trigger if (typeof getCookie("chatPolicy") !== "string") { $("body").append(Widget.policyWarning.markup); } // reset if the user is kicked\/banned Widget.policyWarning.clear = function { var userName = mw.config.get("wgUserName"); mainRoom.socket.on("kick", function(msg) {		var data = JSON.parse(msg.data);		if (data.kickedUserName == userName) {			document.cookie = "chatPolicy" + "=; expires=Thu, 01-Jan-70 00:00:01 GMT;";		}	}); } $(function {	if (typeof getCookie("chatPolicy") === "string") {		Widget.policyWarning.clear;	} });

importScriptPage('MediaWiki:ChatTags/code.js', 'shining-armor'); importScriptPage('ChatOptions/code.js', 'dev'); importScriptPage('MediaWiki:ChatTags/code.js', 'shining-armor');