Greasy Fork is available in English.

复制网页链接

左键双击页面即可复制页面链接,改善 edge-dev 版不能复制 url 的问题

// ==UserScript==
// @name         复制网页链接
// @namespace    copy-url
// @description  左键双击页面即可复制页面链接,改善 edge-dev 版不能复制 url 的问题
// @version      1.4
// @author       huhan_y@163.com
// @include      *
// @noframes
// ==/UserScript==

(function() {
  'use strict';
  document.body.addEventListener('dblclick', function() {
    if(navigator.clipboard){
      navigator.clipboard.writeText(window.location.href);
    }else{
      var input = document.createElement('input');
      document.body.appendChild(input);
      input.value = window.location.href;
      var selection = window.getSelection();
      var range = selection.getRangeAt(0);
      input.select();
      document.execCommand('copy');
      document.body.removeChild(input);
      selection.removeAllRanges();
      selection.addRange(range);
    }
  });
})();