Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Random add copy
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author duclv
- // @match https://www.bestrandoms.com/random-address-in-us
- // @icon https://www.google.com/s2/favicons?sz=64&domain=bestrandoms.com
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- document.querySelector('#main .content').insertAdjacentHTML('beforebegin','<button onclick="copyall()">COPY ALL</button>');
- window.copyToClipboard = function(text) {
- var dummy = document.createElement('textarea');
- document.body.appendChild(dummy);
- dummy.value = text;
- dummy.select();
- document.execCommand('copy');
- document.body.removeChild(dummy);
- }
- window.copyall = function() {
- window.copyToClipboard(Array.from(document.querySelectorAll('#main .content li')).map(x=>{
- return [x.children[0], x.children[1], x.children[2], x.children[4],].map(c => {
- return c.innerHTML.split(/ (.*?)</)[1]
- }).join(',')
- }).join('\r\n'))
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment