bookmarklet via greasemonkey idea

3 views
Skip to first unread message

ekbworldwide

unread,
Dec 26, 2008, 8:14:19 PM12/26/08
to GMarks
I don't know what the status of bookmarklets in gmarks is - but how
about if gmarks enabled bookmarklets via a google search (or something
better) and a very simple (just a few lines) greasemonkey script?

The problem with my idea is that a google search has to be done before
the bookmarklet runs. I can't think of a way to avoid that.

The key concept is to make the bookmarklet - from a google bookmarks
stand point - 100% ordinary. It's the greasemonkey script that
converts it into a bookmarklet. And the script allows bookmarklets to
be enabled/disabled easily.

example

1
bookmarklet
javascript:alert("test");

2
a bookmark to run the bookmarklet (num / suggon / safe ) exist in this
example
http://www.google.com/search?aq=f&num=100&hl=en&lr=&suggon=0&safe=off&as_qdr=all&q=javascript%3Aalert(%22test%22)%3B&btnG=Search

3
And the greasemonkey script converts any google search starting with
"javascript:" into a bookmarklet.

Chris

unread,
Dec 26, 2008, 11:31:23 PM12/26/08
to GMa...@googlegroups.com
Since I'm a complete newbie, please pardon my cluelessness...  Why would a bookmarklet be restricted to Google searches?  From what I've just read, bookmarklets contain URLs, which don't necessarily point to Google.

On the other hand, why do we need Gmarks to be compatible with bookmarklets?  Can you give a usage example where Firefox's functionality is enhanced by such compatibility?

Thanks!
Chris

ekbworldwide

unread,
Dec 27, 2008, 3:13:03 AM12/27/08
to GMarks
> Since I'm a complete newbie, please pardon my cluelessness...  Why would a
> bookmarklet be restricted to Google searches?

Um... My idea is a hack to allow bookmarklets to be stored at google
bookmarks.

> From what I've just read,
> bookmarklets contain URLs, which don't necessarily point to Google.

Bookmarklets start with "javascript:" - they do *not* point to urls.
Google bookmarks only allows (as far as I know) urls. So if you

save bookmarklet
save a bookmark that points to a local file

After you close firefox and open it again the urls are erased and
replaced with about:blank

The hack example...

= The alert is "hidden" inside the google search
= The (unwritten) greasemonkey script sees that search starts with
"javascript:" and converts it to a bookmarklet

============
new idea
The greasemonkey script could allow bookmarklets that point to a local
file.
============

Q: Why would I want gmarks to use bookmarklets?
A: It would be great if I could have all my bookmarklets available at
google bookmarks. If I'm away from home - I can't access any
bookmarklet.

> Can you give a usage example where Firefox's functionality is
> enhanced by such compatibility?

Right now - I use >gt< for a google keyword torrent search

possible searches

gt "name_of_the_film"
gt "name_of_the_film" year
gt intitle:"name_of_the_film"
gt intitle:"name_of_the_film" year
gt intitle:"name_of_the_film" intitle:year
etc.

What I wish I could do - allow gmarks to have a sort of "keyword plus"
search.

Note
I haven't written this yet for ff bookmarks. In fact - I'm not sure if
it's possible to do via ff bookmarks and the address bar.

If gmarks allowed bookmarklets I could type in the bookmarklet name in
quick search and have the bookmarklet allow me to decide which one of
those searches I wanted to do - on the fly.

Chris

unread,
Dec 27, 2008, 9:07:18 AM12/27/08
to GMa...@googlegroups.com
I agree that a bookmarklet isn't an ordinary URL, but let's not quibble over terms.  I know very well how a javascript: "URL" works; JavaScript is my original and most familiar programming language.

I now understand why a Google search is required, but, depending on what you want the bookmarklet to do, Firefox already has this functionality:
http://lifehacker.com/software/geek-to-live/geek-to-live-fifteen-firefox-quick-searches-129658.php  Would a GMarklet still do anything extra?

Chris

Chris

unread,
Dec 27, 2008, 9:14:04 AM12/27/08
to GMa...@googlegroups.com
P.S.  I didn't mean to contradict the tone of my previous message, but the context completely changed from bookmarklets (specific) to JavaScript (general).
Reply all
Reply to author
Forward
0 new messages