aboutsummaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2016-06-02Favour event.keyIdentifier over event.key.Stephen Blott
See #2147. Chromium's implementation of event.key currently fails to take account of keyboard mappings (e.g. neo2). Here, we favour using event.keyIdentifier (while it's available) as a workaround.
2016-05-27Merge pull request #2132 from sco-tt/masterStephen Blott
Adds single left/right angle quotation marks to next/previous patterns
2016-05-15Also remove event.keyIdentifier in getKeyCharString().Stephen Blott
This was an oversight from a5262f4e68f62a922c9c05d871c4a874f6737a7b.
2016-05-15Use event.key (not event.keyIdentifier).Stephen Blott
event.keyIdentifier is depricated and will be removed soon. It is being replaced by event.key. Unfortunatelty, event.key is not yet available in the stable Chrome version. Here, we use whichever API is available. In due course, we can remove the event.keyIdentifier implementation (and a considerable amount of machinery surrounding it). For the time being, if both APIs are available, then we verify one against the other and show a warning message of they do not match. This should help us track down any issues which arise. Using event.key has the additional benefit of correctly detecting shifted characters on the numbers row on keydown, which has been a problem for some users. Fixes #2128. Note: We have a problem with the tests. phantomjs does not currently support event.key, and possibly never will.
2016-05-12Adds single left/right angle quotation marks to next/previous patternsScott Pinkelman
2016-05-12Revert "Improves next/previous links by targetting button elements and ↵Stephen Blott
adding single left/right angle quotation marks" This reverts commit ee8c235aeaf52d2bc867a00c37731690e337c7ff. This reverts #2117. This breaks next/prev on Reddit (it chooses a different link). Reddit is an important site, so we should unwind this for now. Mention @sco-tt.
2016-05-07Merge pull request #2118 from smblott-github/fix-ui-component-init-issuesStephen Blott
Fix UI-component initialization issues (maybe).
2016-04-28Fix UI-component initialization issues.Stephen Blott
This fixes some UI component initialization issues. It's a long story... The problem. - Go to this page: http://www.thejournal.ie/seanad-election-results-2016-2737768-Apr2016/ - Click one of the links from the "Most Popular" box on the right. - Navigate back (`H`) and, as the original page is loading, activate the Vomnibar. In 1.54 this renders Vimium unusable. In `master` this renders the Vomnibar unsable, but the rest of Vimium usable. It seems the source of the issue is that we're initializing UI components too soon. We need to wait until the `readyState` is "complete". With this PR: - The Vomnibar is initialised when the `readyState` is "complete" (in the top frame only, and only if Vimium is enabled). Requests arriving prior to then are silently discarded. - The HUD is also initialized only when the `readyState` is "complete"; however, requests arriving before then are queued. So, if the user immediately enters insert mode, then the "Insert mode" indicator will eventually be displayed. - The help dialog silently discards requests until the `readyState` is "complete. I'm posting this as a PR because: 1. It needs some visibility. 2. With this, if the `readyState` *never* reaches "complete", then the Vomnibar would be unusable. And that's pretty serious.
2016-04-28Make vimiumFlash a class.Stephen Blott
There are circumstances when we hav two (identical) vimiumFlash elements displayed: specifically, when using the waitForEnter keyboard blocker. So, we should use a class (rather than an id) to style the flash element.
2016-04-26Improves next/previous links by targetting button elements and adding single ↵Scott Pinkelman
left/right angle quotation marks
2016-04-18Revert "UI-compnent commands must wait for the document to be ready."Stephen Blott
This reverts commit c01d7eea8675f9a7d84999777e8de72244d687b6. Preparatory to implementing an alternative approach.
2016-04-17UI-compnent commands must wait for the document to be ready.Stephen Blott
2016-04-13Add <c-y> and <c-e> for visual mode.Stephen Blott
Fixes #2092.
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-05Check for document.activeElement.Stephen Blott
When DomUtils.isFocusable() is called from GrabBackFocus-pushState-monitor it is possible that document.activeElement is not ready. So we should check. Here, we check in DomUtils.isFocusable(), because we always need element to be defined for this test, not just in GrabBackFocus-pushState-monitor.
2016-04-02Refactor DomUtils.documentReady.Stephen Blott
We do not need to install separate event listeners for every callback. Just install one listener and keep track of the callbacks ourself. This is clearer, and also determines the order in which callbacks are called. (Although, we don't rely on that currently.) This also adds a tests.
2016-04-02Rework DomUtils.documentReady().Stephen Blott
There seems to be an issue on this page: - http://i.imgur.com/PdmUjij.jpg whereby "DOMContentLoaded" isn't firing. The page structure is unusual (involving a shadow-DOM element), which might be the source of the problem. What happens is that the "DOMContentLoaded" event fires as required, but the document state is still "loading". Here, we just say that if the "DOMContentLoaded" handler has fired once, then we're good to go.
2016-04-02Move the test for small windows to DomUtils.Stephen Blott
The reason for doing this is that we will be using the same test to decide whether or not to register a frame.
2016-04-01Tweak Settings to add onLoaded() method.Stephen Blott
Settings.onLoaded() is similar to Settings.use(), except it does not require/expect a key argument. Would could simulate .onLoaded() with .use() by artificially adding an (unused) key, but that would make the code less clear. So it seems better to have a separate method.
2016-03-31Fix @suppressEvent and tweak comments.Stephen Blott
2016-03-30Rework handlerStack.bubbleEvent() for greater clarity.Stephen Blott
2016-03-30Rename handlerStack constants.Stephen Blott
Problems: - The meanings of some of the Mode/handlerStack constant names is far from obvious. - The same thing is named different things in different places. This changes various constant names such that: - the names used in the handler stack and in the modes are the same. - ditto vis-a-vis DomUtils. Also, break out the core of the handler stacks' `bubbleEvent` method into a switch statements. This makes it more obvious that the cases are mutually exclusive.
2016-03-28Global link hints; revert b7535a604954b5873d825eb66bfecd08f1f2c99b.Stephen Blott
Here's why: - b7535a604954b5873d825eb66bfecd08f1f2c99b is complicated and complex (O(n^2)). - With experience, it is not obviously better than what was there before, and in some cases it's worse. - b7535a604954b5873d825eb66bfecd08f1f2c99b selects way too much text in some cases; e.g. on Google Inbox, it selects text lengths in the tens of thousands of characters. That cannot be useful. - With global hints, this extra cost (resulting from passing large objects between frames) is significant and noticable. - The simpler approach of accounting for text length when scoring filtered hints (tweaked here: 5cbc5ad702a01a81b98f8c82edb3b6d227c2c7b5) works better in practice.
2016-03-27Remove simulateUnhover(); not being used.Stephen Blott
2016-03-27Remove longestCommonPrefix(); not being used.Stephen Blott
2016-03-27Remove copyObjectOmittingProperties(); not being used.Stephen Blott
2016-03-27Add test for invokeCommandString().Stephen Blott
2016-03-26Multiple minor tweaks.Stephen Blott
Some of this code is showing its age, so these are just a number of minor tweaks (to keep things clear, consistent and concise). Also, add a couple of tests (while we're at it).
2016-03-26Merge branch 'standardise-foreground-commands'Stephen Blott
Conflicts: content_scripts/vimium_frontend.coffee
2016-03-26Simplify invokeCommandString().Stephen Blott
There's no need to have the previous unusual calling style (passing the arguments as a list. It looks more natural to pass tham just as regular arguments, as here.
2016-03-21Simplify singleton handling.Stephen Blott
While working on the visual-mode code, it became apparent that our current "singleton" implementation is unnecessarily complicated. This simplifies it. The keys are now required to be strings. (Previously, they could be any object; which meant we needed to gove objects an identity. All of which was complicated.)
2016-03-21Rework visual mode.Stephen Blott
- Refactor the three visual-mode modes. - Use the key-handling framework from #2022. - Strip some legacy edit-mode code. - Rename the file (the old file name was misleading). - Add "aw" and "as", previously we had the code for this from edit mode.
2016-03-18Add Utils.makeIdempotent.Stephen Blott
The intention is to use this to clean up some of the initialisation sequences in the front end.
2016-03-06Tweak documentReady().Stephen Blott
We can remove these listeners once we're done.
2016-03-05Key bindings; more tweaks and fixes.Stephen Blott
Miscellaneous fixes and tweaks, including: - Reinstate key logging. - Fix count handling in line with expected behaviour in #2024. - Remove `noCount` option; we don't need it. - Simplify logic in various places. Fixes #2024.
2016-03-04Do not use standalone @.Stephen Blott
The styles guide says not to use standalone `@`. So this changes the occurrences I could find (with sed) to `this`. Occurrences within files with major outstanding PRs are omitted.
2016-03-03Remove methods which aren't used.Stephen Blott
2016-02-26Don't try to evaluate DomUtils.isSelectable on non-elementsmrmr1993
This stops us from throwing errors when document, window, etc. end up being passed into DomUtils.isSelectable.
2016-02-26Remove outdated blacklist in DomUtils.isEditable, use .isSelectablemrmr1993
This fixes #1964.
2016-02-20Correctly set `settingsVersion`.Stephen Blott
This fixes an error in #1950. There, we need to detect new installs, and did so by checking `settingsVersion`. However, `settingsVersion` is *always* truthy. So the "new install" code never triggers. Here, the default value for `settingsVersion` is falsy. Note, we *always* set `settingsVersion` when the extension is loaded. So `settingsVersion` is always set.
2016-02-18Wait-for-enter: default to "true" for new users.Stephen Blott
For existing users, the default is "false"; but for new users wait-for-enter defaults to "true".
2016-02-18Wait-for-enter: add necessary option support.Stephen Blott
2016-02-18Wait-for-enter: for filtered hints.Stephen Blott
This affects filtered hints only. If a hint is triggered because the user typed the link text, then: - highlight the link - but wait until the user types `Enter` before activating the link.
2016-02-18PassNextKey; minor tweak.Stephen Blott
2016-02-18PassNextKey; allow multiple mappings.Stephen Blott
This allows: map a passNextKey map b passNextKey (Previously, we only picked up the first mapping.)
2016-02-18PassNextKey; move key parsing to keyboard_utils.coffee.Stephen Blott
Previously, key event parsing was embedded in the normal-mode key handlers. Here, we move it to a new function (getKeyCharString) in KeyboardUtils so that it can also be used from elsewhere... In particular for detecting the pass-next-key key in insertmode.
2016-02-18PassNextKey; store key mapping in settings.Stephen Blott
We need the key mapped to passNextKey in the front end so that we can activate pass-next-key from within insert mode too (without the need to consult the background page).
2016-02-16Use `for own ... of` instead of `for ... of`mrmr1993
2016-02-12Nuke some legacy migration code.Stephen Blott
These migrations are at least ten months old (since release).
2016-02-11Tidy up detection for the current page and context belonging to usmrmr1993