diff options
| -rw-r--r-- | content_scripts/ui_component.coffee | 25 | ||||
| -rw-r--r-- | content_scripts/vimium.css | 7 | ||||
| -rw-r--r-- | manifest.json | 3 |
3 files changed, 27 insertions, 8 deletions
diff --git a/content_scripts/ui_component.coffee b/content_scripts/ui_component.coffee index 77c52d3d..21431bd7 100644 --- a/content_scripts/ui_component.coffee +++ b/content_scripts/ui_component.coffee @@ -5,12 +5,29 @@ class UIComponent options: null constructor: (iframeUrl, className, @handleMessage) -> + styleSheet = document.createElement "style" + styleSheet.type = "text/css" + # Default to everything hidden while the stylesheet loads. + styleSheet.innerHTML = "* {display: none !important;}" + # Load stylesheet. + xhr = new XMLHttpRequest() + xhr.onload = (e) -> styleSheet.innerHTML = xhr.responseText + xhr.open "GET", chrome.runtime.getURL("content_scripts/vimium.css"), true + xhr.send() + @iframeElement = document.createElement "iframe" - @iframeElement.className = className - @iframeElement.seamless = "seamless" - @iframeElement.src = chrome.runtime.getURL iframeUrl + extend @iframeElement, + className: className + seamless: "seamless" + src: chrome.runtime.getURL iframeUrl @iframeElement.addEventListener "load", => @openPort() - document.documentElement.appendChild @iframeElement + shadowWrapper = document.createElement "div" + # PhantomJS doesn't support createShadowRoot, so guard against its non-existance. + shadowDOM = shadowWrapper.createShadowRoot?() ? shadowWrapper + shadowDOM.appendChild styleSheet + shadowDOM.appendChild @iframeElement + document.documentElement.appendChild shadowWrapper + @showing = true # The iframe is visible now. # Hide the iframe, but don't interfere with the focus. @hide false diff --git a/content_scripts/vimium.css b/content_scripts/vimium.css index 794803fe..fb8824c2 100644 --- a/content_scripts/vimium.css +++ b/content_scripts/vimium.css @@ -275,10 +275,11 @@ body.vimiumFindMode ::selection { /* Vomnibar Frame CSS */ iframe.vomnibarFrame { - background-color: transparent !important; + background-color: transparent; padding: 0px; overflow: hidden; + display: block; position: fixed; width: calc(80% + 20px); /* same adjustment as in pages/vomnibar.coffee */ min-width: 400px; @@ -303,11 +304,11 @@ div#vimiumFlash { /* UIComponent CSS */ iframe.vimiumUIComponentHidden { - display: none !important; + display: none; } iframe.vimiumUIComponentVisible { - display: block !important; + display: block; } iframe.vimiumUIComponentReactivated { diff --git a/manifest.json b/manifest.json index 1d5a2df4..2cf453f8 100644 --- a/manifest.json +++ b/manifest.json @@ -68,6 +68,7 @@ "default_popup": "pages/popup.html" }, "web_accessible_resources": [ - "pages/vomnibar.html" + "pages/vomnibar.html", + "content_scripts/vimium.css" ] } |
