From 1ce6a00faf3941130d526ccda23ed34b0ba7917a Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Wed, 20 Apr 2016 22:28:26 -0700 Subject: WIP --- ext/fg/js/popup.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'ext') 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); + } +} -- cgit v1.2.3