Open djpeach opened 3 years ago
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?
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.