web/res/metadataplayer/SpelSyncHtml.js
author Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
Sun, 15 Feb 2015 00:43:16 +0100
changeset 1198 ff4b567d51f2
permissions -rw-r--r--
upgrade metadataplayer and add annotation creation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1198
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     1
IriSP.Widgets.SpelSyncHtml = function(player, config) {
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     2
    console.log("Calling IriSP.Widget's constructor from IriSP.HelloWorldWidget");
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     3
    IriSP.Widgets.Widget.call(this, player, config);
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     4
};
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     5
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     6
IriSP.Widgets.SpelSyncHtml.prototype = new IriSP.Widgets.Widget();
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     7
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     8
IriSP.Widgets.SpelSyncHtml.prototype.defaults = {
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
     9
    src: "about:blank"
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    10
};
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    11
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    12
IriSP.Widgets.SpelSyncHtml.prototype.template =
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    13
    '<div class="Ldt-SpelSyncHtml"><iframe src="{{src}}" {{#width}}width="{{width}}"{{/width}} {{#height}}height="{{height}}"{{/height}}</div>';
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    14
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    15
IriSP.Widgets.SpelSyncHtml.prototype.draw = function() {
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    16
    this.renderTemplate();
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    17
    var frame = this.$.find("iframe")[0],
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    18
        basesrc = this.src.replace(/#.*$/,'');
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    19
    this.getWidgetAnnotations().forEach(function(a) {
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    20
        a.on("enter", function() {
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    21
            if (a.content && a.content.data && a.content.data.ref_text) {
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    22
                frame.src = basesrc + '#' + a.content.data.ref_text;
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    23
            }
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    24
        });
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    25
    });
ff4b567d51f2 upgrade metadataplayer and add annotation creation
Yves-Marie Haussonne <1218002+ymph@users.noreply.github.com>
parents:
diff changeset
    26
};