views:

315

answers:

1

I'm getting into user scripts at the moment. I know Opera is compatible with many aspects of Greasemonkey scripts, but not so much with other aspects.

The GM functions emulation script will be required on Opera, and at the start I have

if(window.opera) {
    var unsafeWindow = window;
}

But beyond that, what other things should I keep in mind if I want my scripts to run in both?

+1  A: 

My Endless Tweets user script works equally well in Firefox, WebKit and Opera.

I'm using a compatibility script I wrote myself which provides GM_getValue, GM_setValue, GM_xmlhttpRequest, GM_addStyle and GM_log.

However, I don't like using the "GM_" prefix since the user script is cross-platform, so the scripts has this API:

getValue()
setValue()
xhr()
addCSS()
log()

Check the rest of the toolkit for more useful functions when writing user scripts.

mislav