Anthony created a script to bridge compatibility.  You can add this to the 
top of your script and it will define a GM_addStyle() function

// @require  https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js

... or you can take the part that sets the CSS styles (the variable "aCss" 
should contain the css text)

    let head = document.getElementsByTagName('head')[0];
    if (head) {
      let style = document.createElement('style');
      style.setAttribute('type', 'text/css');
      style.textContent = aCss;
      head.appendChild(style);
    }


On Wednesday, November 22, 2017 at 2:27:21 AM UTC-7, Ben wrote:
>
> @Phillip Cazzola
>
> thank for the comment.
>
> However I am still confused.
>
> I have some scripts with lots of GM_addStyle() statements.
>
> According to webpage http://www.greasespot.net/ there is ", there is *no 
> support* for GM_addStyle".
> On the other side it is written: "In general these methods work like their 
> old counterparts, but their return values are Promise 
> <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise>
> s"
>
> Hmm, so when I re-write a (formerly working) script to
>
> ....
> // @grant           GM.addStyle
> ...
> GM.addStyle("#foobarid { font-size: 16px !important;");
>
>
> it does still not work.
>
> How do I have to adjust the script otherwise to be v4.0 compatible?
>
> Ben
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to greasemonkey-users+unsubscr...@googlegroups.com.
To post to this group, send email to greasemonkey-users@googlegroups.com.
Visit this group at https://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to