aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/link_hints.coffee
AgeCommit message (Collapse)Author
2016-09-26Use title attribute for link text.Stephen Blott
Google seems to be using a lot of "title" attributes on buttons. This makes it possible to type the text in filtered link-hints mode. (And you can often guess the text; e.g. "close"). We could also show the title text. That is very visually noisy though, in practice.
2016-09-26Tweak jsaction detection and add tests.Stephen Blott
This tweaks the jsaction detection, in particular excluding elements where the "actionName" is "_". I see a lot of these, and clicking them doesn't do anything. Also, added corresponding tests.
2016-09-26Fix comment.Stephen Blott
Thinking about it more carefully, this algorithm is always O(n^2).
2016-09-25Active hint marker may be in another frame.Stephen Blott
Do not set the style on the active hint marker if it's in another frame.
2016-09-25Reinstate highlighting of first hint.Stephen Blott
Applies to filtered hints only.
2016-09-25Do not reset tab index on modifiers.Stephen Blott
The prevents the active element from being reset when we rotate hint markers.
2016-09-25Make tab-selected hint visible.Stephen Blott
When the user selects an active hint with Tab (for filtered hints), adjust its z-index such at it is top of the stack.
2016-09-25Refactor z-index allocation to a separate function.Stephen Blott
2016-09-25Don't forget the tab count on <Space>.Stephen Blott
2016-09-25Hint rotation, tweaks for readability.Stephen Blott
2016-09-25Space rotates hints (to make hidden hints visible).Stephen Blott
It is common for link-hint markers to be close togother, and overlapping. Here, `<Space>` rotates hint markers such that hidden markers become visible. For filtered hints we additionally require a modifier (because `<space>` on its own is already a token separator). The calculation of overlapping hints is quite expensive: O(n^2) in the best case and O(n^3) in the worst cast. The worst case is extraordinarily unlikely to arise in practice.
2016-09-09Merge pull request #2242 from gdh1995/hint-label-for-not-disabledStephen Blott
hint a label only if its control is not disabled
2016-09-09hint a label only if its control is not disabledgdh1995
example: ``` html <label><input type=checkbox disabled />exlpanation</label> ```
2016-08-16Add support for opening details elementsBouke van der Bijl
2016-04-26Merge pull request #2107 from smblott-github/modernize-help-dialog-stylingStephen Blott
Modernize help dialog styling
2016-04-25Make zoom-in/out images clickable.Stephen Blott
Make zoomable images clickable: e.g. http://i.imgur.com/LdCeLlk.jpg/.
2016-04-24Filtered hints; tweak scoring.Stephen Blott
Re-order the tests such that we don't even do the scoring if there are no query (search) terms. This might (very) marginally speed up link-hints launch.
2016-04-24Fix tests following 029741ea2d93031f0c9d5e57ba9cf75546976798.Stephen Blott
Following 029741ea2d93031f0c9d5e57ba9cf75546976798 (which seemed trivial), I forgot to check the tests (which were in fact broken, and correctly broken). If there is no link-text key queue, then *all* links should match.
2016-04-24Filter filtered-mode link hints.Stephen Blott
Only keep non-empty link words. Empty link words cannot be matched, and leading empty link words disrupt the scoring of matches at the start of the text. E.g. "9 new messages" with a query "new" should score as a match at the start of the text.
2016-04-22Help dialog; do not offer hints outside of the help dialog.Stephen Blott
2016-04-17Better window focus handling.Stephen Blott
This fixes two issues: - We cannot set windowHasFocus until the DOM is ready (because document.hasFocus isn't set until then. - We should use windowhasFocus in prefernce to document.hasFocus because, for framesets, document.hasFocus is true for both the frameset and a focused contained frame.
2016-04-12Set the mode indicator last.Stephen Blott
Similarly to the previous commit: 454f5272c71388c53665d7505aa6832566284e2b. This is intended to mitigate some CSP violations we're seeing. In some circumstances - as yet not fully pinned down - messages to the HUD trigger CSP violations. Until we track that down, we move all HUD operations (in link hints) to the end of their execution slice. So, if HUD operations fail, then they won't affect any other operation. The error message for offending HUD operations is: ui_component.js:55: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('chrome-extension://hiihfcebjbnoniicphblpiekhfmbdmog') does not match the recipient window's origin ('null').
2016-04-12Make rects absolute in window earlier.Stephen Blott
This is part of an effort (as yet incomplete) to track down some CSP violations we're getting, in this case related to global link hints. Prior to this, we were seeing CSP violations when accessing the window subsequently to collecting the hints, specifically when accessing window.scrollX/Y. Here, we collect the window position immediately, when initially harvesting the hints.
2016-04-09Minor performance tweak.Stephen Blott
Two minor tweaks: 1. Do not use ".indexOf()" three times for each comparison; do it just once. 2. Check the common case (no match) first. These are very minor performance tweaks; but, with global link hints, we pay this cost n times (for n frames).
2016-04-08Trim linkText when it's collected, not repreatedly.Stephen Blott
There's no need to repeatedly trim linkText. Instead, just trim it when it's first collected, then we can assume from there on that it's trimmed.
2016-04-08Filtered hints; do not accept split characters.Stephen Blott
There is no point accepting characters which are used for splitting the link text in the query string, since such characters cannot appear in link text words.
2016-04-08Simplify filtered hint matching.Stephen Blott
- Reduce the number of passes over hint markers from two to one. - Filter out non-matching hints before sorting. - Do not trim the search string twice.
2016-04-08Merge pull request #2088 from ↵Stephen Blott
smblott-github/filtered-hints-better-typed-text-matching Filtered hints: better typed text handling.
2016-04-08Refactor setModeIndicator().Stephen Blott
Previously this had two independent functions: set the @mode and update the indicator. We don't always do those two things at the same time. So this refactors things into two separate functions.
2016-04-08Show filtered characters in mode indicator.Stephen Blott
2016-04-08Filtered hints; ignore unmatched text.Stephen Blott
When the user is typing a link's text, any mistyped character exits link hints mode. This makes little sense. In practice, this usually happens because the user mis-typed something. Here, we ignore typed characters which do not match any hints. (Also, add a test for this.)
2016-04-08Do not post hint descriptors back to the frame itself.Stephen Blott
When distributing hint descriptors, do not post a frame's own hint descriptors back to the frame itself. It already has them. With regard to the message-passing cost only, this represents a speedup of approximately 3/2 for link-busy sites like reddit -- several tens of milliseconds for me. There are other costs too (such as processing the hint descriptors) bu these are not affected.
2016-04-05Better close-down for global link hints.Stephen Blott
- Unregister frames with the background-page hint coordinator. - Better page cleanup in the content scripts. - Require documentReady before harvesting hints. There is still an issue in some cases when link-hints are activated as a page is transitioning, but that problem case seems to have existed in 1.54. I'll continue to investigate.
2016-04-05Unregister frame on "unload".Stephen Blott
It seems we cannot rely on the port being disconnected to unregister a frame. So we need to unregister it on "unload".
2016-04-04Remove keyboard-suppressing mode when necessary.Stephen Blott
2016-04-04Better indicator message.Stephen Blott
2016-04-04Shorten link text.Stephen Blott
When a link's text is particularly long, displaying all of its text makes the hint look weird - so shorten it. We still use the full text for matching.
2016-04-04Handle requireHref for link hints locally.Stephen Blott
The check that an element as an href (for certain hint modes) can be done earlier, thereby avoid the need to pass that information between frames.
2016-04-04Document hint descriptors.Stephen Blott
2016-04-04Keep showLinkText local for link hints.Stephen Blott
We only need showLinkText in the hint's local frame, so do not transmit it to remote frames.
2016-04-04Keep reason local for link hints.Stephen Blott
The "reason" a hint is available is only ever needed in the hint's own frame, so there's no need to pass it to other frames.
2016-04-04Keep rects local for link hints.Stephen Blott
Previously, we passed each hints rect to every other frame. However, the rect is only actually needed in its own frame. Here, we instead keep (and use) each hint's rect locally only.
2016-04-04Do not render link hints in remote frames.Stephen Blott
Previously, we were rendering hints in all frames, but displaying only in their own frame With n frames and m hints, we rendered n*m hints. With this, hints are only rendered in their own frame, so we only render m hints.
2016-04-03Freeze frame state on link-hint activation.Stephen Blott
We take a copy of the frame Ids and ports at the point which link-hints mode is launched, and use that subsequently. Therefore, a newly created frame cannot cause the hint coordinator to become confused. Also: add debugging code.
2016-04-03Remove blocking mode when no hints found.Stephen Blott
This fixes an error in 39adee9090fc5aadfd5dd681f91b80025084858a. Specifically, if there are no hints to select from, or no documentElement, then link-hints mode exits without initiating an actual mode (i.e. without calling its super() constructor). With 39adee9090fc5aadfd5dd681f91b80025084858a, that leaves a mode in place which blocks all keyboard events, thereby rendering Vimium entirely hung. See this line: https://github.com/philc/vimium/commit/39adee9090fc5aadfd5dd681f91b80025084858a#diff-e9abcb9ebcdb5af8e9f33651364673a1R59. Here: - we explicitly remove the keyboard-blocking mode - we add exitOnEscape (so that the situation is at least recoverable), and - we add an indicator (so that we can see what's going on). It is proposed that the indicator is a temporary feature, while the global link hints feature is in shake down.
2016-04-02Make stableSortCount per instance.Stephen Blott
I've not observed this, but it could possily happen... If the stableSortCount gets out of sync in different frames, then different frames might make different decisions about the ordering of the hints. Ti avoid this potentially happening, we initialise the stableSortCount every time link-hints mode is activated.
2016-04-02Make document.body selectable as scrollable.Stephen Blott
Previously, we could select divs, uls, and ols for scrolling, but we couldn't get back to scrolling the document body. This makes it possible to select document.body for scrolling. Unfortunately, sometimes the hint appears in a rather odd place (because it's "on top of" something else which is clickable.
2016-04-02Use ports for all link-hint messages.Stephen Blott
This seems to be considerably faster than using sendMessage().
2016-04-02Use port for frame-to-background messages.Stephen Blott
Without considering the size of the data passed, ports seem to be about 5 times fast than sendMessage(), so we use ports of link-hint messages wherever possible.
2016-04-02Wait for docomentReady to generate hints.Stephen Blott
If document.documentElement isn't ready, then we can'r generate hints. Moreover, this would crash -- thereby hanging global link hints.