Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
var x = null;
var y = null;
document.addEventListener('mousemove', onMouseUpdate, false);
document.addEventListener('mouseenter', onMouseUpdate, false);
function onMouseUpdate(e) {
x = e.clientX;
y = e.clientY;
}
function contains(x,y, rect){
return rect.left <= x && x <= rect.right && rect.top <= y && y <= rect.bottom;
}
hotkeys('ctrl+d',function(event){
for(let link of Array.prototype.slice.call(document.getElementsByTagName('a')) ){
if(contains(x, y, link.getBoundingClientRect())){
event.preventDefault();
event.stopImmediatePropagation();
if(link.href){
console.log(link.href);
navigator.clipboard.writeText(link.href);
}
break;
}
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question