Chrome扩展程序无需点击图标即可开始运行吗?

时间:2018-10-28 11:09:05

标签: javascript jquery json google-chrome-extension manifest

我已经看到了这个post,但是对我没有帮助,所以我希望我的扩展程序无需点击图标就可以开始工作吗?

manifest.js

"name":"test",
    "description":"test.",
    "version":"1.1.1",
    "manifest_version":2,
    "icons": { 
        "16": "icons/icon16.png",
        "48": "icons/icon48.png",
        "128": "icons/icon128.png"
    },
    "browser_action": {
        "default_icon": "icons/icon128.png",
        "default_popup": "popup.html"
        },
    "background": {
        "scripts": ["background.js"],
        "persistent": true
        },
    "content_scripts": [
        {
          "js": ["jquery.js","content.js"],
          "matches": ["<all_urls>"],
          "run_at": "document_end",
          "all_frames": true    
        }
        ],
    "permissions": [
        "<all_urls>",
        "storage", 
        "activeTab"
       ]

background.js

    ! function(t) {
    var e = {};

    function n(o) {
        if (e[o]) return e[o].exports;
        var r = e[o] = {
            i: o,
            l: !1,
            exports: {}
        };
        return t[o].call(r.exports, r, r.exports, n), r.l = !0, r.exports
    }
    n.m = t, n.c = e, n.d = function(t, e, o) {
        n.o(t, e) || Object.defineProperty(t, e, {
            configurable: !1,
            enumerable: !0,
            get: o
        })
    }, n.n = function(t) {
        var e = t && t.__esModule ? function() {
            return t.default
        } : function() {
            return t
        };
        return n.d(e, "a", e), e
    }, n.o = function(t, e) {
        return Object.prototype.hasOwnProperty.call(t, e)
    }, n.p = "", n(n.s = 0)
}([function(t, e) {
    chrome.runtime.setUninstallURL("https:// website /contact/");
    const n = t => (t => {
        const e = Object.keys(t).filter(e => t[e]).map(e => e + "=" + encodeURIComponent(t[e])).join("&");
        fetch("https://www.google-analytics.com/collect", {
            method: "POST",
            body: e
        }).then(() => {}).catch(() => {})
    })(Object.assign({
        v: 1,
        tid: "UA-000000-5",
        cid: (() => {
            const t = localStorage.getItem("cid");
            return t || (rndCid = Math.round(1e15 * Math.random()).toString(32), localStorage.setItem("cid", rndCid), rndCid)
        })(),
        t: "pageview"
    }, t));
    n(), window.trackEvent = ((t = "unknown", e = "unknown", o) => {
        (({
            category: t,
            action: e,
            label: o
        }) => n({
            t: "event",
            ec: t,
            ea: e,
            el: o
        }))({
            category: t,
            action: e,
            label: o
        })
    }), chrome.runtime.onMessage.addListener(t => {
        !0 === t.__ga && window.trackEvent(t.category, t.action, t.label)
    })
}]);

我已经看到了这个post,但是对我没有帮助,所以我希望我的扩展程序无需点击图标就可以开始工作吗?

可以在不单击图标的情况下启动扩展程序,这就是我今天要尝试的操作,因此我整天都无法解决此问题,因此请帮助我。谢谢

0 个答案:

没有答案