|
|
|
window.addEventListener('contextmenu', RightClickMenu);
|
|
|
|
const rightMenu = document.querySelector('#rcb_menu');
|
|
|
|
const newTab = document.querySelector('#rcb_t6');
|
|
|
|
function RightClickMenu(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
rightMenu.style.display = 'block';
|
|
|
|
if (e.target.closest('a')) {
|
|
|
|
newTab.style.display = 'block';
|
|
|
|
// if (document.write(location.href)=='https://tools.pj568.eu.org/') {document.querySelector('#rcb_t7').style.display = 'block'}
|
|
|
|
document.querySelector('#rcb_t7').style.display = 'block';
|
|
|
|
} else {
|
|
|
|
newTab.style.display = 'none';
|
|
|
|
document.querySelector('#rcb_t7').style.display = 'none';
|
|
|
|
}
|
|
|
|
let x = e.clientX, y = e.clientY,
|
|
|
|
menuWidth = rightMenu.offsetWidth, menuHeight = rightMenu.offsetHeight,
|
|
|
|
htmlWidth = document.body.clientWidth, htmlHeight = document.body.clientHeight;
|
|
|
|
if (x + menuWidth < htmlWidth) rightMenu.style.left = x + 'px';
|
|
|
|
else rightMenu.style.left = htmlWidth - menuWidth + 'px';
|
|
|
|
if (y + menuHeight < htmlHeight) rightMenu.style.top = y + 'px';
|
|
|
|
else rightMenu.style.top = htmlHeight - menuHeight + "px";
|
|
|
|
}
|
|
|
|
document.body.addEventListener('click', function () {
|
|
|
|
rightMenu.style.display = 'none';
|
|
|
|
});
|
|
|
|
|
|
|
|
rightMenu.addEventListener('click', function (e) {
|
|
|
|
switch (e.target.id) {
|
|
|
|
case "rcb_t1":
|
|
|
|
window.location.href="https://Tools.PJ568.eu.org/";
|
|
|
|
break;
|
|
|
|
case "rcb_t2":
|
|
|
|
window.location.href="#";
|
|
|
|
break;
|
|
|
|
case "rcb_t3":
|
|
|
|
window.history.back(-1);
|
|
|
|
break;
|
|
|
|
case "rcb_t4":
|
|
|
|
window.history.forward(1);
|
|
|
|
break;
|
|
|
|
case "rcb_t5":
|
|
|
|
window.location.reload();
|
|
|
|
break;
|
|
|
|
case "rcb_t6":
|
|
|
|
if (e.target.closest('a')) {
|
|
|
|
var url = encodeURIComponent(e.target.closest('a').getAttribute('href'));
|
|
|
|
window.open(url);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "rcb_t7":
|
|
|
|
openBtnLink();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
console.error(e.target.id);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
});
|