From af22c26acf5dd830e56abfcb654d21ac11464997 Mon Sep 17 00:00:00 2001 From: anekos Date: Sat, 27 Mar 2010 14:25:41 +0000 Subject: blur 時に flasher を外す様にした git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37102 d0d07461-0603-4401-acd4-de1884942a52 --- spatial-navigation.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'spatial-navigation.js') diff --git a/spatial-navigation.js b/spatial-navigation.js index c1e610e..01f2954 100755 --- a/spatial-navigation.js +++ b/spatial-navigation.js @@ -290,19 +290,28 @@ let INFO = flashFocusedElement(); } - flasher = Cc['@mozilla.org/inspector/flasher;1'].createInstance(Ci.inIFlasher); + const flasher = Cc['@mozilla.org/inspector/flasher;1'].createInstance(Ci.inIFlasher); flasher.color = '#FF0000'; flasher.thickness = 2; function flashFocusedElement () { let elem = getFocusedElement(); - liberator.log(elem); if (!elem) return; - setTimeout(function () { - flasher.drawElementOutline(elem); - setTimeout(function () flasher.repaintElement(elem), 100); - }, 0); + setTimeout( + function () { + flasher.drawElementOutline(elem); + elem.addEventListener( + 'blur', + function () { + elem.removeEventListener(arguments.callee); + flasher.repaintElement(elem); + }, + false + ); + }, + 0 + ); } function focusElement (elem) { -- cgit v1.2.3