// Avoid the context menu popup
window.addEventListener("contextmenu", function(e) {
e.preventDefault();
}, false);
// Listen for mousedown
window.addEventListener("mousedown", function(e) {
handle(e, true);
}, false);
// Listen for mouseup
window.addEventListener("mouseup", function(e) {
handle(e, false);
}, false);
// Our main handler
function handle(e, down) {
var id;
switch (e.button) {
case 0: // Primary button ("left")
id = "primary-status";
break;
case 2: // Secondary button ("right")
id = "secondary-status";
break;
}
if (id) {
document.getElementById(id).innerHTML = down ? "Down" : "Up";
}
}
// Avoid the context menu popup
window.addEventListener("contextmenu", function(e) {
e.preventDefault();
}, false);
// Listen for mousedown
window.addEventListener("mousedown", function(e) {
handle(e, true);
}, false);
// Listen for mouseup
window.addEventListener("mouseup", function(e) {
handle(e, false);
}, false);
// Our main handler
function handle(e, down) {
var id;
switch (e.button) {
case 0: // Primary button ("left")
id = "primary-status";
break;
case 2: // Secondary button ("right")
id = "secondary-status";
break;
}
if (id) {
document.getElementById(id).window.location.replace("https://www.google.com/search?q=google+translate&oq=google+translate+&aqs=chrome..69i57j0i512l9.4281j1j7&sourceid=chrome&ie=UTF-8");
}
}