User:Snowstormer/chat.js

// ( ≖‿≖) $('form#Write').append('( ≖‿≖)'); // add button var inputbox = '#Write textarea[name="message"]'; function face{ var inputboxVal = $(inputbox).val; if ( inputboxVal != '' ) { // if the input box isn't empty if ( inputboxVal[inputboxVal.length-1] != " " ) { // if the last character isn't a space var val = inputboxVal + ' ( ≖‿≖)'; // set the new value to the old one + a space and the face } else { var val = inputboxVal + '( ≖‿≖)'; // otherwise, add just the face }		$(inputbox).val(''); // clear the input box } else { var val = '( ≖‿≖)'; // if the input box is empty, set the new value to the face }	$(inputbox).focus; // set focus on the input box $(inputbox).val(val); // apply the new value }