| author | ymh <ymh.work@gmail.com> |
| Wed, 04 Sep 2024 17:32:50 +0200 | |
| changeset 1072 | ac1eacb3aa33 |
| parent 1013 | 392ddcd212d7 |
| child 1079 | d4f0681c4ff1 |
| permissions | -rw-r--r-- |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
1 |
const SpelSyncHtml = function(ns) { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
2 |
return class extends ns.Widgets.Widget { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
3 |
constructor(player, config) { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
4 |
super(player, config); |
| 1008 | 5 |
console.log("Calling IriSP.Widget's constructor from IriSP.HelloWorldWidget"); |
| 1013 | 6 |
}; |
| 1008 | 7 |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
8 |
static defaults = { |
| 1008 | 9 |
src: "about:blank" |
| 1013 | 10 |
}; |
| 1008 | 11 |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
12 |
static template = |
| 1008 | 13 |
'<div class="Ldt-SpelSyncHtml"><iframe src="{{src}}" {{#width}}width="{{width}}"{{/width}} {{#height}}height="{{height}}"{{/height}}</div>'; |
14 |
||
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
15 |
draw() { |
| 1008 | 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 |
} |
|
| 1013 | 24 |
}); |
25 |
}); |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
26 |
}; |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
27 |
}} |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
28 |
|
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
29 |
export { SpelSyncHtml }; |