Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <style>
- .menu {
- background-color: #ffffff;
- padding-top: 3px;
- padding-bottom: 3px;
- border-width: 1px;
- border-style: solid;
- border-color: #dddddd;
- display: none;
- left: 90px;
- top: 40px;
- position: fixed;
- width: 300px;
- font-family: sans-serif;
- font-size: 8pt;
- text-align: center-left;
- user-select: none;
- }
- .menuitem {
- height: 20px;
- padding-top: 5px;
- padding-bottom: 5px;
- padding-left: 20px
- }
- .menuitem:hover {
- background-color: #eeeeee;
- height: 20px;
- padding-top: 5px;
- padding-bottom: 5px;
- }
- </style>
- <script>
- var menudisplay = false;
- var map = {
- field:{type:"loc",options:["castle","sea","shack"],desc:"You find yourself in an open field"},
- castle:{type:"loc",options:["field","door","tower","well","stable"],desc:"You find the castle courtyard is deserted"},
- sea:{type:"loc",options:["field","castle","hut","docks"],desc:"You're walking on the beach"}
- };
- window.addEventListener("contextmenu",function(){
- var top = new Menu(arguments[0].clientX,arguments[0].clientY,map.field);
- top.show();
- console.log("q");
- arguments[0].preventDefault();
- menudisplay = true;
- },false);
- function Menu(x,y,items){
- this.x = x;
- this.y = y;
- this.hasMouse = false;
- this.e = document.createElement("div");
- this.e.addEventListener("onmouseenter",function(){this.hasMouse = true});
- this.e.addEventListener("onmouseleave",function(){this.hasMouse = false});
- this.e.addEventListener("onmouseover",function(){this.hasMouse = false});
- this.e.style = window.document.querySelector(".menu").style;
- this.e.style.left = x;
- this.e.style.top = y;
- this.display = false;
- this.show = function(){this.e.style.display = "block";this.display = true;};
- this.hide = function(){this.e.style.display = "none";this.display = false;};
- this.items = [];
- for(var i = 0; i < items.options.length; i++){
- this.items[i] = document.createElement("div");
- this.e.appendChild(this.items[i]);
- this.items[i].class = "menuitem";
- switch(items.type){
- case "loc":
- this.items[i].innerHTML = "Walk to the " + items.options[i];
- break;
- default:
- break;
- };
- };
- };
- </script>
- </head>
- <body>
- <i id="cheese">Don't Even Worry About It.</i>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement