Advertisement
Game_Logic

OP Draggable Cookie Clicker Menu (WIP)

Feb 24th, 2022 (edited)
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. var cmenu = document.createElement("p"); document.body.appendChild(cmenu); cmenu.outerHTML=`<div id="xynhack" style="position: absolute; height: 240px; background: rgba(128, 128, 128, 0.5); width: 180px; border-radius: 15px; border-color: rgb(0, 0, 0); top: 326px; left: 526px;"><big style="font-size:75">⠀⠀⠀Cookie Compass (WIP)</big><div></div><a onclick="addcookies()">Add Cookies</a><div></div><a onclick="Game.cookies=Number(-15000)">Go In Debt</a><div></div><a onclick="Game.cookies='-15000'">Screw Your Game</a><div></div><a onclick="removeAds()">Delete Ads</a><div></div><a onclick="document.getElementById('bakeryName').innerHTML=prompt('What would you like to rename the bakery to?');">Rename Bakery</a><div></div><a onclick="Game.cookies=0">Reset Cookies</a><div></div><a onclick="Game.cookiesPs=prompt('What would you like to set your CPS to?')">Cookies Per Second</a><div></div><a onclick="partymode()">Party Mode</a><div></div><a target="_newtab" href='https://pastebin.com/u/game_logic'">My Pastebin</a></div>`;
  2. // Make the DIV element draggable:
  3.  
  4. function dragElement(elmnt) {
  5. var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
  6. if (document.getElementById(elmnt.id + "header")) {
  7. // if present, the header is where you move the DIV from:
  8. document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
  9. } else {
  10. // otherwise, move the DIV from anywhere inside the DIV:
  11. elmnt.onmousedown = dragMouseDown;
  12. }
  13.  
  14. function dragMouseDown(e) {
  15. e = e || window.event;
  16. e.preventDefault();
  17. // get the mouse cursor position at startup:
  18. pos3 = e.clientX;
  19. pos4 = e.clientY;
  20. document.onmouseup = closeDragElement;
  21. // call a function whenever the cursor moves:
  22. document.onmousemove = elementDrag;
  23. }
  24.  
  25. function elementDrag(e) {
  26. e = e || window.event;
  27. e.preventDefault();
  28. // calculate the new cursor position:
  29. pos1 = pos3 - e.clientX;
  30. pos2 = pos4 - e.clientY;
  31. pos3 = e.clientX;
  32. pos4 = e.clientY;
  33. // set the element's new position:
  34. elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
  35. elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
  36. }
  37.  
  38. function closeDragElement() {
  39. // stop moving when mouse button is released:
  40. document.onmouseup = null;
  41. document.onmousemove = null;
  42. }
  43. }; function addcookies() { Game.cookies=Number(Game.cookies)+Number(prompt("How many cookies would you like to add?")); };
  44. dragElement(document.getElementById("xynhack")); document.getElementById("topBar").outerHTML='<div id="topBar"> <div><b style="font-weight:bold;">Cookie Clicker (Xyns Hack Edition)</b>™ © <a href="https://www.youtube.com/channel/UCBOLNLmUJCgnwh0gDAPBclg" target="_blank" id="topbarOrteil">SUB TO XYNS YOUTUBE</a>, 2022 - </div> <div style="float:right;"><a id="changeLanguage" style="font-variant:small-caps;">Change language</a></div> </div>';
  45. function removeAds() { document.getElementById(`smallSupport`).outerHTML=``; document.getElementsByClassName(`ifNoAds`).outerHTML=``; document.getElementById(`support`).outerHTML=``; document.getElementById(`detectAds`).outerHTML=``; };
  46. function partymode() { document.getElementById("backgroundCanvas").outerHTML='<img id="backgroundCanvas" width="1920" height="1080" style="background: transparent;" src="https://i.imgur.com/t86XZNg.gif">'; document.getElementById("wrapper").style='background:url(https://i.imgur.com/t86XZNg.gif);width: 100%; height: 100%;' };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement