metadataplayer/metadataplayer/HelloWorld.js
author ymh <ymh.work@gmail.com>
Fri, 09 Nov 2012 18:34:36 +0100
changeset 27 a50cdd64c1f2
parent 0 222f9654ed39
permissions -rw-r--r--
Bump version nb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
     1
/* Shows an example of a widget, with :
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
     2
 * - Use of source data
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
     3
 * - Use of templating
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
     4
 * - Use of internationalization
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
     5
 */
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
     6
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
     7
IriSP.Widgets.HelloWorld = function(player, config) {
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
     8
    console.log("Calling IriSP.Widget's constructor from IriSP.HelloWorldWidget");
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
     9
    IriSP.Widgets.Widget.call(this, player, config);
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    10
}
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    11
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    12
IriSP.Widgets.HelloWorld.prototype = new IriSP.Widgets.Widget();
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    13
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    14
IriSP.Widgets.HelloWorld.prototype.defaults = {
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    15
    text: "world"
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    16
}
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    17
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    18
IriSP.Widgets.HelloWorld.prototype.template =
222f9654ed39 Added metadataplayer with examples and docs
veltr
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>';
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    20
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    21
IriSP.Widgets.HelloWorld.prototype.messages = {
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    22
    "fr": {
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    23
        "Hello" : "Bonjour,"
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    24
    },
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    25
    "en" : {
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    26
        "Hello" : "Hello,"
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    27
    }
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    28
}
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    29
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    30
IriSP.Widgets.HelloWorld.prototype.draw = function() {
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    31
    this.renderTemplate();
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    32
    console.log("HelloWorldWidget was drawn");
222f9654ed39 Added metadataplayer with examples and docs
veltr
parents:
diff changeset
    33
}