Greasemetal version 0.2 released
I have just uploaded version 0.2 of Greasemetal to greasemetal.31tools.com. I originally intended to add management UI for userscripts in the second release, but hearing the users' request for improved compatibility with Greasemonkey, I changed my mind. The main focus of the release is to improve compatibility with Greasemonkey. The changes from version 0.1 are as follows.
Improved Compatibility with Greamemonkey
After the initial release a number of users requested support for GM_* functions, to improve compatibily with many existing userscripts written for Greasemonkey. So in version 0.2, we have implemented following functions:
- GM_log
- GM_addStyle
- GM_openInTab
- unsafewindow
The functions were written by my colleague Amachang. He is the developer of a Javascript-based presentation tool S6 (an example) and JavaScript-XPath.
Execution Log of Userscripts
Greasemetal will write execution log of userscripts to the inspection window (to open the window, right click anywhere in the browser window and select Inspect). Greasemetal logs which userscripts are executed, and names the ones that failed and the reason why. Unfortunately the line number at where the error occured cannot be logged, but still I hope it would be helpful for developers makeing their userscripts compatibile with Greasemetal.
Suppress Unnecessary Error Logs
The debug.log file is no more generated. If you find one next to Greasemetal.exe, you are free to remove it. Also you would no more see the error message "Uncaught TypeError: Cannot call method 'setAutomationId' of undefined" in the inspection window increasing forever (although you would see one message per tab, it's inevitable).
Passing Command Line Arguments to Google Chrome
Command line arguments following " - " are passed to Google Chrome. For example, command below will start Google Chrome with Greasemetal but without displaying images.
> Greasemetal.exe - --disable-images
Possibility of Supporting other GM_* Functions and Security Implications
4:43pm added: Now that we have added support for some GM_* functions, the left ones are: GM_xmlHttpRequest, GM_getValue, and GM_setValue. The three functions require a different security model than that of ordinal web scripts (known as same domain policy). Even if we dismissed the pontential danger of not supporting a non-safeWindow, the functions will require a secure channel from userscripts to the internal web server of Greasemetal (that malicious web sites cannot intervene), for storing and accessing persistent data, or performing cross-domain access through the web server. However, since there is no way to enforce the order of JavaScript execution so that the script injected by Greasemetal is run before any scripts on a web page gets executed, it is difficult to create such a channel (a malicious web page might redefine necessary functions for communication, such as document.createElement). In other words, it would be mandatory to implement an encrypted channel (with replay attack-resistency) between the injected JavaScript and the web server, however it would require some ammount of engineering.
This is our current understanding on the technical aspects of supporting the functions, and thus, until these situation changes, we have little (if not any) interest in implementing them.
Comments
This is great, good work. Can't wait for the UI.
Posted by: jerone
|
September 14, 2008 09:09 AM
It looks good. I've created a workaround to allow the GM_xmlhttpRequest to be used. I've tried it in one of my scripts. If you include this code in your script:
//Allow GM_xmlhttpRequest in Greasemetal ("Greasemonkey" for Google Chrome)
var chromexmlhttp;
var ChromeHTTP = function(options)
{
var onload = options["onload"];
chromexmlhttp = new XMLHttpRequest();
chromexmlhttp.open(options["method"], options["url"], true);
chromexmlhttp.onload = function(resp) {
var resptext = chromexmlhttp.responseText;
var responseDetails = { responseText : resptext }
onload(responseDetails);
};
chromexmlhttp.send(null);
}
if(!window.GM_xmlhttpRequest)
{ window.GM_xmlhttpRequest = ChromeHTTP;
}
it will create a GM_xmlhttpRequest method compatible with the standard method, if the method does not already exist. I've tested it one of my scripts and it worked perfectly.
Posted by: Rollo
|
September 15, 2008 01:14 AM
Actually, I've realised that my workaround only works for scripts which request from the same domain as the page the script is on. Which, rereading the post, is the reason for the problem implementing it.
Posted by: Rollo
|
September 15, 2008 05:04 AM
The homepage for it needs modifying since the folder for the userjs to go into has changed to \Program Files\Greasemetal\userjs.
Posted by: Zero3K
|
September 16, 2008 07:34 AM
Zero3K: Version 0.2 of Greasemonkey reads userscripts from BOTH folders, one under Program Files and one under My Documents (or Documents, on Windows Vista).
The former is intended for system use only.
Posted by: kazuho
|
September 16, 2008 02:35 PM
Thanks for creating Greasemetal!
Any thoughts on how I can get user scripts to work with ajax requests? GM under FF works with AJAX http requests, but Greasemetal does not appear to. (Windows Vista)
Thanks!
Gary
Posted by: Gary
|
September 24, 2008 07:20 AM
Great stuff, thanks. It doesn't seem to work on secure (https:) pages though. Is there a way to get it to work? Greasemonkey on Firefox does. With Opera it doesn't work by default but there's an opera:config setting to allow it. Thanks.
Posted by: aspindog
|
September 27, 2008 03:28 AM
Please ignore the last comment; https: works, I was just running into a different error.
Posted by: aspindog
|
September 27, 2008 03:47 AM
I checked the greasemonky script 'webaborn'.
The script worked when typing URL directly or clicking a link with mouse-left-button.
But the script does not work when clicking a link with mouse-wheel-button to open new tab. Why..?
Posted by: いとうふ
|
October 4, 2008 12:18 AM
I'd just like to make a note on GreaseMetal. While the developer is still adding the UI, you can use an application I created called DocWatcher to automatically move .user.js files from your Downloads directory to your userjs directory when downloaded.
It should be fairly simple to do (read the documentation if you don't understand the application that well), but if you still have problems, you can email me at jrhodes@roket-productions.com
Note: You don't need the Plus edition if your downloads directory is under My Documents.
Posted by: Hach-Que
|
October 7, 2008 08:59 PM
Just a quick feature request that should be easy to implement: if you could read in any command-line options given to greasemetal and pass them along to Chrome, that would be excellent. I use a command-line switch to set a custom profile directory for chrome, so that would allow me to keep my user directory where it is.
Posted by: Isochronous
|
October 8, 2008 03:12 PM
> some GM_* functions
Looking on aagmfunctions.js from http://www.howtocreate.co.uk/operaStuff/userJavaScript.html
It contains emulations most of GM function for Opera browser.
It uses cookies for GM_[gs]etValue and emulation menu for GM_registerMenuCommand.
Posted by: Lex1
|
October 18, 2008 01:02 AM
+1 to Hach-Que's request to allow for command-line options. I want to use this with the --app option to run web applications.
Posted by: SpanishGringo
|
October 22, 2008 11:50 PM
Correction: Request by Isochronous, not Hach-Que
Posted by: SpanishGringo
|
October 22, 2008 11:55 PM
Thanks for the utility first.Yesterday I tried it on flickr photo sharing flickrPM user script. What I observed is, when I open a new tab by middle mouse button, the tab gets opened up where as my control is still in the current page. In this case, the scripts functionality is not working on new tab content. When I go there and refresh it again works. Looks like, current window (tab) only renders with scripts in place.
- my 2 cents
thanks in advance again
Sudhakar
Posted by: pingmepal
|
November 19, 2008 01:28 PM
Good article. Very informative. Thanks!
Posted by: viperson
|
November 27, 2008 01:07 AM
help a beginner, running Vista.
i installed GM, and placed YouTube Black into Documents/userjs.
Nothing happens. YouTube is not black.
Ideas?
Posted by: johny why
|
December 2, 2008 07:57 AM
Thanks for GM, I got my script to work. The only problem is, even with a 'hello world' script, it never works first time entering a page, it only ever works after you refresh or start clicking around on the site. Any ideas?
Posted by: Troy
|
December 9, 2008 07:54 AM
Kazuho, respect from Russia.
One problem, think you know, is that current greasemetal release doesn't work with latest GC release.
It's a pity.
Is it possible to resolve problem's reason? Sure it is! So, please, do it!
Dozens of GM fans are looking at you! =)
From Russia, with love.
Posted by: asdf
|
June 12, 2009 04:01 AM