Tag Archive - operator

SIMILE Actions for Operator

So far, actions for Operator have focused on exporting data or connecting to an existing web service. Rosie Morales from MITRE has shown that actions can do much more interesting things, like actually create new views of the microformats by saving the data to a local file and displaying it. These actions are based on the Simile project.

Note these actions only work properly with Operator 0.8b.

The Simile Timeline action is an action that acts on all events on a web page. It creates a local file that contains a Simile Timeline representation of the data and then displays it.

The Exhibit Timeline action is an action that acts on all events on a web page. It creates a local file that contains a Exhibit Timeline representation of the data and then displays it.

The Exhibit action is an action that acts on all contacts on a web page or one contact on a web page. It creates a local file that contains a Exhibit representation of the data and then displays it.

I will be documenting how you can create an action that acts on all instances of a given microformat very soon.

Operator and hAudio

One of the cool things that you can do with Operator is experiment with new microformats. The folks at Digital Bazaar and others have been working on an hAudio microformat and David Lehn has created some experimental Operator User Scripts for you to try out. hAudio.js contains the primary microformat. money.js is used to allow actions on currencies.

You can try out these microformats on the site Bitmunk, as well as WebOrganics

Writing User Scripts for Operator

I think the APIs in Operator 0.8b have settled down enough that I can start to document how to write user scripts. Note these user scripts are for Operator, NOT for Firefox 3. How things will work in Firefox 3 hasn’t been decided yet. And I am working very hard to make this the final API for Operator 1.0.

What are Operator User Scripts?

Operator user scripts are user added pieces of JavaScript that can enable additional functionality within Operator like new actions for microformats and RDF, as well as adding new microformats. Examples can be found on the Operator User Scripts page. User scripts are added to Operator by opening Options and selecting the User Scripts tab. You can then select a user script that has been saved to your local hard drive. People have asked why I don’t allow user scripts to be installed directly from the web similar to Greasemonkey scripts. There are two reasons. First, the code to do that detection is licensed under GPL, so I can’t just take it and put it in Operator. Second, Operator user scripts operate with the same security privileges as an extension so they can pretty much do anything they want. That’s not something you want to install in a drive by situation.

Writing a User Scripts

I’m going to have separate pages for the user script documentation, rather than using posts. The first one is here – Creating a Microformat Action User Script (Basic). As always, I appreciate feedback, especially from folks that have already written actions. And speaking of actions, we have some new ones to add to the list:

Enjoy!

Operator 0.8b is Available

I have made a beta of Operator 0.8 available. Continued thanks to Elias Torres for the RDFa support.

Operator 0.8b adds a much requested feature – an operator icon on the location bar. It’s not perfect yet, but it is there. Also, I updated the action API a little bit to allow for the naming of actions as well as having actions act on multiple properties in a microformat. For instance, in the past, the “Goto web page” action only worked for the first URL in an hCard. Now it will work for all the URLs.

The other big fix in this release was that there were cases where sorting/removing duplicates didn’t work correctly. For action developers, I added the ability to have multiple translations of an action in one action. I’ll document that soon.

All the caveats from Operator 0.8a apply, so please read them.

Please report bugs here.

Have fun.

New Actions for Operator 0.8

I know I’ve been slacking on posting information on how to create actions for Operator 0.8. I’ve been tweaking the API a little bit, so that’s why I’ve been hesitant. Operator 0.8 beta will be very soon, and then I’ll post a tutorial on creating actions.

In the mean time, I have been working with a few folks to get their actions working on Operator 0.8.

  • The Minimap Addon gives you a suite of built-in maps and mapping tools for your web browser. And it also supports integration with Operator.
  • Egon Willighagen is using RDFa combined with an Operator action to allow for searching PubChem from the Chemical Blogspace. More information is available in his post.
  • Søren Johannessen has updated his actions for the Danish Blogosphere for Operator 0.8. You can read about them and download them at microformats.dk.
  • Pelle Wessman has updated his actions for the Swedish Blogosphere for Operator 0.8. You can read about them and download them at http://pelle.vox.nu/.
  • Charl van Niekerk has created actions for the African Blogosphere for Operator 0.8. You can read about them and download them at http://blog.charlvn.za.net/.

And I’ve been adding/updating some of my user scripts. These include support for the license microformat, as well as some improvements to species.

Incidentally, the improvements to the action API will NOT break actions already written for Operator 0.8. The improvements include the ability to translate your actions into other languages, the ability to customize the name that appears for your action in the Operator dropdowns and the ability to have multiple items in the action menu for something that appears multiple times in a microformat. For instance, in the past, even if an hCard had multiple web pages, there was only one action that opened the first web page. Now an action can detect the multiple web pages and display unique action names for each of them.

Stay tuned!

Operator 0.8a is Available

I have made an alpha of Operator 0.8 available. Special thanks to Elias Torres for the RDFa support.

My primary goal with Operator 0.8a was to attempt to finalize APIs for both Operator and Firefox 3. What I actually ended up with is very similar to the APIs I created with the very first version of Operator. You can see the microformats API for Firefox 3 here (looking for feedback). I’ll be documenting the action and microformats API more completely in the next few days.

New features in this release include:

  • RDFa support (view only – there are no actions yet)
  • Unified actions architecture – actions are no longer specific to a microformat
  • Support for Address microformat to allow some actions (like map lookups) to be more granular.
  • Better support for iframes/frames/nested documents
  • Debug mode uses X2V for hCards and hCalendars
  • Support for non HTML documents
  • Bug fixes galore.

One feature I removed that I know people will complain about is the ability to have custom names for the actions. If I get enough complaints, I’ll put this back.

IMPORTANT NOTE: This release uses new preferences so it will wipe out your old prefs. This should be the last time that happens. I also changed the location of user scripts so it won’t pick up your old ones (they won’t work anyway).

If you want new user scripts, check out: http://www.kaply.com/weblog/operator-user-scripts/

If you have user scripts you want to quickly port to Operator 0.8, please send them to me and I’ll help.

Please report bugs here.

Have fun.

Where is the next version of Operator?

You might have heard from Elias Torres that we have RDFa working in Operator. You might also be wondering where that version is.

Basically I’ve been working very hard to finalize the APIs so that I can get things ready for Firefox 3. You can take a look at them here. The ironic part is that I’ve actually gone back to the way I wrote Operator the first time in terms of how microformats and actions are added to Operator. I’ll be documenting this soon. And if you wrote to any of my other APIs, I’ll work with you to move things to the new model.

So what do you have to look forward to in Operator 0.8a?

  • RDFa support
  • Unified action architecture (actions on the toolbar aren’t specific to microformats)
  • Support for non HTML documents
  • A final architecture for actions and microformats so people can start coding to it
  • Debug mode displays X2V output
  • Export All available in “Microformats mode”
  • Lots of bug fixes

Stay tuned. Just some fine tuning and we’re good to go.

Microformats and Firefox 3 (for Developers)

So let’s talk about what Firefox 3 will hopefully offer for developers. The goal is that extension authors will have an API to access microformatted data directly without worrying about parsing. In addition, there will be a model for adding additional microformats, as well as adding semantic actions (more about that in a minute). Here’s what the API looks like right now.

Any microformat can be instantiated from a DOM Node:

var hcard = new hCard(DOMNode);

Once the microformat has been instantiated, members can be accessed directly, like hcard.fn. If the property is defined as an array in the microformat specification, it is an array in the newly created object. A pointer to the original DOM node is also stored in this object if you want to do anything to the microformat node on the glass.

Microformat objects can be queried from a document:

var hCards = Microformats.get(document, "hCard");

I need a better name for this one I think. Given a document and a microformat type, this API returns an array of objects that represent each microformat in the document. I’m not sure if this should go through all the child frames and return every microformat in every sub document. I have to think about that.

If you have DOM Nodes, you might need some information about them. The scenario here is what if you have a DOM Node and you don’t know if it is a microformat or not? What APIs could help you?

Microformats.isMicroformat(DOMNode)

This function tells you if the specific DOM Node you passed in is a microformat. It returns a boolean.

Microformats.getParentMicroformatNode(DOMNode)

This function gets the first microformat that is a parent of this node. If you pass in a microformat, it still gets the parent. This is important for finding nested microformats.

Microformats.getMicroformatNamesFromNode(DOMNode)

This function returns an array of the microformat types that this node represent.

So here's how you might use those three functions, for instance when a context menu is displayed on a given node:

  if (Microformat.isMicroformatNode(node)) {
    mfNode = node;
  } else {
    mfNode = Microformats.getParentMicroformatNode(node);
  }
  while (mfNode) {
    var mfNames = Microformats.getMicroformatNamesFromNode(mfNode);
    /* enumerate through names and do something */
    mfNode = Microformats.getParentMicroformatNode(mfNode);
  }

I mentioned semantic actions earlier. I'm still working on how I can create an action model that is easily extensible. In an earlier post, I suggested that actions be implemented like this:

semanticActions.actions.youtube_search_tags = {
  description: "Find videos on YouTube",
  icon: "http://youtube.com/favicon.ico",
  scope: {
    semantic: {
      "tag" : "tag"
    }
  },
  doAction: function(semanticObject, semanticObjectType) {
    if (semanticObject.tag) {
      return("http://youtube.com/results?search_query=" + encodeURIComponent(semanticObject.tag));
    }
  }
};

I'm now trying to decide if I should use a function method, something like:

semanticActions.addAction("youtube_search_tags", youtube_object);

There will be much more on that later.

Anyway, I'm primarily looking for feedback from people. Are these APIs sufficient? Did I miss something obvious? Thanks for the input.

Microformats and Firefox 3 (for Users)

I’m now the official owner of microformats support in Firefox 3. Here is the preliminary design document.

At this point, we’ll primarily be focusing on making microformats available to extension developers, with very little UI. The primary motivator behind this is that I don’t think anyone has come up with a good user interface for microformats. I want to take some time to bring up some different UI paradigms and have some general discussion on these ideas just to see what people think. We’re actually trying to have a UI discussion on the labs forums, but we’re not getting much input so I thought I would try here.

So far there have been multiple extensions with multiple ways to interact with microformats:

  • Operator (toolbar, status bar button, toolbar button, right click on microformats)
  • WebCards (in page “cards” – notifcation ribbon on the bottom of the screen, right click on microformats)
  • Tails Export (sidebar)
  • Tails (icon on the status bar – window presenting content of the microformats)

Some of the other ideas that have been floated have been using the Firefox notification bar to inform about microformats, in page highlighting of microformats, notifications on the URL bar similar to RSS feeds and changing the mouse pointer. You can see some of these ideas at Alex Faaborg’s blog.

The primary concern we have in creating a microformats UI is that it’s not necessarily something that is going to be accessed a lot (like a back button for instance, or bookmarks), so how much screen real estate should it take?

With Operator, my original plan was to allow for many different UI paradigms, and I’m continuing that in the next release by allowing individual buttons for specific microformats (a Contacts toolbar button for instance). So now I’m putting the question to you:

What UI paradigm for microformats do you prefer? Is there a paradigm you wish was in Operator (like a sidebar for instance)? What do you think microformats should look like in Firefox 3?

Feel free to come up with any wild idea you want.

In my next post, I’ll be talking about what we should do for developers.

Operator Action Architecture

One of the things I’ve been trying to finalize for the next release of Operator is the action architecture. Here’s what things look like now.


ufJSActions.actions.corkd_search_tags = {
  description: "Find wines on Cork'd",
  icon: "http://corkd.com/favicon.ico",
  scope: {
    semantic: {
      "tag" : "tag"
    },
    url: "http://corkd.com"
  },
  /*
   * Perform an action
   *
   * @param semanticObject JavaScript representation of the semantic object
   * @param semanticObjectType Semantic object type as a string
   * @param domNode DOM Node associated with the semantic object
   * @return If you return a value, we attempt to open it as a url
   */
  doAction: function(semanticObject, semanticObjectType, domNode) {
    if (semanticObjectType == "tag") {
      if (semanticObject.tag) {
        return("http://corkd.com/tags/" + encodeURIComponent(semanticObject.tag));
      }
    }
  }
};

First let’s talk about scope. Semantic scope is about indicating which microformats (and in the future other semantic data) this actions works with. On the left is the type of semantic data, on the right is the required value. So for instance, if you had an action that worked on hCalendar and required a dtstart, it would be “hCalendar” : “dtstart”. You can use url to specify that an action should only be displayed when you are on a certain web page.

Next, let’s talk about the action itself. When you return a value from an action, we assume it is a URL and open it. If you want to do your own thing (like export a vCard), you can do arbitrary JavaScript and just return. I’m also working on a “doActionAll” which will allow on action to act on all microformats of a given type on a web page.

What do people think of this overall design? Is it simple enough to encourage anyone to write actions? Am I missing anything obvious?

Page 3 of 6«12345»...Last »