/* Client-side logic for Wordpress CLI theme R. McFarland, 2006, 2007, 2008 http://thrind.xamai.ca/ jQuery rewrite and overhaul Chromakode, 2010 http://www.chromakode.com/ */ /**** start from http://snippets.dzone.com/posts/show/701 ****/ // Removes leading whitespaces function ltrim(value) { if (value) { var re = /\s*((\S+\s*)*)/; return value.replace(re, '$1'); } return ''; } // Removes ending whitespaces function rtrim(value) { if (value) { var re = /((\s*\S+)*)\s*/; return value.replace(re, '$1'); } return ''; } // Removes leading and ending whitespaces function trim(value) { if (value) { return ltrim(rtrim(value)); } return ''; } /**** end from http://snippets.dzone.com/posts/show/701 ****/ function entityEncode(str) { str = str.replace(/&/g, '&'); str = str.replace(//g, '>'); str = str.replace(/ /g, '  '); if (/msie/i.test(navigator.userAgent)) { str = str.replace('\n', ' 
'); } else { str = str.replace(/\x0D/g, ' 
'); } return str; } var TerminalShell = { commands: { help: function help(terminal) { terminal.print($('

help

')); cmd_list = $('