Coder Social home page Coder Social logo

Comments (2)

aigooman avatar aigooman commented on July 24, 2024 1

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);
})();

from maxfield.

hahahaozi avatar hahahaozi commented on July 24, 2024

我根据你的工作做了一些修改。现在您只需单击门户并单击导航栏中的“复制”按钮。感谢您的分享,节省了很多时间。

// ==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?

from maxfield.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.