maxfield
maxfield copied to clipboard
TamperMonkey script to make getting the portal text easier
Its ugly, its probably not perfect, but it works on everything I've used so far. It just allows you to easily copy the title and link of the portal to your clipboard. Click the portal, click the link button and voila you got it in your clipboard. Wasnt sure where else to share it.
// @name Ingress Portal Copyer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://intel.ingress.com/intel?state=GOOGLE&code=4%2F0AY0e-g6DQpl2zaTtquTbcWFZZa_lRG_dE6sWsw8ICgrWbIJtGbshNWdvSWEYrowtnE7hgg&scope=email+profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+openid&authuser=2&prompt=consent
// @grant none
// ==/UserScript==
(function() {
function copyToClipboard(text) {
const elem = document.createElement('textarea');
elem.value = text;
document.body.appendChild(elem);
elem.select();
document.execCommand('copy');
document.body.removeChild(elem);
}
'use strict';
let linkButton = document.getElementById("header_maplink");
linkButton.addEventListener("click", function() {
let title = "";
let link = "";
let portalText = "";
let titleEl = document.getElementById("portal_primary_title");
let linkEl = document.getElementById("maplink");
if (titleEl) {
title = titleEl.innerHTML.replace(/["]+/g, '').replace(/(&)+/g, "&");
}
if (linkEl) {
link = linkEl.value;
}
portalText = title + "; " + link;
copyToClipboard(portalText);
console.log(portalText);
});
})();```
I've made some modifications based on your work. Now you just need to click the portal and click the “COPY” button in nav bar. Thanks for your sharing, saving lots of time.
// ==UserScript==
// @name ingress-maxfield
// @namespace https://intel.ingress.com/
// @version 0.1
// @description try to take over the world!
// @author 3verness
// @match https://intel.ingress.com/
// @grant none
// ==/UserScript==
(function() {
'use strict';
var copyButton = document.createElement("div");
copyButton.className = 'nav_link';
copyButton.innerHTML = 'COPY';
copyButton.addEventListener("click", copyFunc)
function copyFunc(){
//debugger
Tj(document.querySelector("#header_maplink"), "show_box");
displaymaplink();
var title = document.querySelector("#portal_primary_title").textContent;
var link = document.querySelector("#maplink").value;
var s = title+';'+link;
const input = document.createElement('input');
document.body.appendChild(input);
input.setAttribute('value', s);
input.select();
if (document.execCommand('copy')) {
document.execCommand('copy');
}
document.body.removeChild(input);
}
document.querySelector("#nav").appendChild(copyButton);
})();
我根据你的工作做了一些修改。现在您只需单击门户并单击导航栏中的“复制”按钮。感谢您的分享,节省了很多时间。
// ==UserScript== // @name ingress-maxfield // @namespace https://intel.ingress.com/ // @version 0.1 // @description try to take over the world! // @author 3verness // @match https://intel.ingress.com/ // @grant none // ==/UserScript== (function() { 'use strict'; var copyButton = document.createElement("div"); copyButton.className = 'nav_link'; copyButton.innerHTML = 'COPY'; copyButton.addEventListener("click", copyFunc) function copyFunc(){ //debugger Tj(document.querySelector("#header_maplink"), "show_box"); displaymaplink(); var title = document.querySelector("#portal_primary_title").textContent; var link = document.querySelector("#maplink").value; var s = title+';'+link; const input = document.createElement('input'); document.body.appendChild(input); input.setAttribute('value', s); input.select(); if (document.execCommand('copy')) { document.execCommand('copy'); } document.body.removeChild(input); } document.querySelector("#nav").appendChild(copyButton); })();
Hi! To disturb. Excuse me, on line 19, Tampermonkey will report an error for "Tj". How to deal with it?