front_idill/src/player/metadataplayer/HelloWorld.js
author bastiena
Thu, 24 May 2012 10:30:05 +0200
changeset 33 2d9b15f99b4e
parent 31 2c7fc855eba8
permissions -rw-r--r--
Front IDILL : search by curves added search by type added notifications added timeline improved
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
     1
/* Shows an example of a widget, with :
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
     2
 * - Use of source data
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
     3
 * - Use of templating
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
     4
 * - Use of internationalization
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
     5
 */
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
     6
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
     7
IriSP.Widgets.HelloWorld = function(player, config) {
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
     8
    console.log("Calling IriSP.Widget's constructor from IriSP.HelloWorldWidget");
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
     9
    IriSP.Widgets.Widget.call(this, player, config);
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    10
}
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    11
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    12
IriSP.Widgets.HelloWorld.prototype = new IriSP.Widgets.Widget();
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    13
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    14
IriSP.Widgets.HelloWorld.prototype.defaults = {
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    15
    text: "world"
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    16
}
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    17
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    18
IriSP.Widgets.HelloWorld.prototype.template =
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    19
    '<div class="Ldt-HelloWorld"><p>{{l10n.Hello}} {{text}}</p><p>Looks like we have {{source.contents.annotation.length}} annotations in this feed</p></div>';
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    20
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    21
IriSP.Widgets.HelloWorld.prototype.messages = {
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    22
    "fr": {
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    23
        "Hello" : "Bonjour,"
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    24
    },
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    25
    "en" : {
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    26
        "Hello" : "Hello,"
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    27
    }
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    28
}
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    29
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    30
IriSP.Widgets.HelloWorld.prototype.draw = function() {
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    31
    this.renderTemplate();
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    32
    console.log("HelloWorldWidget was drawn");
2c7fc855eba8 FRONT IDILL :
bastiena
parents:
diff changeset
    33
}