Plain Text URLs

Talk about add-ons and extension development.
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Plain Text URLs

Post by Ted Mielczarek »

Since there was some demand, I've created an extension to open plain text URLs from the context menu.

http://ted.mielczarek.org/code/mozilla/textlink.xpi (content-type is set correctly, you can click to install)

Issues:
1) Localization is not working, so I stripped it out for now. The files are all still in the jar. If anyone can make the localized text work, I'd appreciate it if you could tell me how. I copied my usage straight from some other extensions, yet it fails to work.
2) The Regexp for matching URLs doesn't seem to work. The context menu items should be disabled when you don't have a URL selected. Anyone want to figure out why this doesn't work? I'm sure the regexp itself is fine, but my Javascript isn't that great, so I could be missing something.

Comments are appreciated.
Gena01
Posts: 138
Joined: November 5th, 2002, 6:12 pm
Contact:

Localization

Post by Gena01 »

Can you try to use &popup-textlink-open-tab.label instead of &popup-textlink-open-tab:label

Gena01
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Re: Localization

Post by Ted Mielczarek »

Gena01 wrote:Can you try to use &popup-textlink-open-tab.label instead of &popup-textlink-open-tab:label

Gena01


Nope. Same problem. I get "XML Parsing Error: Unknown entity" or some such thing, if that means anything special to anyone. Obviously it can't find the DTD for some reason.
clav
Posts: 1974
Joined: November 5th, 2002, 3:25 am
Location: Lancaster, UK
Contact:

Post by clav »

using my install.js i see :)
Gena01
Posts: 138
Joined: November 5th, 2002, 6:12 pm
Contact:

XUL debugging.

Post by Gena01 »

Actually all I get when I try to add localization is a bar bellow statusbar with a red line from xul file, no message or anything. With an arrow pointing at "<menuitem" like 2nd character of that line.

Is there a way to enable some sort of debugging messages to show up?

Gena01
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Re: XUL debugging.

Post by Ted Mielczarek »

Gena01 wrote:Actually all I get when I try to add localization is a bar bellow statusbar with a red line from xul file, no message or anything. With an arrow pointing at "<menuitem" like 2nd character of that line.

Is there a way to enable some sort of debugging messages to show up?

Gena01


Navigate to the chrome url of the offending file, and you'll see the actual error. In this case, that would be chrome://textlink/content/textlinkOverlay.xul

Would be nice if there was a way to log these errors to a console or something. Maybe there is if you run a debug build.
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

clav wrote:using my install.js i see :)


I had forgotten which extension I stole that from, but it's quite nice, thanks!
clav
Posts: 1974
Joined: November 5th, 2002, 3:25 am
Location: Lancaster, UK
Contact:

Post by clav »

a small point. In chrome://textlink/content/textlinkOverlay.xul you've used the dtd:

<!DOCTYPE window SYSTEM "chrome://textlink/locale/textlink.dtd">

whereas it should be:

<!DOCTYPE overlay SYSTEM "chrome://textlink/locale/textlink.dtd">

since <overlay> is the root element of the document



unfortuately fixing this doesn't seem to get Phx to see the entity defintions :(
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

window vs overlay

Post by Ted Mielczarek »

Yeah, I think I changed overlay to window to see if it would work that way, I must have seen it in someone else's code. It's a strange problem indeed. I'm not sure what I'm doing wrong.
Gena01
Posts: 138
Joined: November 5th, 2002, 6:12 pm
Contact:

Post by Gena01 »

Hmm... is this phoenix specific? It doesn't seem to work with Phoenix 0.4, but then again there could have been something changed regarding XUL localizations. It seems that the code should work, since I don't see the problem if resolving entities, and I also saw similar things with other extensions.

P.S. It seems that digger extension is localization enabled and seems to work. Still have no idea why, maybe because in digger case it's tried to the toolbar....

Gena01
User avatar
djst
Moderator
Posts: 2826
Joined: November 5th, 2002, 1:34 am
Location: Sweden
Contact:

Post by djst »

I really don't have time to test this, but if it's working, I'd be happy to add it to the Extensions list at Phoenix Help. Let me know if this is what you want.
Gena01
Posts: 138
Joined: November 5th, 2002, 6:12 pm
Contact:

I got it to work.

Post by Gena01 »

Hey guys I got it to work. Apparently it didn't register the locale dtd properly. to check try:
chrome://textlink/locale/textlink.dtd
in normal install it should drump the contents of the DTD file, in my case it was giving me an error saying it can't find the file under phoenix\chrome\EN-US\....

here is a one liner fix:
remove locale version 0.1 from your content/texlink/contents.rdf Description section. And don't forget to rename the XUL files to reference the DTD. :)

Gena01
User avatar
shoestring
Posts: 156
Joined: November 5th, 2002, 3:40 pm
Location: Geekhaven, MA, USA

Post by shoestring »

This is a very cool extension.

I wonder if it's possible to add a bit of code to it to strip off things like parens around a URL, an actual problem I've run into, where double clicking a URL of the form "(http://www.someplace.net)" not surprisingly selects the delimiting "()" as well as what's between them.

If the extension could somehow check for this kind of thing, it would be great. Probably checking for parens, brackets, curlies and angles would be enough ...

Oops, quotes too!

Seems like it shouldn't be <I>too</I> hard to do ... or ... ?
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Re: I got it to work.

Post by Ted Mielczarek »

Gena01 wrote:Hey guys I got it to work. Apparently it didn't register the locale dtd properly. to check try:
chrome://textlink/locale/textlink.dtd
in normal install it should drump the contents of the DTD file, in my case it was giving me an error saying it can't find the file under phoenix\chrome\EN-US\....

here is a one liner fix:
remove locale version 0.1 from your content/texlink/contents.rdf Description section. And don't forget to rename the XUL files to reference the DTD. :)

Gena01


Cool, thanks, I'll update this in a few, and stick the new version up. Now I just have to fix that Regex part...
Ted Mielczarek
Posts: 1269
Joined: November 5th, 2002, 7:32 am
Location: PA
Contact:

Post by Ted Mielczarek »

shoestring wrote:This is a very cool extension.

I wonder if it's possible to add a bit of code to it to strip off things like parens around a URL, an actual problem I've run into, where double clicking a URL of the form "(http://www.someplace.net)" not surprisingly selects the delimiting "()" as well as what's between them.

If the extension could somehow check for this kind of thing, it would be great. Probably checking for parens, brackets, curlies and angles would be enough ...

Oops, quotes too!

Seems like it shouldn't be <I>too</I> hard to do ... or ... ?


Yeah, if I can get that Regex support working, I should be able to remove illegal characters from both sides fairly easily. I'll try to get that in soon. I've noticed even these forums have that problem, i.e. http://www.example.com. screws it up.
Post Reply