Clear questions and runnable code
get the best and fastest answer
Re^2: Monk Links - Copy Perlmonks-links to the clipboard in on-site-formatby bart (Canon)
|on Oct 27, 2006 at 23:48 UTC||Need Help??|
Apart from the bugs that you have tried to patch up earlier, kwaping found another link that didn't work well in your current FF extension: Voting/Experience System. So I took the plunge and looked at how it all ticked...
I found out you were using the wrong function, you shouldn't have used decodeURI(), but unescape()!
Anyway, unescape() fixed it, and I could just completely remove your kludge.
Get the patched version at http://users.pandora.be/bartl/monklinks/. There are two archives: the patched XPI file, and a ZIP archive containing the same files but unpacked, ready for editing, plus a little Windows batch script (just run it by doubleclicking) to wrap up the files, possibly after editing, back into a new XPI file. You need an Info-ZIP compatible command line ZIP, which comes with UnxUtils, for example.
BTW people, if you're having trouble installing the XPI file directly from the site, just save it to disk and drop it on Firefox, either on a window, or on its program icon.
Ah, another feature I added was support for plain links, which get turned into the [http://...|link text] format, taking care to remove any "[", "]" and "|" characters from the text.
Oh, and I moved its position in the popupmenu to a more appropriate place, right under the "Copy Link Location" item.
I've got a few more ideas still, like adding support for other types of PM links, such as to http://perldoc.org/, as well as copying the URL and title (or perhaps selected text) of the current page in case you rightclicked on something other than a link — thus, something like Copy URL + does. The latter seems like a big change to me, so it will be for another day. Ideally, it should still work after you submitted a POST, so, in that case, it should scan for the node id in the current page.
I left your copyright and author notices completely unaltered, I just bumped the version number from 0.3 to 0.3.1. It's still your baby.
p.s. I don't have Firefox 2 as yet, so it's not compatible with it yet. Feel free to try if it could still work, by editing install.rdf in the root dir, and bumping up the <em:maxVersion> value, and repackage.
p.p.s. I started out from the version you put up on planetscape's site. You say here it's version 0.5, though internally, everything said 0.3. Oh well.
Update Now version 0.3.2, supports more link styles: module:// and dist:// for CPAN, doc:// for perldoc.perl.org, href:// for odd links on this site, and plain http:// for anything else. It'll try to uyse the actual link text for the less normalized URLs (the latter two). And I've upped the maxVersion to 2.0, though I haven't tried it, I have the impression not much has changed in the Firefox Extension API. Here's for hoping.
Same URL for the directory listing.