summaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-04-14 20:36:00 -0700
committerAlex Yatskov <alex@foosoft.net>2016-04-14 20:36:00 -0700
commit5f74c473cef4564ad2040d9211f70b4f0ac048f1 (patch)
treefc1edf0dede7b783eb0de5b4eece24ba13e6ec43 /ext/fg/js
parentba3e0c65327bae982001d2d2f83ece2650ae3687 (diff)
Switch to iframe
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/client.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/ext/fg/js/client.js b/ext/fg/js/client.js
index 20838e10..ea18e41f 100644
--- a/ext/fg/js/client.js
+++ b/ext/fg/js/client.js
@@ -25,10 +25,8 @@ class Client {
this.enabled = false;
this.options = null;
- this.popup = document.createElement('div');
+ this.popup = document.createElement('iframe');
this.popup.classList.add('yomichan-popup');
- this.popup.addEventListener('mousedown', (e) => e.stopPropagation());
- this.popup.addEventListener('scroll', (e) => e.stopPropagation());
document.body.appendChild(this.popup);
chrome.runtime.onMessage.addListener(this.onMessage.bind(this));
@@ -109,8 +107,8 @@ class Client {
this.hidePopup();
} else {
range.setEnd(range.endContainer, range.startOffset + length);
- renderText({defs: results}, 'defs.html', (html) => {
- this.popup.innerHTML = html;
+ renderText({defs: results, root: chrome.extension.getURL('fg')}, 'defs.html', (html) => {
+ this.popup.setAttribute('srcdoc', html);
this.showPopup(range);
});
}