logo

Oooh, You Greasey Monkey!

I had a quick play with Greasemonkey today and I like it. I like it a lot. My first taste came from installing Adrian Holovaty's Google Suggest script. Bored waiting for Google to actually implement their suggest feature he's written a script to add it to Google by default.

The idea of Grease Monkey is quite simple. You write some JavaScript code. You tell it which pages to run on and, whenever you visit one of those pages it runs. The pages I've already linked to describe it perfectly well, so I'll leave it at that.

It only remains to wonder how we can use this with Domino. Using a simple pattern (http://*/*.nsf*) we can easily catch a Domino URL. What then? What annoys you about Domino site that you could change with a script? You have the idea and I'll write the script. Right now I'm lost for an idea. Can you tell?

Obviously you can run the scripts on a site-by-site basis and have one especially for the Notes.net forum if you want to change something about that. The possibilities are endless. Which makes me wonder why, in the time it's taken to write this blog, I couldn't think of anything better than this lame effort:

CodeStore Search Focus Script - Forces your cursor to focus on the search box whenever you visit codestore. Only slightly less than useless and potentially very annoying. Use at your own risk.

Comments

    • avatar
    • Chris Brewer
    • Wed 6 Apr 2005 20:06

    Easy! Just write a massive complicated javascript that rewrites Domino's shocking output into some that's vaguely nearing compliant html! :)

    • avatar
    • Greg
    • Wed 6 Apr 2005 20:21

    How about disabling the "disable right click" function that is on so many pages. That one drives me nuts.

    • avatar
    • Jake Howlett
    • Thu 7 Apr 2005 01:43

    Can't do that Chris. Once the HTML has been delivered that's that. All we can do it manipulate the DOM. Anything we do do will have no effect on what's in a View Source.

    Greg. Easily done but it's not really a Domino-specific problem.

    • avatar
    • Jake Howlett
    • Thu 7 Apr 2005 02:11

    Thinking about it Greg, this is a user preference in Mozilla anyway. In Advanced Javascript Options there's an option to not allow context menus to be replaced.

    • avatar
    • Greg
    • Thu 7 Apr 2005 03:46

    Hi Jake,

    Of course you're right on both counts. I've been racking my brain for Domino-centric uses but so far I've drawn a blank. The only things I could come up with all refer to what Chris mentioned earlier, and that is something that I can't control on user's browsers, so "the monkey" isn't going to help anyway.

    Cheers

    Greg

    • avatar
    • Jorge Coelho
    • Thu 7 Apr 2005 06:45

    The one thing I can think of from a general searching perspective is to open links from a search in a new window automatically. When I perform a search for something the first link isn't always the one I want to visit, so I find myself opening each link in a new window. True that you can right-click or [Ctl]+Click to open a new window, but it would be much easier to keep the results window open while opening each result you click on in its own separate window.

    • avatar
    • Craig
    • Thu 7 Apr 2005 09:24

    How about an alternative to your "Don't show the 'Next Page' link when there isn't one" article. Could you hide the link/ image or something?

    • avatar
    • Skate
    • Thu 7 Apr 2005 11:22

    So with greas monkey would it be possible to add an icon or change the look of a link that does a javascript pop-up?

    Another thought would be to enable a search result from a notes.net forum to open in a new window with all responses automatically opened in new tabs, in order...

    • avatar
    • Keith
    • Thu 7 Apr 2005 11:45

    How about a script that adds a search box to any Domino web site. While most blogs have this, a lot of intranet sites don't, as search must be programmed in. Having it added automatically via GreaseMonkey might be cool.

  1. This sounds really cool. The only downside is that it's limited to the scope of your browser alone. How interesting would it be if people could contribute scripts to other websites ala wiki that could be selectively enabled / disabled by the end users....

    One (non domino) thing that comes to mind is building a filter for cookies that are set with javascript, another for hiding images (especially those coming from domains not equal to that of the page... like ads). You really can customize your personal experience extensively through the DOM.

    • avatar
    • Jake Howlett
    • Thu 7 Apr 2005 14:41

    Jorge. I might have a go at this if I get chance later.

    Skate. You could examine all links and add an icon after it to warn of JavaScript but it would be tricky (impossible!?) to tell whether it actully launched a popup or not.

    Keith. Hmm. Possible? You'd have to know the name of a view to search for starters.

    Jerry. What you're describing sounds like Greasemonkey as is. Users can contribute scripts for a site and the user can select which ones they want to run. It's not limited to your browser alone, as long as you make the .js file available publically, anybody can use it.

    • avatar
    • Michael
    • Thu 7 Apr 2005 16:16

    I agree, it sounds cool and I'll check it out tonight but my hypocrisy alarm is sounding off (Firefox extensions == Activex for IE). I know it's a stretch, but until this type of client-side DHTML 'modding' is available across all the browsers,then there's not much point messing with it.

    It may get to the point where you have nth levels of this page 'modding' going on and exactly where does security fit into the equation? I'm not sure if I want to do my online banking while some gee-whiz suspect script is also trapping keystrokes with the keypress event behind the scenes. Alarmist yes, but I prefer the cautious approach.

    Features always have a cost. Just look at M$

    • avatar
    • Jake Howlett
    • Thu 7 Apr 2005 17:17

    Michael. I don't see it as anything like ActiveX. It's not even a tool for web decvelopers really. It's just a way to let users fix niggly bugs or add much needed features to sites. All it does is run some JavaScript. Any webpage can do that already. With Greasemonkey you actually choose to run it and can see what code it is running. I can't see the issue with it.

    • avatar
    • Michael
    • Thu 7 Apr 2005 22:18

    Jake. As I said it's an alarmist reaction, but there is a difference here. It's not the normal javascript that you encounter on a website in that the context is the script is along for the ride when you use the 'all sites' script option. Would you want someone to stand beside you every time you use an ATM?

    Let's say someone writes a great 'all sites' script, works wonders and you can't live without it. Fast forward a few revisions later and you find yourself updating this script without thinking twice as it's been great so far. You could look at the source and make a judgement call but what about the js clueless.

    I think a little script like that could possibly turn ugly and use the domain's cookies to store encoded keystrokes for a length of time and then later post them along with the domain info via a xmlhttprequest url parameter in the future.

    I know it's not ActiveX, but there is a leap of faith involved with the 'all sites' option that does not sit well with me. I know sites can be excluded, but I'm sure each one of us has forgotten to secure some posession at one time or another. I hope I'm wrong with this take on GreaseMonkey and I will look for the safeguards in place to secure this extension's capabilities. With security holes in numerous products, I won't give this one the benefit of the doubt from the get-go.

    Again, I hope I'm wrong, but ...... WAIT

    You know, I was just about to post this and was second guessing myself. So I thought I would do a quick look at their blog and search for security items and there it was.....

    {Link}

    Look at the blog entry titled ' And now for something less snarky..' dated Wednesday, March 23rd 2005

    passwords??? They think that's it?? I think a few weeks of keystroke logging would virtually give away anyone's identity/savings/the works. They have some serious work to do.

    Regards, Michael

  2. *snip*

    Jerry. What you're describing sounds like Greasemonkey as is. Users can contribute scripts for a site and the user can select which ones they want to run. It's not limited to your browser alone, as long as you make the .js file available publically, anybody can use it.

    *snip*

    I think what Jerry is getting at is that when you choose to install a script for a site, it's installed in your browser. So if you go to someone else's house and use their browser, the script isn't there if that person doesn't have it. The idea would be that the scripts would live on the site, like gMail, and when you log in you could choose to enable them. They would then be enabled for your username when you log in at any computer that has Firefox and Greasemonkey.

    • avatar
    • Jake Howlett
    • Fri 8 Apr 2005 13:33

    I can see the potential for harm but then I can't see this ever being anything more than a power-user's toy. That said, we should know better than installing any old code on our PCs. The web's a dangerous place. We know that and should be careful anyway. It's all about trust. And common sense of course.

  3. ok... i think this justifies installation automatically - anything else is just a bonus {Link}

    havent done much web dev for a while but rings some bells that it might be a solution to get around some of the flaws in IE's Iframe & SSL issues we had a while back

    • avatar
    • Romano Soprano
    • Mon 18 Apr 2005 04:13

    All you Domino developers check LDDMonkey at {Link}

    Reading the LDD forums just got a lot easier!

    The problem with the Notes.net/LDD forums ( {Link} ) is that you can't see the text of any of the responses associated with a particular message. You get a list of links to the responses at the bottom of the page, but you can only open a single message at a time -- which is a huge pain if there are more than about 2 responses to a message.

    What this script does (thanks to the magic of Greasemonkey) is to add a little [+] next to each response link at the bottom of the page. If you click on that [+], it will open a <div> beneath the link that will get populated with the message body for that particular response. Click it again, and the response body disappears.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment:


About This Page

Written by Jake Howlett on Thu 7 Apr 2005

Share This Page

# ( ) '

Comments

The most recent comments added:

Skip to the comments or add your own.

You can subscribe to an individual RSS feed of comments on this entry.

Let's Get Social


About This Website

CodeStore is all about web development. Concentrating on Lotus Domino, ASP.NET, Flex, SharePoint and all things internet.

Your host is Jake Howlett who runs his own web development company called Rockall Design and is always on the lookout for new and interesting work to do.

You can find me on Twitter and on Linked In.

Read more about this site »

Elsewhere

Here are the external links posted on the same day.

More links are available in the archive »

More Content