luk3yx.github.io/js/contextmenu.js
luk3yx 828c95d82a Okay, it's 2018.
• Rework the JavaScript handler.
 • Fix the card generator.
 • Nuke all known XSS attacks.
 • Change the background to white.
 • Change some fonts on index.html to make it look more modern.
 • Remove a few ".old" pages.
 • Improve the mobile-friendliness of index.html.
 • Remove all styling on <select> tags.
 • Other varied bugfixes
2018-12-08 10:51:13 +13:00

33 lines
1.3 KiB
JavaScript

// Copyright 2016 by luk3yx.
// All rights reserved.
document.body.setAttribute("oncontextmenu", "return false;");
document.addEventListener("contextmenu", rightClick, false);
function rightClick(e) {
pointerX = e.pageX;
pointerY = e.pageY;
createContextMenu();
return false;
}
function createContextMenu() {
if (!document.getElementById("contextMenu")) {
var contextdiv = document.createElement('div');
document.body.appendChild(contextdiv);
contextdiv.innerHTML = "<iframe id='contextMenu' src='/js/handler/contextmenu.html' style='position: absolute; top: 10px; right: 10px; width: 200px; height: 300px; z-index: 100;' onclick='return true;' />";
}
var contextMenu = document.getElementById("contextMenu");
contextMenu.style.left = pointerX + "px";
contextMenu.style.top = pointerY + "px";
contextMenu.style.display = "block";
document.getElementsByTagName("BODY")[0].onclick = deleteContextMenu;
return false;
}
function deleteContextMenu() {
document.getElementsByTagName("BODY")[0].onclick = function () {return true; };
// document.getElementById("contextMenu").parentElement.removeChild(document.getElementById("contextMenu"));
document.getElementById("contextMenu").style.display = "none";
}
hideLoadScreen();