Glitch Developers
API
Resources
Forum
Blog
Not logged in Sign in
Developer Forum »

# Discussion: Greasemonkey dev wanted!

Hey,
So I released the Glitch Companion some time ago, and the feedback has been pretty good so far.
The bad thing is that it's only available on a specific OS, and people have to download the app, then launch it everytime they log in to Glitch.
I would like to see it as a greasemonkey script, but unfortunately javascript is sorta beyond my knowledge.
And so I'm looking for a clever guy to port it to some webapp awesomeness so it could be available to everyone easily.
The kind of display I'm looking for is quite like this script from Tuff, which has been proven to work perfectly on top of the game UI.
I'm not sure everything is possible with GM, so here are some of the functions the app needs:
- always on top display with minimize option
- multi tab design
- additional overlay popups
- user preferences saved locally
- timer based loop actions
- image creation and edition
- hotkeys to access features
- hotkeys to send keystrokes (probably won't happen)
And that's basically all, so feel free to join if you like the idea :]
The source code of the Autohotkey script is available in the download if you want to have a look, I can add some comments here and there if needed
Also any ideas or pointers to make a specific feature are of course welcome
Posted 10 months ago by Lemo | Permalink
As a 'GM developer', here's are the things that are possible with GreaseMonkey/UserScripts:
- always on top display with minimize option - Simple HTML injection
- multi tab design - ditto, probably with a framework to make things easy
- additional overlay popups - ditto
- user preferences saved locally - localStorage would work here
- timer based loop actions - setTimeout, the usual
- image creation and editing - Should be possible via canvas. Depending on how complex you want the editing to be.
The last two, unfortunately, are unworkable as of now.
- hotkeys to access features
The problem is that Flash is greedy with keyboard capturing. As a plugin, it's also relatively low level compared to your userscript, which runs in a sandbox or in the page itself (using script injection). So to capture keystrokes, you'd have to focus out of the Flash plugin, but this requires at minimal mouse interactions (see Mozilla bug 93149), which pretty much defeats the purpose of having a shortcut script.
- hotkeys to send keystrokes (probably won't happen)
As above, this won't happen except, well there is FSCommand in Flash, which allows the movie to interact with external JavaScript. However, this would require some sort of interface to be present in the movie (game) already, and I doubt the developers have anything like this.
Posted 10 months ago by Boom and Bust | Permalink
Thanks for the help!
On the thread by Tuff, he thought the same about hotkeys...
Anyway, it's pretty neat that the rest may work, the localStorage thingie seems especially interesting
Posted 10 months ago by Lemo | Permalink
Okay, I'm not sure anyone will ever make a GM version of this, so in the meantime...
I decided to create a launcher button from Greasemonkey, that uses a new protocol handler glitchcom://, which is created by the script when it starts.
At least it already feels closer to a webapp experience, and all the shortcuts are in the same place
So, I included it inside the script from Tuff mentioned above, with the following code (extract):
var glitchcom = document.createElement("img");
glitchcom.addEventListener ("click", function() {
var button = document.createElement ("a");
location.href = "glitchcom://";
}, false);
I works just fine to launch the app, but while no window is created, the game still thinks the user has left the page, and displays the "You were about to win..." overlay.
I guess I would need to specify a _blank target, but I haven't found any way to do that so far with GM.
Also, the original script creates a "sink" iframe if that's something I could use.
EDIT: hmm the following actually seems to work, but it won't let me apply any CSS styling afterwards:
glitchcom.innerHTML = "<a href='glitchcom://' target='destSink'></a>";
Posted 9 months ago by Lemo | Permalink
Nevermind, got it to work with
window.open("glitchcom://","destSink");
So that'd be fine for the launcher :]
The whole GM port is still open though if anyone's interested :p
Posted 9 months ago by Lemo | Permalink