From 0537ebb07670909a21134e16ed30b3786fc6f4a0 Mon Sep 17 00:00:00 2001 From: gdh1995 Date: Sat, 29 Aug 2015 21:42:36 +0800 Subject: use documentReady instead of setTimeout to init focusThisFrame --- content_scripts/vimium_frontend.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 962b7d6d..ddc80464 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -274,7 +274,7 @@ setScrollPosition = ({ scrollX, scrollY }) -> # # Called from the backend in order to change frame focus. # -setTimeout (-> +DomUtils.documentReady -> # Create a shadow DOM wrapping the frame so the page's styles don't interfere with ours. highlightedFrameElement = DomUtils.createElement "div" # PhantomJS doesn't support createShadowRoot, so guard against its non-existance. @@ -302,7 +302,8 @@ setTimeout (-> if shouldHighlight document.documentElement.appendChild highlightedFrameElement setTimeout (-> highlightedFrameElement.remove()), 200 -), 0 + +window.focusThisFrame = -> extend window, scrollToBottom: -> -- cgit v1.2.3