Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Monk Links - Copy Perlmonks-links to the clipboard in on-site-format

by Tanktalus (Canon)
on Mar 06, 2005 at 20:36 UTC ( #437080=note: print w/ replies, xml ) Need Help??


in reply to Monk Links - Copy Perlmonks-links to the clipboard in on-site-format

It took me a bit to realise what you were doing. Especially since I don't know anything about XPIs, Javascript, or XULs.

First off, I want to say that I have it working (finally) on Firefox on Linux. So there should be some good news there - it's been tested on non-Windows :-)

Secondly, "invoking" is not entirely clear to me. So I want to expand on how it's working for me, which I presume is how it's working for everyone else.

Basically, you must right-click on an actual href anchor link, aka, <a href="http://(?:www)\.perlmonks\.(?:com|org)"> in HTML. The actual text above, "http://www.perlmonks.org/?node_id=12345", doesn't quite cut it, as I erroneously inferred. Thus, right-click here. Of course, if you're using a left-handed mouse, left-click there. Whatever. ;-) Then one of the options will be "make PM-link". Select that, obviously. Note that, at least here, it's not coming up with a keyboard shortcut (no letter is underlined).

What would be cool for extentions, holli, is if you did likewise for perldoc, doc, and cpan links. :-) Of course, isn't it always the case - start off with something simple and cool, and everyone wants to add stuff to make it ugly and bloated ;-} Regardless of whether you do this or not, I've got this version installed. Thank you!


Comment on Re: Monk Links - Copy Perlmonks-links to the clipboard in on-site-format
Download Code
Re^2: Monk Links - Copy Perlmonks-links to the clipboard in on-site-format
by holli (Monsignor) on Mar 06, 2005 at 20:59 UTC
    Ah, it seems I am not very good at writing documentations.
    What would be cool for extentions, holli, is if you did likewise for perldoc, doc, and cpan links.
    Actually I have a new version ready that works for cpan://* and kobes://* links, but there is a ugly bug. The entity %3A (double colon) gets not correctly decoded by the decodeURI function. I am trying to figure out why.

    As for the perldoc, I will add that when I am sure the currently selected perldoc site will not change.


    holli, /regexed monk/
      As a quick hack, you could do decodeURI(s).replace('%3a',':');.
        Thanks a lot The Mad Hatter. But that must be decodeURI(s).replace(/%3a/gi,':');. Otherwise only the first occurance is replaced.


        holli, /regexed monk/
      That might be because decodeURI is a complement to encodeURI which encodes non-valid entities. : is avalid entity in a URI

      --
      In Bob We Trust, All Others Bring Data.

      decodeURI "does not decode escape sequences that could not have been introduced by encodeURI."

      In other words, decodeURI won't return an invalid URI, like decoding %3A does or could do. You can't safely decode an entire URI. Each path segment, each attribute key and each attribute value must be isolated before they can be decoded. For example http%3A//www.google.com/ (a relative URI) and http://www.google.com/ (an absolute URI) are not equivalent.

      Not what you want:

      decodeURI("http://search.cpan.org/search?mode=module&query=XML%3A%3APa +rser")

      What you want:

      decodeURIComponent("XML%3A%3AParser")

      Since your code already extracts the compenent, simply use

      clickedLink = "[cpan://" + decodeURIComponent(array[1]) + "]";

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2014-07-29 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls