aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/ui_component.coffee
diff options
context:
space:
mode:
authormrmr19932014-12-30 15:31:30 +0000
committermrmr19932014-12-30 15:31:30 +0000
commit7e6b2c5a8439cf8c1e861e3f596915a75ecb9644 (patch)
treec834912f054e0c6b1237ea63b1e4e169371480b9 /content_scripts/ui_component.coffee
parentf946d23125a80233799564b57253ace2c44b8994 (diff)
downloadvimium-7e6b2c5a8439cf8c1e861e3f596915a75ecb9644.tar.bz2
Use classes and a stylesheet for UIComponen
Diffstat (limited to 'content_scripts/ui_component.coffee')
-rw-r--r--content_scripts/ui_component.coffee13
1 files changed, 6 insertions, 7 deletions
diff --git a/content_scripts/ui_component.coffee b/content_scripts/ui_component.coffee
index 8b229725..c4ed3bf6 100644
--- a/content_scripts/ui_component.coffee
+++ b/content_scripts/ui_component.coffee
@@ -2,8 +2,6 @@ class UIComponent
iframeElement: null
iframePort: null
showing: null
- showStyle: "display: block;"
- hideStyle: "display: none;"
constructor: (iframeUrl, className, @handleMessage) ->
@iframeElement = document.createElement "iframe"
@@ -34,20 +32,21 @@ class UIComponent
if @showing
# NOTE(smblott) Experimental. Not sure this is a great idea. If the iframe was already showing, then
# the user gets no visual feedback when it is re-focused. So flash its border.
- borderWas = @iframeElement.style.border
- @iframeElement.style.border = '5px solid yellow'
- setTimeout((=> @iframeElement.style.border = borderWas), 200)
+ @iframeElement.classList.add "vimiumUIComponentReactivated"
+ setTimeout((=> @iframeElement.classList.remove "vimiumUIComponentReactivated"), 200)
else
@show()
@iframeElement.focus()
show: (message) ->
@postMessage message if message?
- @iframeElement.setAttribute "style", @showStyle
+ @iframeElement.classList.remove "vimiumUIComponentHidden"
+ @iframeElement.classList.add "vimiumUIComponentShowing"
@showing = true
hide: (focusWindow = true)->
- @iframeElement.setAttribute "style", @hideStyle
+ @iframeElement.classList.remove "vimiumUIComponentShowing"
+ @iframeElement.classList.add "vimiumUIComponentHidden"
window.focus() if focusWindow
@showing = false