From 5f74c473cef4564ad2040d9211f70b4f0ac048f1 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Thu, 14 Apr 2016 20:36:00 -0700 Subject: Switch to iframe --- ext/fg/js/client.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'ext/fg/js') 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); }); } -- cgit v1.2.3