Advertisement
Guest User

Untitled

a guest
Dec 27th, 2016
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.41 KB | None | 0 0
  1. <html>
  2.   <body onload="document.getElementById('button').style.top=Math.round (Math.random()*200);document.getElementById('button').style.left=Math.round (Math.random()*200);">
  3.   <div id="button" style="position: absolute; background-color: red; width: 50; height: 50;" onclick="createlevel(this);" >s</div>
  4.   <div style="width: 200px; height: 500px; background: rgba(0,0,0,0.5); display:none; position: fixed; top: 10px; left: 20px; " id="sharp"> </div>
  5.   <style>
  6.   .mainOL {
  7.     padding-left : 20px;
  8.     list-style-type: none;
  9.   }
  10.   .list {
  11.     color: black;
  12.     padding: 3px;
  13.     margin-right: 20px;
  14.     font-size: 18;
  15.   }
  16.   .list:hover {
  17.     background: rgba(0,0,0,0.2);
  18.   }
  19.   </style>
  20.   <script>
  21.   window.pcts = [{"text" : "nts"} , {"text" : "nt2s"}];
  22.   window.CMPATCH = [];
  23.     function createpunct () {
  24.         var mainOL = document.createElement ("ol");
  25.         mainOL.className = "mainOL";
  26.         var mainDIV = document.getElementById('sharp');
  27.         mainDIV.appendChild(mainOL);
  28.        
  29.         window.pcts.forEach (function (i , key) {
  30.             var li = document.createElement ("li");
  31.             li.innerHTML = i.text;
  32.             li.className = "list";
  33.             mainOL.appendChild (li);
  34.         });
  35.     }
  36.   window.iOPEN = false;
  37.   document.addEventListener ("keyup" , function (e) {
  38.     if (window.event.key=="Shift" )
  39.         sharchange (false);
  40.   });
  41.   document.addEventListener ("keydown" , function (e) {
  42.     if (window.event.key=="Shift")
  43.         sharchange (true);
  44.     if (window.event.key=="F7")
  45.         sharchange ("rev");
  46.   });
  47.  
  48.   document.addEventListener ("click" , function (e) {
  49.     if (window.CMPATCH.length==0)
  50.         return;
  51.     //e.path.forEach (function (i , key) {
  52.     for (var i = 0 ; e.path[i]!=null ; i++) {
  53.         if (e.path[i].is_cm==true) {
  54.             //window.CMPATCH.forEach (function (c , k) {
  55.             for (var c = 0 ; window.CMPATCH[c]!=null ; c++) {
  56.                 if (window.CMPATCH[c]==e.path[i]) {
  57.                    
  58.                     if (window.CMPATCH[c+1]!=null) {
  59.                         window.CMPATCH[c+1].remove();
  60.                         window.CMPATCH.splice (c+1 , 9999999)
  61.                     }
  62.                     return;
  63.                 }
  64.             };
  65.         }
  66.        
  67.     };
  68.  
  69.     if (e.timeStamp!=window.CMPATCH[0].timeStamp) {
  70.         window.CMPATCH[0].creator.cOPEN = false;
  71.         window.CMPATCH[0].remove();
  72.         window.CMPATCH = [];
  73.     }
  74.   });
  75.  
  76.  
  77.   function createlevel(el) {
  78.     if (el.cOPEN)
  79.       return;
  80.     var mainDIV = document.createElement ("div");
  81.     mainDIV.style.position = "absolute";
  82.     mainDIV.style.top = window.event.pageY;
  83.     mainDIV.style.left = window.event.pageX;
  84.     mainDIV.style.width = "200";
  85.     mainDIV.style.height = "300";
  86.     mainDIV.style.zIndex = "300";
  87.     mainDIV.creator = el;
  88.     mainDIV.is_cm = true;
  89.     mainDIV.timeStamp = window.event.timeStamp;
  90.    
  91.     //mainDIV.id = "ol";
  92.     mainDIV.onclick = function () {createlevel(this);};
  93.     mainDIV.style.background = "blue";
  94.     document.body.appendChild (mainDIV);
  95.     console.debug (mainDIV);
  96.     el.cOPEN = true;
  97.     window.CMPATCH[window.CMPATCH.length] = mainDIV;
  98.   }
  99.    
  100.   function sharchange (state) {
  101.     if (state==true) {
  102.         document.getElementById ("sharp").style.display='';
  103.      } else if (state==false && window.menulock!=true) {
  104.        document.getElementById ("sharp").style.display='none';
  105.      } else if (state=="rev") {
  106.         if (document.getElementById ("sharp").style.display == "none") {
  107.             window.menulock = true;
  108.             document.getElementById ("sharp").style.display='';
  109.         } else {
  110.             window.menulock = false;
  111.             document.getElementById ("sharp").style.display='none';
  112.         }
  113.     }
  114.   }
  115.        
  116.   </script>
  117.  
  118.   </body>
  119. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement