Advertisement
Guest User

pureoriginsnaturefriend

a guest
Jun 18th, 2016
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 3.99 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script>
  4. var bodyEl=null;
  5. var windows=new Array();
  6. function _promptCallback(content){
  7.     console.log(content);
  8.     if(content===null || content=="exit") return;
  9.    
  10.     var args=content.split(" ");
  11.     console.log(args.length);
  12.     switch(args[0]){
  13.         case "new":
  14.             switch(args[1]){
  15.                 case "window":
  16.                     var divEl=document.createElement("div");
  17.                     divEl.setAttribute("style","border:1px solid black;padding:2px;position:fixed;display:block;top:"+(parseInt((window.innerHeight-300)*Math.random())).toString()+"px;left:"+(parseInt((window.innerWidth-400)*Math.random())).toString()+"px;width:400px;height:300px;background-color:white");
  18.                     var iframeEl=document.createElement("iframe");
  19.                     iframeEl.setAttribute("style","width:396px;height:296px;border:0 none;");                  
  20.                     iframeEl.addEventListener("load",(function(iframeEl,content,args){return function(){
  21.                     console.log(iframeEl.contentDocument.body.setAttribute);
  22.                                         iframeEl.contentDocument.body.setAttribute("style","background-color:white;border:0 none;padding:0;margin:0");
  23.                                         switch(args[2]){
  24.                                             case "text":
  25.                                                 var txtEl=iframeEl.contentDocument.createElement("textarea");
  26.                                                 txtEl.setAttribute("style","display:inline-block;width:383px;height:290px;border:0 none");
  27.                                                 if(args[3]=="fill" && args[4]=="content" && args[5]=="line")
  28.                                                 if(typeof(args[6])=="string"){
  29.                                                     var endPos=content.indexOf(args[5])+args[5].length+1;
  30.                                                     txtEl.value=(content.substr(endPos,content.length-endPos)).replace(/[ ]+/g,"\n");
  31.                                                 }
  32.                                                 iframeEl.contentDocument.body.appendChild(txtEl);
  33.                                                 break;
  34.                                             case "graphics":
  35.                                                 var canvasEl=iframeEl.contentDocument.createElement("canvas");
  36.                                                 canvasEl.setAttribute("style","width:396px;height:296px");
  37.                                                 var ctx=canvasEl.getContext("2d");
  38.                                                 if(args[3]=="draw" && args[4]=="line"){
  39.                                                 console.log("1");
  40.                                                     ctx.beginPath();
  41.                                                     ctx.strokeStyle="black";
  42.                                                     ctx.moveTo(parseInt(args[5]),parseInt(args[6]));
  43.                                                     ctx.lineTo(parseInt(args[7]),parseInt(args[8]));
  44.                                                     ctx.stroke();
  45.                                                 }
  46.                                                 iframeEl.contentDocument.body.appendChild(canvasEl);
  47.                                                 break;
  48.                                         }
  49.                    
  50.                     }})(iframeEl,content,args));
  51.                    
  52.                     divEl.appendChild(iframeEl);
  53.                     bodyEl.appendChild(divEl);
  54.                     break;
  55.             }
  56.             break;
  57.         default:
  58.             eval(content);
  59.             break;
  60.     }
  61.     _prompt();
  62. }
  63.  
  64. function _prompt(){
  65.     var content=prompt('Do | options: new window text fill content line | new window graphics draw line 20 20 200 200 | exit, | option text append: natural sources origins personal whole perspective habitat beings behaviour water level equilibrated original birth healthy sane groups of people and identities associations values main singular one all pure good healthy life of emotion energy life self criativity freedom of criativity and forms of happiness origins presence NOW present identity freedom habitat friend infinite nature origins energy equality image reflection surroundings feelings presence night warm feelings spirits form energy pure natural being to being manifestation emantion friendly presence friend is to think to have intelligence a bad think should it be dont make trouble to not be trouble be water my friend presence NOW happiness total freedom friendly environment habitat being a calm being dont be trouble my friend vivid colorful rainbow all other beings have a life too and a path and a encounter and discover of a spiritual being tale path life experience self identity presence entire and with all others better idea happiness NOW kinds beings no being wants to be bad for any other beings by life happiness perspective be ok with other no trouble', "new window text");
  66.     _promptCallback(content);
  67. }
  68. function _onLoad(){
  69.     bodyEl=document.body;
  70.     _prompt();
  71.    
  72. }
  73. </script>
  74. </head>
  75. <body onload="_onLoad()"><a href="#" onclick="javascript:_prompt();return false;">Do</a></body>
  76. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement