src/widgets/HelloWorld.js
author durandn
Tue, 01 Sep 2015 15:31:46 +0200
changeset 1046 eb77616c245f
parent 1013 392ddcd212d7
child 1020 198c2b79f5e1
child 1072 ac1eacb3aa33
permissions -rw-r--r--
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea

/* Shows an example of a widget, with :
 * - Use of source data
 * - Use of templating
 * - Use of internationalization
 */

IriSP.Widgets.HelloWorld = function(player, config) {
    console.log("Calling IriSP.Widget's constructor from IriSP.HelloWorldWidget");
    IriSP.Widgets.Widget.call(this, player, config);
};

IriSP.Widgets.HelloWorld.prototype = new IriSP.Widgets.Widget();

IriSP.Widgets.HelloWorld.prototype.defaults = {
    text: "world"
};

IriSP.Widgets.HelloWorld.prototype.template =
    '<div class="Ldt-HelloWorld"><p>{{l10n.Hello}} {{text}}</p><p>Looks like we have {{source.contents.annotation.length}} annotations in this feed</p></div>';

IriSP.Widgets.HelloWorld.prototype.messages = {
    "fr": {
        "Hello" : "Bonjour,"
    },
    "en" : {
        "Hello" : "Hello,"
    }
};

IriSP.Widgets.HelloWorld.prototype.draw = function() {
    this.renderTemplate();
    console.log("HelloWorldWidget was drawn");
};