My 'links' command has been around for a while - I guess similar to
text2link - but actually just re-writes the html on the page to enable
links (mailto, ftp, mailto, etc...) Dunno if that would be useful to
people...

You can get it from here - http://kollektive.com/ubiquity/

CmdUtils.CreateCommand({
  names: ['links', 'parse links', 'urls', 'url'],
  arguments: [ {role: 'object', nountype: noun_arb_text, label:
'html'} ],
  homepage: "http://kollektive.com/ubiquity/";,
  author: { name: "Alan Ogilvie", email: "[email protected]"},
  license: "MPL",
  description: "Enables links in a selection. [Works in Ubiquity 0.5 -
updated for new parser]",
  help: "Understands most protocols, as well as creating mailto links.
However, due to a minor issue in Ubiquity it strips other HTML tags if
you select large areas - not a bit problem if you just use it to make
links work in a selection.",

  _parsestring: function(instr) {
        instr = new String(instr);
        instr = instr.replace(/((ftp|http|https|gopher|mailto|news|nntp|
telnet|wais|file|prospero|aim|webcal):(([A-Za-z0-9$_.+!*(),;/?:@&~=-])|
%[A-Fa-f0-9]{2}){2,}(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*(),;/?:@&~=%-]*))?
([A-Za-z0-9$_+!*();/?:~-]))/gi,'<a href="$1" target="_blank">$1</a>');
        instr = instr.replace(/((([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-
z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w
{1,63}\.[a-zA-Z]{2,6})/gi,'<a href="mailto:$1";>$1</a>');
        return instr;
  },

  execute: function(args) {
        CmdUtils.setSelection(this._parsestring(args.object.html));
  },
  preview: function( pblock, args ) {
    var instr = new String(args.object.html);
    if( instr.length < 1 ){
      pblock.innerHTML = CmdUtils.renderTemplate("Given a selection
this will enable links and mailtos.");
      return;
    }

    pblock.innerHTML = "Parsed: ";
    try{ pblock.innerHTML += this._parsestring(args.object.html) }
    catch(e) { pblock.innerHTML += "?"; }
  }
});


On Aug 26, 5:29 am, Jaquez <[email protected]> wrote:
> I replied on the blog post to vote for a "go (to)" command.  I
> mentioned text2url but I didn't really feel like that meshed with the
> Ubiquity way of doing things so I looked around for a true "go"
> command.
>
> I found something but it was not compatible with parser 2 so I
> modified it to my liking.  It took me about an hour as it was my first
> Ubiquity command but you guys did a great job of making it super easy!
>
> It was so easy, in fact, that I quickly made a second one to fulfill
> another wish of mine: I hate it when someone references a bugzilla bug
> outside of bugzilla and you don't get that handy little tooltip that
> tells you the bug title and status.  Ubiquity to the rescue!
>
> The source for both are below.  Feel free to modify or make
> suggestions as there is certainly room for improvement.
>
> CmdUtils.CreateCommand({
>   names: ["go"],
>   icon: "http://www.mozilla.com/favicon.ico";,
>   description: "Navigates to the URL specified.",
>   help: "Type or select a URL to open it.",
>   author: {name: "Christopher Robert Jaquez", email:
> "[email protected]"},
>   license: "GPL",
>   homepage: "http://labs.mozilla.com/";,
>   arguments: [{role: 'goal', nountype: noun_type_url, label:
> "destination URL"}],
>   preview: function preview(pblock, url) {
>         Utils.parseRemoteDocument(
>       url.goal.text, // URL
>       null, // post data
>       function(doc) { // success callback
>         var title = jQuery("head > title", doc).text();
>         pblock.innerHTML = "Go to <b>" + title + "</b> at " +
> url.goal.text;
>       },
>       function() { // error callback
>         pblock.innerHTML = "You must specify a valid URL.";
>       }
>     );
>   },
>   execute: function execute(url) {
>     Utils.openUrlInBrowser(url.goal.text);
>   }
>
> });
>
> CmdUtils.CreateCommand({
>   names: ["bugzilla"],
>   icon: "http://www.mozilla.com/favicon.ico";,
>   description: "Navigates to the Bugzilla bug.",
>   help: "Type or select a bug ID to open it.",
>   author: {name: "Christopher Robert Jaquez", email:
> "[email protected]"},
>   license: "GPL",
>   homepage: "http://labs.mozilla.com/";,
>   arguments: [{role: 'object', nountype: noun_type_number, label: "bug
> ID"}],
>   preview: function preview(pblock, bug) {
>     pblock.innerHTML = "Please wait while the data is retrieved for
> <b>Bug " + bug.object.text + "</b>.";
>     var url = "https://bugzilla.mozilla.org/show_bug.cgi?id="; +
> bug.object.text;
>         Utils.parseRemoteDocument(
>       url, // URL
>       null, // post data
>       function(doc) { // success callback
>         var title = jQuery(".bz_alias_short_desc_container", doc).html
> ();
>                 var status = jQuery(".edit_form > tbody > tr:first-child", 
> doc).html
> ();
>         pblock.innerHTML = title + "<br />" + status;
>       },
>       function() { // error callback
>         pblock.innerHTML = "You must specify a bug ID.";
>       }
>     );
>   },
>   execute: function execute(bug) {
>     var url = "https://bugzilla.mozilla.org/show_bug.cgi?id="; +
> bug.object.text;
>     Utils.openUrlInBrowser(url);
>   }
>
> });
>
> On Aug 19, 1:20 pm, Jono <[email protected]> wrote:
>
> > Hi everybody,
> > For Ubiquity 0.6 we want to include a whole bunch of new useful
> > commands in the standard feeds.  Let's talk about what should be
> > included.  I'd like to finalize the list of commands this week.
>
> > Commands that I would be really excited to have added are:
> > - Go to (url)   (where url uses a nountype based on your awesomebar,
> > so it completes to URLs just like if you had typed into the
> > awesomebar.)
> > - Insert (url)    (using the same nountype.  I insert links into email
> > a lot, and I always have to open a new tab to figure out the right
> > URL, then copy and paste it.  This command would save me a lot of
> > time.)
> > - Find (text)  (Searches across all tabs for the given text, so can be
> > used as a way to switch to a tab by content.  Sort of like the "Leap"
> > command described in The Humane Interface.  I would use this all the
> > time.)
> > - Google (text) in this site  (Uses google search-in-site with the
> > domain of the current page.  I would use this a lot too.  I believe
> > there's a third-party implementation that does this; we should
> > approach the author about incorporating it.)
>
> > I also think we should look at expanding the search commands to cover
> > more international sites -- not just English-language sites.  For
> > example, I think we ought to include popular Chinese sites like Baidu,
> > Taobao, and Youku.  This is another way of reaching out to a more
> > international audience, and complements our localization strategy.
>
> > Beyond that, Heather has pointed out that the 3rd party commands for
> > interfacing withFacebookare very popular and might be worth
> > uplifting into the standard social feed.  Heather, are there others
> > that you know of too?
>
> > I started a thread on my blog to ask about people's favorite 3rd-party
> > commands.  It's 
> > here:http://jonoscript.wordpress.com/2009/08/07/your-favorite-3rd-party-ub...
> > One person mentions a command called TextToLink which he thinks ought
> > to be built-in.
>
> > Finally, there was some discussion of image-editing commands during
> > the last ubiquity weekly meeting, but that's another can of worms that
> > I'd like to cover in a separate topic.
>
> > Please share your suggestions for more commands to add in 0.6!
> > --Jono
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to