src/widgets/SpelSyncHtml.js
changeset 1072 ac1eacb3aa33
parent 1013 392ddcd212d7
child 1079 d4f0681c4ff1
equal deleted inserted replaced
1071:02c04d2c8fd8 1072:ac1eacb3aa33
     1 IriSP.Widgets.SpelSyncHtml = function(player, config) {
     1 const SpelSyncHtml = function(ns) {
       
     2     return class extends ns.Widgets.Widget {
       
     3         constructor(player, config) {
       
     4             super(player, config);
     2     console.log("Calling IriSP.Widget's constructor from IriSP.HelloWorldWidget");
     5     console.log("Calling IriSP.Widget's constructor from IriSP.HelloWorldWidget");
     3     IriSP.Widgets.Widget.call(this, player, config);
       
     4 };
     6 };
     5 
     7 
     6 IriSP.Widgets.SpelSyncHtml.prototype = new IriSP.Widgets.Widget();
     8 static defaults = {
     7 
       
     8 IriSP.Widgets.SpelSyncHtml.prototype.defaults = {
       
     9     src: "about:blank"
     9     src: "about:blank"
    10 };
    10 };
    11 
    11 
    12 IriSP.Widgets.SpelSyncHtml.prototype.template =
    12 static template =
    13     '<div class="Ldt-SpelSyncHtml"><iframe src="{{src}}" {{#width}}width="{{width}}"{{/width}} {{#height}}height="{{height}}"{{/height}}</div>';
    13     '<div class="Ldt-SpelSyncHtml"><iframe src="{{src}}" {{#width}}width="{{width}}"{{/width}} {{#height}}height="{{height}}"{{/height}}</div>';
    14 
    14 
    15 IriSP.Widgets.SpelSyncHtml.prototype.draw = function() {
    15 draw() {
    16     this.renderTemplate();
    16     this.renderTemplate();
    17     var frame = this.$.find("iframe")[0],
    17     var frame = this.$.find("iframe")[0],
    18         basesrc = this.src.replace(/#.*$/,'');
    18         basesrc = this.src.replace(/#.*$/,'');
    19     this.getWidgetAnnotations().forEach(function(a) {
    19     this.getWidgetAnnotations().forEach(function(a) {
    20         a.on("enter", function() {
    20         a.on("enter", function() {
    22                 frame.src = basesrc + '#' + a.content.data.ref_text;
    22                 frame.src = basesrc + '#' + a.content.data.ref_text;
    23             }
    23             }
    24         });
    24         });
    25     });
    25     });
    26 };
    26 };
       
    27     }}
       
    28 
       
    29 export { SpelSyncHtml };