src/widgets/HelloWorld.js
branchnew-model
changeset 875 43629caa77bc
parent 870 2c025db10a10
child 1013 392ddcd212d7
equal deleted inserted replaced
874:38b65761a7d5 875:43629caa77bc
       
     1 /* Shows an example of a widget, with :
       
     2  * - Use of source data
       
     3  * - Use of templating
       
     4  * - Use of internationalization
       
     5  */
       
     6 
       
     7 IriSP.Widgets.HelloWorld = function(player, config) {
       
     8     console.log("Calling IriSP.Widget's constructor from IriSP.HelloWorldWidget");
       
     9     IriSP.Widgets.Widget.call(this, player, config);
       
    10 }
       
    11 
       
    12 IriSP.Widgets.HelloWorld.prototype = new IriSP.Widgets.Widget();
       
    13 
       
    14 IriSP.Widgets.HelloWorld.prototype.defaults = {
       
    15     text: "world"
       
    16 }
       
    17 
       
    18 IriSP.Widgets.HelloWorld.prototype.template =
       
    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>';
       
    20 
       
    21 IriSP.Widgets.HelloWorld.prototype.messages = {
       
    22     "fr": {
       
    23         "Hello" : "Bonjour,"
       
    24     },
       
    25     "en" : {
       
    26         "Hello" : "Hello,"
       
    27     }
       
    28 }
       
    29 
       
    30 IriSP.Widgets.HelloWorld.prototype.draw = function() {
       
    31     this.renderTemplate();
       
    32     console.log("HelloWorldWidget was drawn");
       
    33 }