Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Laziness, Lizards and Monks

by Aristotle (Chancellor)
on Apr 02, 2003 at 14:29 UTC ( #247497=monkdiscuss: print w/ replies, xml ) Need Help??

I've made myself a couple of Mozilla bookmarks with keywords that let me navigate the monastery as well as CPAN with very little hassle and thought I'd share. I've been using them for a while, and I can't imagine doing without these neat little helpers anymore.
<!DOCTYPE NETSCAPE-Bookmark-file-1> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> <TITLE>Keywords</TITLE> <H1>Keywords</H1> <DL><p> <DT><H3 ID="NC:BookmarksRoot#$e04aa1df">Keywords</H3> <DL><p> <DT><A HREF="http://www.perlmonks.org/index.pl?node=%s" SHORTC +UTURL="pm">Perl Monks Search</A> <DT><A HREF="http://www.perlmonks.org/?node_id=106&op=message& +message=%s" SHORTCUTURL="pmc">Perl Monks Chat</A> <DT><A HREF="http://www.perlmonks.org/?node_id=106&op=message& +message=/msg+put_your_username_here+[id://%s]" SHORTCUTURL="pmb">Perl + Monks Bookmark</A> <DT><A HREF="http://search.cpan.org/search?mode=module&n=100&q +uery=%s" SHORTCUTURL="cpan">CPAN Module query</A> <DT><A HREF="http://freshmeat.net/search/?section=projects&q=% +s" SHORTCUTURL="fm">freshmeat.net</A> <DT><A HREF="http://www.freedb.org/freedb_search.php?allfields +=NO&fields=artist&fields=title&allcats=YES&grouping=cats&words=%s" SH +ORTCUTURL="fd">freedb.org</A> <DT><A HREF="http://www.google.com/search?num=100&q=%s" SHORTC +UTURL="gw">Google Web</A> <DT><A HREF="http://images.google.com/images?safe=off&q=%s" SH +ORTCUTURL="gi">Google Image</A> <DT><A HREF="http://www.google.com/search?svnum=100&cat=gwd/To +p&q=%s" SHORTCUTURL="gd">Google Directory</A> <DT><A HREF="http://news.google.com/news?svnum=100&q=%s" SHORT +CUTURL="gn">Google News</A> <DT><A HREF="http://groups.google.com/groups?num=100&q=%s" SHO +RTCUTURL="gg">Google Groups</A> </DL><p> </DL><p>
To use, DL the code, save the file somewhere, search&replace "put_your_username_here" with your own username, go to Mozilla's bookmark manager and import it. You'll get a new folder "Keywords" in your bookmarks, and henceforth you'll have the following shortcuts available to type into the addressbar:
pm foo
Mnemonic for "Perl Monks". Go to node "foo". As always, you can also enter a node ID there. I usually "enter" the monastery by typing "pm 106" into my addressbar, bringing me to The Default Node.
pmc blah blah blah
Mnemonic for "Perl Monks Chat". You will utter "blah blah blah" onto the chatterbox. This is cool, though not very useful.
pmb 31415
Mnemonic for "Perl Monks Bookmark". This needs a node ID, which it turns into an [id://31415] style link to /msg to yourself. Intended to be used while browsing, deleting the usual http://www.perlmonks.org/index.pl?node_id= prefix in the address bar and typing "pmb " in front of the node ID.
cpan Foo::Bar
Perform a CPAN module query for Foo::Bar.

As a freebie, you also get qw(gw gg gd gi gn) shortcuts for Google Web, Groups, Directory, Images and News searches, respectively, an fm shortcut for Freshmeat queries and an fd one for freedb searches.

Have fun!

Makeshifts last the longest.

20030403 Edit by Corion: s!\broot\b!put_your_username_here! (plus some other minor formattings)

Comment on Laziness, Lizards and Monks
Download Code
Re: Laziness, Lizards and Monks
by jasonk (Parson) on Apr 02, 2003 at 15:06 UTC

    And here is one for perldoc:

    <DT><A HREF="http://www.perldoc.com/cgi-bin/htsearch?words=%s" ADD_DA +TE="1047840101" LAST_VISIT="1047840095" LAST_MODIFIED="1047840151" SH +ORTCUTURL="perldoc" LAST_CHARSET="ISO-8859-1">perldoc</A>

    We're not surrounded, we're in a target-rich environment!

      when htdig was down on Perldoc.com, I started using Google instead

      <DT><A HREF="http://www.google.com/search?as_q=%s&as_sitesearch=www.perldoc.com" ADD_DATE="1033263654" LAST_VISIT="1047314043" LAST_MODIFIED="1033263668" SHORTCUTURL="perldoc" ICON="http://www.google.com/favicon.ico" LAST_CHARSET="ISO-8859-1">[perldoc] Perl functions and module lookup</A>
Re: Laziness, Lizards and Monks
by hossman (Prior) on Apr 02, 2003 at 20:15 UTC
    Mnemonic for "Perl Monks". Go to node "foo". As always, you can also enter a node ID there. I usually "enter" the monastery by typing "pm 106" into my addressbar, bringing me to The Default Node.

    As an added bonus, bookmark URLs can be javascript, so you can make it "do the right thing" even if you don't specify a node Id...

    <DT><A HREF="javascript: var s = %22%s%22; self.location = ((%22%s%22 +== s) ? %22http://www.perlmonks.org/%22 : (%22http://www.perlmonks.or +g/index.pl?node=%22 + s))" ADD_DATE="1049314231" LAST_MODIFIED="10493 +14310" SHORTCUTURL="pm">PerlMonks</A>
      ?node=106 works the same as ?node_id=106 anyway. Sorry, I misread the code. Nice one.

      Makeshifts last the longest.

        um ... that wasn't really my point.

        What I was saying is that you can use javascript in the bookmark to see if the "keyword" was given any input or not. In the version I posted, if you type "pm" you get the PerlMonks front page. If you type "pm nodeId" it goes to a particular node.

        For PerlMonks this doesn't matter all that much, but for other things (like perldoc or cpan) it's nice to have a good "default" other then whatever the default search is. It also means that if you select that bookmark from the bookmark menu (or click that link when looking at your bookmarks page) you don't wind up trying to go to nodeId "%s"

      "javascript: var s = %22%s%22; self.location = ((%22%s%22 == s) ? %22http://www.perlmonks.org/%22 : (%22http://www.perlmonks.org/index.pl?node=%22 + s))"

      Not sure how many people actually use this, but those of you on Firefox would have noticed the above does not actually work correctly any more. It always goes to perlmonks home page and never does a search. It does work fine on Mozilla Seamonkey though. I finally traced this to a slight difference in how it works in Firefox and Seamonkey. Below code does seem to work on both. I had to split the %s into two strings in the comparison with variable s to stop firefox from trying to replace it.

      javascript: var s = "%s"; self.location = (("%" + "s" == s) ? "http://www.perlmonks.org/" : ("http://www.perlmonks.org/index.pl?node=" + s));

      A corresponding one for Perl documentation

      javascript: var s = "%s"; self.location = (("%" + "s" == s) ? "http://perldoc.perl.org/" : ("http://perldoc.perl.org/search.html?q=" + s));

        Yeah, at some point in the firefox code tree, keyword bookmarks stoped replacing just the furst %s, and started replacing them all .. i'm not sure when exactly i noticed it happening, but i had forgotten all about this thread.

        thanx for the followup.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://247497]
Approved by ybiC
Front-paged by bart
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2014-09-18 22:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (126 votes), past polls