Community Central
Community Central

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
var faces = [
    ["( ≖‿≖)", "( ≖⁔≖)"],
    ["( ͡° ͜ʖ ͡°)", "٩(͡๏̯͡๏)۶"],
    ["ಠ_ಠ"]
];

/////////////////////////////////////////////////////////////////////////////////////////

var facesTable = "";
for(var i=0; i<faces.length; i++) {
    facesTable += "<tr>";
    for(var j=0; j<faces[i].length; j++){
        facesTable += '<td style="padding:3px;width:50%;">'+faces[i][j]+'</td>';
    }
    facesTable += "</tr>";
}

$('form#Write').append('<a class="wikia-button" href="javascript:toggleFaces()" style="position:absolute; right:95px; top:0;">Faces</a>');
$("body").append('<table id="faces" border="1" style="position: fixed; bottom: 70px; right: 200px; background: white; text-align: center; display: none;">' + facesTable + '</table>');

function toggleFaces() { $("table#faces").toggle(); }

var inputbox = '#Write textarea[name="message"]';
function inputboxAppend(s){
	var inputboxVal = $(inputbox).val();
	if ( inputboxVal != '' ) {
		if ( inputboxVal[inputboxVal.length-1] != " " ) {
			var val = inputboxVal + ' ' + s;
		} else {
			var val = inputboxVal + s;
		}
		$(inputbox).val('');
	} else {
		var val = s;
	}
	$(inputbox).focus(); // set focus on the input box
	$(inputbox).val(val); // apply the new value
}

$('table#faces td').click(function(){
    inputboxAppend($(this).html());
});
appendCSS('table#faces td { cursor: pointer !important; }');