src/js/widgets/helloWorldWidget.js
branchnew-model
changeset 870 2c025db10a10
parent 868 a525cc2214e7
equal deleted inserted replaced
868:a525cc2214e7 870:2c025db10a10
     1 IriSP.HelloWorldWidget = function(Popcorn, config, Serializer) {
     1 IriSP.i18n.addMessages({
     2   IriSP.Widget.call(this, Popcorn, config, Serializer);
     2     "fr": {
       
     3         "Hello" : "Bonjour,"
       
     4     },
       
     5     "en" : {
       
     6         "Hello" : "Hello,"
       
     7     }
       
     8 })
       
     9 
       
    10 IriSP.HelloWorldWidget = function(player, config) {
       
    11     console.log("Calling IriSP.Widget's constructor from IriSP.HelloWorldWidget");
       
    12     IriSP.Widget.call(this, player, config);
       
    13     if (typeof this.text == "undefined") {
       
    14         this.text = 'world'
       
    15     }
     3 }
    16 }
     4 
    17 
     5 IriSP.HelloWorldWidget.prototype = new IriSP.Widget();
    18 IriSP.HelloWorldWidget.prototype = new IriSP.Widget();
     6 
    19 
     7 IriSP.HelloWorldWidget.prototype.draw = function() {
    20 IriSP.HelloWorldWidget.prototype.draw = function() {
     8     this.selector
    21     var _tmpl = '<p>{{l10n.Hello}} {{text}}</p><p>Looks like we have {{source.contents.annotation.length}} annotations in this feed</p>'
     9         .append('Hello, world')
    22         _html = IriSP.templToHTML(_tmpl, this);
    10         .css({
    23     this.$.append(_html);
    11             "text-align" : "center",
    24     this.$.find('p').css({
    12             "padding": "10px 0",
    25         "text-align" : "center",
    13             "font-size" : "14px"
    26         "margin": "10px 0",
    14         });
    27         "font-size" : "14px"
       
    28     });
       
    29     console.log("HelloWorldWidget was drawn");
    15 }
    30 }