|
1008
|
1 |
IriSP.Widgets.SpelSyncHtml = function(player, config) { |
|
|
2 |
console.log("Calling IriSP.Widget's constructor from IriSP.HelloWorldWidget"); |
|
|
3 |
IriSP.Widgets.Widget.call(this, player, config); |
|
|
4 |
} |
|
|
5 |
|
|
|
6 |
IriSP.Widgets.SpelSyncHtml.prototype = new IriSP.Widgets.Widget(); |
|
|
7 |
|
|
|
8 |
IriSP.Widgets.SpelSyncHtml.prototype.defaults = { |
|
|
9 |
src: "about:blank" |
|
|
10 |
} |
|
|
11 |
|
|
|
12 |
IriSP.Widgets.SpelSyncHtml.prototype.template = |
|
|
13 |
'<div class="Ldt-SpelSyncHtml"><iframe src="{{src}}" {{#width}}width="{{width}}"{{/width}} {{#height}}height="{{height}}"{{/height}}</div>'; |
|
|
14 |
|
|
|
15 |
IriSP.Widgets.SpelSyncHtml.prototype.draw = function() { |
|
|
16 |
this.renderTemplate(); |
|
|
17 |
var frame = this.$.find("iframe")[0], |
|
|
18 |
basesrc = this.src.replace(/#.*$/,''); |
|
|
19 |
this.getWidgetAnnotations().forEach(function(a) { |
|
|
20 |
a.on("enter", function() { |
|
|
21 |
if (a.content && a.content.data && a.content.data.ref_text) { |
|
|
22 |
frame.src = basesrc + '#' + a.content.data.ref_text; |
|
|
23 |
} |
|
|
24 |
}) |
|
|
25 |
}) |
|
|
26 |
} |