// ==UserScript== // @name Copy Tag with Source Link // @namespace http://tampermonkey.net/ // @version 1.0 // @description Copy the selected tag with the source link of the webpage appended at the end of the copied text. // @match :///* // @grant none // ==/UserScript==

(function() { 'use strict';

document.addEventListener('copy', function(e) {
    var selection = window.getSelection().toString();
    if (selection) {
        var sourceLink = '\n\nSource: ' + window.location.href;
        e.clipboardData.setData('text/plain', selection + sourceLink);
        e.preventDefault();
    }
});

})();


原文地址: https://www.cveoy.top/t/topic/nsfQ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录