View Single Post
Old 12-04-2012, 12:28 AM   PM User | #8
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,452
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>terminal</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="description" content="" />
	<meta name="keywords" content="" />
	<meta name="author" content="dandavis" />
<style type='text/css'>
	:Focus { outline: none; }
	body, html { margin: 0px; padding: 0px; color: #fff; background-color: #111; font-family: georgia;}
	textarea, input { color: #bfb; background: #111; font-family: 'Lucida Console', monospace;  padding: 0;
				width: 98%;  margin: 1em; border: 1px solid #000; overflow: hidden; }
	
</style>	
</head>
	<body>
  




<textarea rows='40' cols='110' id='view' ></textarea>	
  

<form onsubmit="render(line.value); return false;">
  
	<datalist id='hist'></datalist>

  <input value='Object.keys(window)' type='text'  id='line'  autofocus tabindex=1 list='hist' />	
</form>



<script type='text/javascript'>

commands={

 cls: 	function cls(){ setTimeout("view.value='';",0); },
 date:	function(){return new Date().toISOString(); }
 
}


commands.ls=Object.keys.bind(Object, commands);



function propToMethod(){


}


function render(code){
	hist.appendChild(new Option(code));
	var rez="";
	try{ 
			rez=eval("with(commands){"+(code||'')+"}");
		
	}catch(y){
		rez=y;
	}
		
	if(typeof rez==='function'){ rez=rez();}
	view.value+="\n\n JS:>"+ code+"\n" +  JSON.stringify(rez, null, "\t")+"\n";
	if(view.value.length>5000){ view.value=view.value.slice(-5000); }
	view.scrollTop=9e9;
	line.select();
	line.focus();
}



window.onload=render(render+"; 'ready!' ");

</script>
</body>
</html>
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.8% IE9:11.4% IE10:6.5%
rnd me is offline   Reply With Quote