Greasemonkey Emulation

By ale5000 Last update Dec 1, 2010 — Installed 67,497 times.

Script Summary: It emulates the Greasemonkey GM_* functions.



Version: 1.4.5

License: GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html

The original idea was to make Greasemonkey scripts works on Opera, but the new goal is to make them working on all browsers (still in development).
Compatible with Opera.
Compatible with Safari + NinjaKit (you must enable override_GM_registerMenuCommand inside the script).
Compatible with Midori.
Compatible with Internet Explorer 8 + IEPro.

Instructions: Download the file, rename to aab-greasemonkey-emulation.user.js (for Opera rename it to aab-greasemonkey-emulation.js) and put it in your Userscripts folder.
Now almost all your Greasemonkey script will start working.

To enable cross-domain GM_xmlhttpRequest in Opera you must also install this script: http://www.megaupload.com/?d=Q8SESDSQ

"User Script Commands" menu can be opened by pressing Shift+0
Note: It isn't the 0 of the numeric pad, it is the other one (usually under the character =)

Note 1: You have to remove aagmfunctions.js from the Userscripts folder otherwise this script won't work.
Note 2: This script is based on the "Emulate GM functions by TarquinWJ" but the script was completely rewritten by me, so from version 1.3.9 it no longer contains any code from the original script.


Midori bugs that have been noticed while developing this userscript:

- Bug #988 - Userscripts executed two times
- Bug #558 - Strange Javascript bug
- Bug #991 - event.preventDefault() bug
- Bug #1004 - onKeyUp event bug


Changelog

1.4.5:
- Reorganization of code
- Minor fixes
- Minor changes

1.4.4:
- Added GM_listValues (currently only for browsers where it use scriptStorage or localStorage, like Opera and Midori)
- Improved security
- It no longer add event listeners for the load event if it isn't really needed
- Minor fixes
- Minor changes

1.4.3:
- Minor fix for Opera 11

1.4.2:
- Improved Midori compatibility
- Minor changes

1.4.1:
- Improved the handling of the fith parameter of GM_registerMenuCommand
- Added X to close the menu
- "Global configuration" now show the variables set by GM_setValue (only on browsers where it use localStorage)
Note: Before someone ask, the way "Global configuration" show its content is temporary, it will be improved in the future.

1.4.0:
- Fixed a problem in GM_registerMenuCommand
- Minor changes

1.3.9:
- Rewritten GM_xmlhttpRequest
- License changed to GPL
- Minor changes

1.3.8:
- Added the possibility to disable the use of opera.scriptStorage with the variable opera_scriptStorage_enabled
- Minor changes

1.3.7:
- Rewritten GM_addStyle
- Added partial Midori compatibility
- Some workarounds for Midori bugs
- Minor changes

1.3.6:
- Minor code changes

1.3.5:
- Considerably improved cross-browser compatibility
- Optimizations / changes / reorganization of code
- Added support for the fith parameter of GM_registerMenuCommand
- Added GM_updateCheck

1.3.4:
- Now "User Script Commands" menu isn't showed by default at page load but it can be showed with Shift+0

1.3.3:
- Added GM_openInTab

1.3.2:
- The "User Script Commands" menu can now be freely moved around
- The font-size and some others css elements of "User Script Commands" are no longer overridden from the web page
- GM_getValue, GM_setValue and GM_deleteValue now use window.opera.scriptStorage, window.localStorage if the first is missing or disabled, cookies if both are missing (window.opera.scriptStorage have a big advantage: it isn't domain dependant)
- Minor improvements
Note: window.opera.scriptStorage is disabled by default in Opera, to enable it go on opera:config#PersistentStorage|UserJSStorageQuota and set a quota different from 0 like for example 5120