-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathCopy Crunchbase Acquisitions links.user.js
More file actions
64 lines (52 loc) · 2.2 KB
/
Copy pathCopy Crunchbase Acquisitions links.user.js
File metadata and controls
64 lines (52 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// ==UserScript==
// @name Copy Crunchbase Acquisitions links
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Copy Crunchbase Acquisitions links and create a button to do it
// @author rix4uni
// @match https://www.crunchbase.com/organization/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=crunchbase.com
// @grant GM_setClipboard
// ==/UserScript==
(function() {
'use strict';
// Function to filter and copy links
function copyFilteredLinks() {
// Select the 9th tbody element
let tbody = document.querySelectorAll('tbody')[8];
// Get all a elements within the selected tbody
let links = tbody.querySelectorAll('a');
// Extract the href attributes
let hrefs = Array.from(links).map(link => link.getAttribute('href'));
// Filter out the hrefs that start with /acquisition/
let filteredHrefs = hrefs.filter(href => !href.startsWith('/acquisition/'));
// Add https://www.crunchbase.com/ to each filtered href
filteredHrefs = filteredHrefs.map(href => `https://www.crunchbase.com${href}`);
// Join filtered hrefs into a single string separated by new lines
let hrefsText = filteredHrefs.join('\n');
// Copy to clipboard
GM_setClipboard(hrefsText);
// Alert user
alert('Acquisitions links copied to clipboard!');
}
// Create the button
const button = document.createElement('button');
button.textContent = 'Copy Acquisitions Links';
button.style.position = 'fixed';
button.style.top = '150px';
button.style.right = '10px';
button.style.zIndex = '1000';
button.style.padding = '10px 20px';
button.style.backgroundColor = '#007bff';
button.style.color = 'white';
button.style.border = 'none';
button.style.borderRadius = '5px';
button.style.cursor = 'pointer';
button.style.textAlign = 'center'; // Center text
button.style.display = 'flex';
button.style.justifyContent = 'center';
button.style.alignItems = 'center';
button.addEventListener('click', copyFilteredLinks);
// Add the button to the body
document.body.appendChild(button);
})();