Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Breaks in Greasemonkey 4

About: Sci-hub button
edited February 4 in Script Discussions [?]

GM_addStyle has been removed. It can be easily replaced by

function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css.replace(/;/g, ' !important;');
    head.appendChild(style);
}

Also, the nature regex needs to be modified to accept dots as well: [\w\d-][\w.-] (digits are already included in \w)

Comments

Sign In or Register to comment.