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

Re: Laziness, Lizards and Monks

by hossman (Prior)
on Apr 02, 2003 at 20:15 UTC ( [id://247585]=note: print w/replies, xml ) Need Help??


in reply to Laziness, Lizards and Monks

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>

Replies are listed 'Best First'.
Re^2: Laziness, Lizards and Monks
by data64 (Chaplain) on Jul 14, 2005 at 20:17 UTC

    "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.

Re^2: Laziness, Lizards and Monks (bookmarklet-ized versions)
by Aristotle (Chancellor) on Apr 02, 2003 at 20:41 UTC
    ?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"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://247585]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-23 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found