I have just discover??https://builder.mozillalabs.com/??and I can not do less than testing it !

So, ythis is the code of my First Firefox Plugin. ??yes, totally unuseful, but it's a test !

var widgets = require("widget");
var tabs = require("tabs");

var widget = widgets.Widget({

label: "Mozilla",

image: "

",

onClick:function(e){

}

});

widgets.add(widget);

var widget2 = widgets.Widget(

{

label: "Random Flickr Photo Widget",

onReady: function(e) {

var imgNode = e.target.querySelector(".pc_img");

this.content = imgNode.src;

},

onLoad: function(e) {

var self = this;

require("timer").setTimeout(function() {

??self.content = "http://www.flickr.com/explore/";

}, (5 * 1000));

},

onClick: function(e) {

tabs.open(this.content);

}


});

widgets.add(widget2);

Connect to builder.mozillalabs.com, create your own account, and try this code.

A new toolbar will appear at window bottom and show 2 icons:

Capture1

  1. a link to this blog, click it, you will get a new tab with this blog.
  2. an icon with a changing image every 5 seconds (it's a test !) rolling mages from flickr. Click on it, you will open a new tab to show currently iconified image.

So now, you can create your own plugin

Publicités