Initial commit
This commit is contained in:
27
GetAllGCCodes/getallgccodes.js
Normal file
27
GetAllGCCodes/getallgccodes.js
Normal file
@@ -0,0 +1,27 @@
|
||||
function copyToClipboard(text) {
|
||||
const input = document.createElement('input');
|
||||
input.style.position = 'fixed';
|
||||
input.style.opacity = 0;
|
||||
input.value = text;
|
||||
document.body.appendChild(input);
|
||||
input.select();
|
||||
document.execCommand('Copy');
|
||||
document.body.removeChild(input);
|
||||
};
|
||||
|
||||
chrome.browserAction.onClicked.addListener(function() {
|
||||
var toClipboard = ""
|
||||
var separator = "";
|
||||
chrome.tabs.query({}, function(tabs) {
|
||||
$.each(tabs, function() {
|
||||
var url = new URL(this.url);
|
||||
var domain = url.hostname;
|
||||
if ((domain == "geocaching.com" || domain == "www.geocaching.com") && url.pathname.startsWith("/geocache")) {
|
||||
toClipboard += separator + this.title.split(" ")[0];
|
||||
separator = ",";
|
||||
}
|
||||
});
|
||||
copyToClipboard(toClipboard);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user