مۇنازىرىلەر » قۇرۇش تەلىپى

Copy Link Text on Mouse Hover

§
يوللانغان ۋاقتى: 2020-02-06

Copy Link Text on Mouse Hover

I'm looking for a script which is relatively simple. I would like to copy a link text to clipboard, when pressing "Ctrl + c" when mouse cursor is hovering on a link, in Google Chrome. I would like to use Tampermonkey, and found this script, but does not work. Does anyone know how to do this?

Script found: https://autohotkey.com/board/topic/111762-mouse-hover-copy-link/

// ==UserScript==
// @name        URL Copy When Hover
// @namespace   com.atnbueno.url-copy-when-hover
// @include     http://www.autohotkey.com/*
// @require     http://code.jquery.com/jquery-2.1.1.min.js
// @version     0.1
// @grant       GM_setClipboard
// ==/UserScript==

$(document).ready(function() {
  $("a").hover(function() {
    GM_setClipboard($(this).attr("href"));
  });
});
woxxomMod
§
يوللانغان ۋاقتى: 2020-02-06
تەھرىرلەنگەن ۋاقتى: 2020-02-06
// ==UserScript==
// @name        Copy URL on hover + Ctrl-C
// @include     *
// @grant       GM_setClipboard
// @grant       GM_notification
// ==/UserScript==

document.addEventListener('keydown', e => {
  if (e.code === 'KeyC' && e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey) {
    const a = document.querySelector('a:hover');
    if (a) {
      GM_setClipboard(a.href);
      GM_notification(a.href, 'Copied')
      e.preventDefault();
    }
  }
})
§
يوللانغان ۋاقتى: 2020-02-06

Thank you for the script wOxxOm. It doesn't seem to work though :/

woxxomMod
§
يوللانغان ۋاقتى: 2020-02-07

Works for me though.

§
يوللانغان ۋاقتى: 2020-02-10

Maybe there's software or a Google Chrome Extension that is preventing it from working on my PC. I've tried disabling all my extensions, but still doesn't work...

جاۋاب قايتۇرۇش

جاۋاب قايتۇرۇش ئۈچۈن كىرىش.

长期地址
遇到问题?请前往 GitHub 提 Issues。