The My Opera forums have been replaced with forums.opera.com. Please head over there to discuss Opera's products and features

See the new Forums

Help converting greasemonkey userjs to opera userjs

Forums » General Opera topics » User JavaScript

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

1. November 2011, 16:48:16

unrequited

Posts: 3

Help converting greasemonkey userjs to opera userjs

Google Reader now looks like crap, too much whitespace everywhere. Some guy fixed it with a Firefox Greasemonkey script here (click Source):
http://userscripts.org/scripts/show/116850

How can this be adapted for use with Opera? I'm not JS savvy enough to figure it out, thanks.

1. November 2011, 18:18:42

Frenzie

Posts: 15571

Originally posted by larskl:

just copy the styles and use it as a usercss


Agreed. That said, you could also add the following to the file:
function GM_addStyle(css) {
  var parent = document.getElementsByTagName("head")[0];
  if (!parent) {
    parent = document.documentElement;
  }
  var style = document.createElement("style");
  style.type = "text/css";
  var textNode = document.createTextNode(css);
  style.appendChild(textNode);
  parent.appendChild(style);
}

(quickly grabbed from here)
The DnD Sanctuary — a safety net for My Opera's demise.

2. November 2011, 03:21:50

rseiler

Posts: 1667

The problem with just using css is that it applies to all Google sites.

I'm not really following the last post: what is that intended to do?
Opera 12.1x.latest x86, Windows 8.1 x64

2. November 2011, 17:25:52

XAntares

хаха гага

Posts: 140

Originally posted by rseiler:

I'm not really following the last post: what is that intended to do?


It's a custom implementation of GM's native GM_addStyle function. (It writes the css into a TextNode, which itself is inserted into a style element, that is appended to head or documentElement.)

(And all that should eventually be wrapped up by an anonymous function.)
Never argue with an idiot. They drag you down to their level, then beat you with experience. «« « ‹‹ ‹

Forums » General Opera topics » User JavaScript