Advertisement
Guest User

qqqqqqqqqqqqqq

a guest
Jun 20th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4. <style>
  5. .menu {
  6. background-color: #ffffff;
  7. padding-top: 3px;
  8. padding-bottom: 3px;
  9. border-width: 1px;
  10. border-style: solid;
  11. border-color: #dddddd;
  12. display: none;
  13. left: 90px;
  14. top: 40px;
  15. position: fixed;
  16. width: 300px;
  17. font-family: sans-serif;
  18. font-size: 8pt;
  19. text-align: center-left;
  20. user-select: none;
  21. }
  22. .menuitem {
  23. height: 20px;
  24. padding-top: 5px;
  25. padding-bottom: 5px;
  26. padding-left: 20px
  27. }
  28. .menuitem:hover {
  29. background-color: #eeeeee;
  30. height: 20px;
  31. padding-top: 5px;
  32. padding-bottom: 5px;
  33. }
  34. </style>
  35. <script>
  36.  
  37. var menudisplay = false;
  38. var map = {
  39. field:{type:"loc",options:["castle","sea","shack"],desc:"You find yourself in an open field"},
  40. castle:{type:"loc",options:["field","door","tower","well","stable"],desc:"You find the castle courtyard is deserted"},
  41. sea:{type:"loc",options:["field","castle","hut","docks"],desc:"You're walking on the beach"}
  42. };
  43.  
  44. window.addEventListener("contextmenu",function(){
  45. var top = new Menu(arguments[0].clientX,arguments[0].clientY,map.field);
  46. top.show();
  47. console.log("q");
  48. arguments[0].preventDefault();
  49. menudisplay = true;
  50. },false);
  51.  
  52. function Menu(x,y,items){
  53. this.x = x;
  54. this.y = y;
  55. this.hasMouse = false;
  56. this.e = document.createElement("div");
  57. this.e.addEventListener("onmouseenter",function(){this.hasMouse = true});
  58. this.e.addEventListener("onmouseleave",function(){this.hasMouse = false});
  59. this.e.addEventListener("onmouseover",function(){this.hasMouse = false});
  60. this.e.style = window.document.querySelector(".menu").style;
  61. this.e.style.left = x;
  62. this.e.style.top = y;
  63. this.display = false;
  64. this.show = function(){this.e.style.display = "block";this.display = true;};
  65. this.hide = function(){this.e.style.display = "none";this.display = false;};
  66. this.items = [];
  67. for(var i = 0; i < items.options.length; i++){
  68. this.items[i] = document.createElement("div");
  69. this.e.appendChild(this.items[i]);
  70. this.items[i].class = "menuitem";
  71. switch(items.type){
  72. case "loc":
  73. this.items[i].innerHTML = "Walk to the " + items.options[i];
  74. break;
  75. default:
  76. break;
  77. };
  78. };
  79. };
  80. </script>
  81. </head>
  82.  
  83. <body>
  84. <i id="cheese">Don't Even Worry About It.</i>
  85.  
  86. </body>
  87.  
  88.  
  89. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement