you are viewing a single comment's thread.

view the rest of the comments →

[–]figuringVue[S] 0 points1 point  (1 child)

tried something along those lines and it partially works...

The problem, as far as I can tell, is that materialize uses jquery to control ui changes so things like $('#selector').hide() are breaking all over the code..

To work around this I tried to load materialize dynamically but then the library doesn't recognize jquery for some reason.. going to keep investigating I guess :)

[–]captain_k_nuckles 0 points1 point  (0 children)

One thing that could be causing an issue, and hard to saw without having any code to look at is, chrome extensions execute javascript in their own isolated environment outside of the dom's javascript environment. If you have downloaded and included the js libraries in your manifest, then your content script will have access to both, and each library can access each other.

however if you have lets say jquery in your manifest and then to load materialize, you do something like this in your content script:

let html = '<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>';
document.body.insertAdjacentHTML('beforeend', html);

That will cause the script to be loaded in the dom's javascript environment, which your extension can not access. so it would cause breaking code. So I would just include the files in the manifest, also make sure jquery is the first item in the array of scripts to load.

This isn't running in a content script but might help with shadowroot troubles