Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name New script - google.com
- // @namespace Violentmonkey Scripts
- // @match *://*.google.com/search?*
- // @grant none
- // @version 1.0
- // @author -
- // @description 31/03/2021, 09:05:03
- // @require https://code.jquery.com/jquery-3.6.0.min.js
- // ==/UserScript==
- (function() {
- 'use strict';
- // Function to copy the passed string to clipboard.
- function copyToClipboard(string) {
- let $temp = $('<input>');
- $('body').append($temp);
- $temp.val(string).select();
- document.execCommand('copy');
- $temp.remove();
- }
- $('.wsn-google-focused-link a, .yuRUbf a').each(function() {
- let $linkString = $(this).attr('href');
- //console.log($linkString);
- $('<button onclick="copyToClipboard($linkString)">Copy URL</button>').insertAfter($(this).find('h3'));
- });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement