How to run JS code from google chrome theme

Google Chrome themes are defined in the Chrome Developer Docs as follows:

A theme is a special kind of extension that changes the way the browser looks. Themes are packaged as regular extensions, but they do not contain JavaScript or HTML.

(accent my own)

However, I would like to apply some theme that runs JavaScript on the page being loaded. How can i do this? I tried to add

"permissions": ["<all_urls>"],
"content_scripts": [
    {
    "matches": [
        "http://*/*",
        "https://*/*"
        ],
    "js": ["content.js"],
    "run_at": "document_end"         // pay attention to this line
    }
],

      

in mine manifest.json

and putting the file content.js

in the same package .crx

as my manifest like this answer

(function(window, chrome){
  "use strict";
  var doc = window.document;
  doc.getElementById("mv-tiles").style.opacity = "0";
}(window, chrome));

      

but the code just won't run. Are there any workarounds?

+3


source to share





All Articles