diff options
| author | abe | 2010-09-23 00:25:11 +0200 | 
|---|---|---|
| committer | abe | 2010-09-23 00:25:11 +0200 | 
| commit | 7c4f41a35b6af3efbc3adfa5a1e6bbab667fc096 (patch) | |
| tree | bf2feabdbb55e35bf55873b5f483547503ca331e /linkHints.js | |
| parent | 4473dafcb82103572810cb501ca8bce56ca93c5e (diff) | |
| download | vimium-7c4f41a35b6af3efbc3adfa5a1e6bbab667fc096.tar.bz2 | |
added resetLinkHintsMode
Diffstat (limited to 'linkHints.js')
| -rw-r--r-- | linkHints.js | 26 | 
1 files changed, 18 insertions, 8 deletions
diff --git a/linkHints.js b/linkHints.js index 5a7fb118..b30c74e0 100644 --- a/linkHints.js +++ b/linkHints.js @@ -151,9 +151,10 @@ function isVisible(element, clientRect) {  }  function onKeyDownInLinkHintsMode(event) { +  console.log("Key Down");    if (event.keyCode == keyCodes.shiftKey && !openLinkModeToggle) {      // Toggle whether to open link in a new or current tab. -    setOpenLinkMode(!shouldOpenLinkHintInNewTab); +    setOpenLinkMode(!shouldOpenLinkHintInNewTab, shouldOpenLinkHintWithQueue);      openLinkModeToggle = true;     } @@ -185,7 +186,7 @@ function onKeyDownInLinkHintsMode(event) {  function onKeyUpInLinkHintsMode(event) {    if (event.keyCode == keyCodes.shiftKey && openLinkModeToggle) {      // Revert toggle on whether to open link in new or current tab.  -    setOpenLinkMode(!shouldOpenLinkHintInNewTab); +    setOpenLinkMode(!shouldOpenLinkHintInNewTab, shouldOpenLinkHintWithQueue);      openLinkModeToggle = false;     }    event.stopPropagation(); @@ -210,17 +211,25 @@ function updateLinkHints() {      } else {        // When we're opening the link in the current tab, don't navigate to the selected link immediately;        // we want to give the user some feedback depicting which link they've selected by focusing it. -      if (!shouldOpenLinkHintInNewTab) -        setTimeout(function() { simulateClick(matchedLink); }, 400); -      else +      if (shouldOpenLinkHintWithQueue) { +        simulateClick(matchedLink); +        resetLinkHintsMode(); +      } else if (shouldOpenLinkHintInNewTab) {          simulateClick(matchedLink); -      if (!shouldOpenLinkHintWithQueue) { +        matchedLink.focus(); +        deactivateLinkHintsMode(); +      } else { +        setTimeout(function() { simulateClick(matchedLink); }, 400); +        matchedLink.focus(); +        deactivateLinkHintsMode(); +      } +      /*if (!shouldOpenLinkHintWithQueue) {          matchedLink.focus();          deactivateLinkHintsMode();        } else {          console.log("Reseting Hint Link Mode");          resetLinkHintsMode(); -      } +      }*/      }    }  } @@ -303,7 +312,8 @@ function deactivateLinkHintsMode() {  }  function resetLinkHintsMode() { -  hintKeystrokeQueue = []; +  deactivateLinkHintsMode(); +  activeteLinkHintsModeWithQueue();  }  /*  | 
