Marti / GM_setStyle

Re: @sjehuda:

Thanks for the visit however this can be achieved outside of the library in post-op before it is applied to the website.

This is also very beta still and very much on the back burner.

Closing as not planned.

Thanks for the visit however this can be achieved outside of the library in post-op before it is applied to the website.

I want to know how.
My attempts appear not to work.

Solved by:

function setNonceUponCSP() {
  window.addEventListener("securitypolicyviolation", (e) => {
    //let message = e.originalPolicy;
    //messageTruncated = message.substring(message.indexOf("'nonce-") + 7);
    //let nonceValue = messageTruncated.substring(0, messageTruncated.indexOf("'"));
    let nonceValue = e.originalPolicy.match(/'nonce-(.*?)'/)[1];
    cssStylesheet = document.getElementById(namespace);
    cssStylesheet.setAttribute('nonce', nonceValue);
  }, { passive : true, });
}

I didn't find a way to make it to work on first error.