Thread:Neptune7Ninja2Comics/@comment-39395956-20190525141726/@comment-39017287-20190531183506

$('body').mouseup(function{ $('.output').height($('textarea').height); $('.output').height($('textarea').height); });

$.fn.selectRange = function(start, end){ if(!end) end = start; return this.each(function{      if (this.setSelectionRange) {          this.focus;          this.setSelectionRange(start, end);      } else if (this.createTextRange) {          var range = this.createTextRange;          range.collapse(true);          range.moveEnd('character', end);          range.moveStart('character', start);          range.select;      }  }); };

$('.bgs div').click(function(elem){ $('.output').css('background', $(elem.target).css('background')); $('.bgs div').css('border',0); $(elem.target).css('border', '3px #aaa solid'); });

var motd_raw = $('.editor textarea'); $('.tools button').click(function(e){ var caretPos = motd_raw[0].selectionStart; var textAreaTxt = motd_raw.val; var txtToAdd = '&' + $(this).attr('data-color'); console.log(caretPos); motd_raw.val(textAreaTxt.substring(0, caretPos) + txtToAdd + textAreaTxt.substring(caretPos)).focus; motd_raw.selectRange(caretPos + 2); colour(motd_raw.val); });

function colour (text) { left = htmlEncode("<"); right = htmlEncode(">"); text = text.replace(//gi, right); text = text.replace(/\n/gi, "&r "); //colours text = text.replace(/&0/gi,' &r '); text = text.replace(/&1/gi,' &r '); text = text.replace(/&2/gi,' &r '); text = text.replace(/&3/gi,' &r '); text = text.replace(/&4/gi,' &r '); text = text.replace(/&5/gi,' &r '); text = text.replace(/&6/gi,' &r '); text = text.replace(/&7/gi,' &r '); text = text.replace(/&8/gi,' &r '); text = text.replace(/&9/gi,' &r '); text = text.replace(/&a/gi,' &r '); text = text.replace(/&b/gi,' &r '); text = text.replace(/&c/gi,' &r '); text = text.replace(/&d/gi,' &r '); text = text.replace(/&e/gi,' &r '); text = text.replace(/&f/gi,' &r '); //bold text = text.replace(/&l/gi," "); //italic text = text.replace(/&o/gi," "); //strikethrough text = text.replace(/&m/gi," "); //underlined text = text.replace(/&n/gi," "); //obfuscated text = text.replace(/&k/gi," "); //reset text = text.replace(/&r/gi, "                                       "); document.getElementById('output').innerHTML=text;

}

setInterval(function { $('.obfuscated').text(randomizer($('.obfuscated').text)); }, 100);

function htmlEncode(value){ return $(' ').text(value).html; }

function randomizer(rawr) { var length = rawr.length; var text = ''; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

for( var i=0; i < length; i++ ) text += possible.charAt(Math.floor(Math.random * possible.length));

return text; }