/*extern ufJS, ufJSActions, ufJSParser, openUILink */ 

/*
Desc: A user script to use the hCard validator with the
	  Operator extension for Firefox.
Author: Matthias Pfefferle
URL: http://notizblog.org

validarot url: http://hcard.geekhood.net

Other Operator 0.9 User Scripts see http://www.kaply.com/weblog/operator-user-scripts/ 
*/

function de_init() {
	var hcard_validator = {
	  description: "Validate hCard",
	  shortDescription: "Validate hCard",
	  icon: "http://microformats.org/favicon.ico",
	  scope: {
	    semantic: {
	      "hCard" : "hCard",
	    }
	  },
	  doAction: function(semanticObject, semanticObjectType) {
	  	var pageurl;
      	if (semanticObject.node.ownerDocument) {
        	pageurl = semanticObject.node.ownerDocument.URL;
      	} else {
        	pageurl = semanticObject.node.URL;
      	}
      	var url = encodeURIComponent(pageurl);
		
	    return "http://hcard.geekhood.net/?url=" + url + "#result";
	  }
	};

	SemanticActions.add("hcard_validator", hcard_validator);
}
de_init();
