summaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-04-20 22:28:26 -0700
committerAlex Yatskov <alex@foosoft.net>2016-04-20 22:28:26 -0700
commit1ce6a00faf3941130d526ccda23ed34b0ba7917a (patch)
treef4aafa6bac84d12d2b78ae2c2cbec16b8dcca784 /ext/fg/js
parent7ef0f4e8818e58f4623da48ca63d76f501e13376 (diff)
WIP
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/popup.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index 868f07ce..e48703bf 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -17,3 +17,29 @@
*/
+class Popup {
+ constructor() {
+ this.offset = 10;
+
+ this.popup = document.createElement('iframe');
+ this.popup.id = 'yomichan-popup';
+ this.popup.addEventListener('mousedown', (e) => e.stopPropagation());
+ this.popup.addEventListener('scroll', (e) => e.stopPropagation());
+
+ document.body.appendChild(this.popup);
+ }
+
+ show(cont, pos) {
+ this.popup.style.left = pos.x + 'px';
+ this.popup.style.top = pos.y + 'px';
+ this.popup.style.visibility = 'visible';
+ }
+
+ hide() {
+ this.popup.style.visibility = 'hidden';
+ }
+
+ update(cont) {
+ this.popup.setAttribute('srcdoc', cont);
+ }
+}