User:MlgMumbleThePenguin/chat.js

/* */ // Set initial skin setTimeout(function { 	if($.cookie('skinType')=='normal') {		goNormal;	} else if($.cookie('skinType')=='fall') {		goFall;	} else if($.cookie('skinType')=='summer') {		goSummer;	} else if($.cookie('skinType')=='night') {		goNight;	} else if($.cookie('skinType')=='winter') {		goWinter;	} else if($.cookie('skinType')=='left') {		goLeft;	} }, 1000); console.log("Chat skins intitialized."); inlineAlert("Commands: /fall, /left, /valentines /normal, /more, /less"); $('.ChatWindow').attr('id','ChatWindow'); // Variable delcarations var fallCss = ''; var valentinesCss = ''; var leftCss = ''; var roundCss = ''; var summerCss = ''; var winterCss = ''; var nightCss = ''; var skinType = 'normal'; // Chat commands $('#Write textarea').keydown(function(e) {	if( $('#Write textarea').val == "/more" && e.keyCode == 13 && skinType != 'normal' ) {		unKey(this);		handleSnow(true);	} else if( $('#Write textarea').val == "/less" && e.keyCode == 13 && skinType != 'normal' ) {		unKey(this);		handleSnow(false);	} else if( $('#Write textarea').val == "/fall" && e.keyCode == 13 ) {		unKey(this);		if(skinType != 'fall') {			goFall;		} else {			goNormal;		}	} else if( $('#Write textarea').val == "/normal" && e.keyCode == 13 ) {		unKey(this);		goNormal;	} else if( $('#Write textarea').val == "/left" && e.keyCode == 13 ) {		unKey(this);		if(skinType != 'left') {			goLeft;		} else {			goNormal;		}       } else if( $('#Write textarea').val == "/normal" && e.keyCode == 13 ) {		unKey(this);		goNormal;	} else if( $('#Write textarea').val == "/summer" && e.keyCode == 13 ) {		unKey(this);		if(skinType != 'summer') { goSummer; } else { goNormal; }	} else if( $('#Write textarea').val == "/normal" && e.keyCode == 13 ) { unKey(this); goNormal; } else if( $('#Write textarea').val == "/winter" && e.keyCode == 13 ) { unKey(this); if(skinType != 'winter') { goWinter; } else { goNormal; }	} else if( $('#Write textarea').val == "/normal" && e.keyCode == 13 ) { unKey(this); goNormal; } else if( $('#Write textarea').val == "/night" && e.keyCode == 13 ) { unKey(this); if(skinType != 'winter') { goNight; } else { goNormal; }	} else if( $('#Write textarea').val == "/normal" && e.keyCode == 13 ) { unKey(this); goNormal; } else if( $('#Write textarea').val == "/valentines" && e.keyCode == 13 ) { unKey(this); if(skinType != 'valentines') { goValentines; } else { goNormal; }	} }); // Prevent message from sending function unKey(that) {	$(that).unbind('keypress').val(''); } // Inline alerts function inlineAlert(text) {	mainRoom.model.chats.add(new models.InlineAlert( {text:(text)} )); } // Switch to normal skin function goNormal {	skinType = 'normal';	totalSnow = 0;	defaultSnow = 0;	$('#skinBackground').remove;	$('#ChatSkins').remove;	$.cookie('skinType','normal',{expires: 5}); } // Switch to fall skin function goFall {	clearOld;	skinType = 'fall';	defaultSnow = 20;	snowLeft = 25;	$('.ChatWindow').prepend(' ');	$('head').append(fallCss);	createSnow(20);	$.cookie('skinType','fall',{expires: 5}); } // Switch to night skin function goNight {	clearOld;	skinType = 'night';	defaultSnow = 20;	snowLeft = 25;	$('.ChatWindow').prepend('  ');	$('head').append(nightCss);	createSnow(20);	$.cookie('skinType','night',{expires: 5}); } // Switch to summer skin function goSummer { clearOld; skinType = 'fall'; defaultSnow = 20; snowLeft = 25; $('.ChatWindow').prepend(' '); $('head').append(summerCss); createSnow(20); $.cookie('skinType','summer',{expires: 5}); } // Switch to left skin function goLeft { clearOld; skinType = 'left'; defaultSnow = 50; snowLeft = 0; $('.ChatWindow').prepend('  '); $('head').append(roundCss); $('head').append(leftCss); createSnow(50); $.cookie('skinType','left',{expires: 5}); } // Switch to winter skin function goWinter { clearOld; skinType = 'winter'; defaultSnow = 50; snowLeft = 0; $('.ChatWindow').prepend('  '); $('head').append(winterCss); createSnow(50); $.cookie('skinType','winter',{expires: 5}); } // Reset page for new skin function clearOld { totalSnow = 0; $('#skinBackground').remove; $('#ChatSkins').remove; $('#ChatSkinsAdditional').remove; }