aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
AgeCommit message (Collapse)Author
2017-02-11Don't depend on global event for CoreScroller event listeners (FF)mrmr1993
2017-02-08Stop using non-standard event.srcElement; switch to event.targetmrmr1993
2017-01-03InsertMode should not handle key events if document.body is editablegdh1995
For example, the host JavaScript may create an "about:blank" iframe with a `content-editable` `body`, and then: * the parent frame may handle `Escape` key events by itself * but now, Vimium always grabs `Escape` events * and tries to exit `InsertMode` * although `document.body` is still current `activeElement` after `body.blur()` * as a result, neither the parent can receive and handle wanted keyevents, nor Vimium will succeed in returing back to NormalMode
2016-12-26Fix (another) infinite-scroll issue.Stephen Blott
Steps to reproduce: - Press and hold `j`. - Tab `k`. - Release `j`. The tap on `k` is uninstalling the `cancelEventListener` installed by `j`, and because we advance `@time`, the `j` stops scrolling and removes the `cancelEventListener` installed for `k`. So we end up with no `cancelEventListener` installed. The fix is to make the `cancelEventListener` specific to the scroller instance. The more fundamental problem here is that we're mixing dynamic and static state. A better approach would be to have `CoreScroller` as a class, with a new instance created for each scroll instance.
2016-12-26Guard against element.tagName not being a string.Stephen Blott
Example page: http://codeforces.com/contest/752/problem/B. There, `element.tagName` is an element with `name` `tagName` (not a string). Here, we guard against that case. Fixes #2305.
2016-12-21Don't focus non-focusable node.Stephen Blott
Try the following.... - load page - `/` - type some junk which matches nothing - `Escape` We expect to leave find mode. Instead, we have to hit escape again to get out of find mode. Here, `focusNode.focus()` is not a function.
2016-12-21Tweak #2327.Stephen Blott
2016-12-21Merge pull request #2311 from smblott-github/enterNormalModeStephen Blott
New command option to enter normal mode
2016-12-21Merge pull request #2327 from sco-tt/capitalized-link-hints-options-2Stephen Blott
Makes sure all custom link hint characters defined in settings are lowercase
2016-12-14Add "swap" command option for marks.Stephen Blott
In a browser, I find global marks considerably more useful than local marks; for example, I use marks to quickly jump back to my email tab. Unfortunately, inheriting vim's approach, global marks require capital letters, so the `<Shift>` key. This PR implements: map m Marks.activateCreateMode swap map ' Marks.activateGotoMode swap which inverts the `isGlobalMark()` test for the `<Shift>` key. Is the name `swap` the best one? It could be `invert` instead, or perhaps there's something better.
2016-12-12Remove unused parameter.Stephen Blott
2016-12-11Rework help-dialog HTML.Stephen Blott
Previously, the dynamic HTML for the help dialog was generated on the background page. The HTML itself was tangled in with program logic. Here, we move all of the HTML to HTML5 templates; also, we build the help-dialog contents in the help dialog itself, not on the background page. Note: #2368 is included here too. (Background: I'm trying to clean up some of the command and help-dialog logic in preparation for addressing the issue of how to document command options, see #2319.)
2016-12-10Merge pull request #2326 from smblott-github/move-search-engines-to-bg-utilsStephen Blott
Move SearchEngines to bg-utils.coffee.
2016-12-10Use 'map X passNextKey normal'.Stephen Blott
2016-11-09treat select element as an input, setting focus to itRamiro Araujo
2016-10-23Makes sure all custom link hint characters defined in settings are lower ↵Scott Pinkelman
case when link hints are generated
2016-10-23Move SearchEngines to bg-utils.coffee.Stephen Blott
`SearchEngines` was previously in `utils.coffee`, which means it was loaded in *every* content frame. This is unnecessary, since it is only used on the background page. So this PR moves it there. Also: - Simplify some unnecessarily complex logic in `vomnibar.coffee`. - Re-use `Utils.parseLines()` to parse the custom search engine configuation text.
2016-10-15enterNormalMode; tweak indicator.Stephen Blott
2016-10-15enterNormalMode; new command - implementationStephen Blott
Here's the problem... Many sites define their own keyboard shortcuts, for example Google Play Music defines `gh` for "go home". On such sites, it's natural to set up pass keys for `g` and `h`. But that makes any Vimium key bindings which begin with `g` inaccessible. Here, we add a new command `enterNormalMode` which installs a new normal-mode instance (without any pass keys). This executes a single normal-mode command then exits. Example: map \ enterNormalMode map | enterNormalMode count=999999 Assuming `g` and `o` are pass keys: - `gh` or `o` - use the page's binding - `\gg` - scroll to top - `2\ggo` - scroll to the top and open the Vomnibar - `\g<Escape>o` - open the Vomnibar - `\<Escape>o` - use the page's bindings - `\\\\\\<Escape>o` - use the page's bindings (new normal-mode instances displace previous ones) This required some changes to the scroller. Previously, we only ever had one normal-mode instance, and could arrange statically that the scroller's key listeners were above normal-mode's key listeners in the handler stack. Here, we fix this by adding and removing the scroller's listeners dynamically, so they're always at the top of the handler stack.
2016-10-15No-op; rearrange content-script command arguments.Stephen Blott
This is a no-op. It arranges that the registry entry for each command is passed to the command, for every command. That required a small ammount of reworking in a couple of cases.
2016-10-10Merge pull request #2306 from smblott-github/add-key-translationStephen Blott
Add "mapkey" command for key mappings.
2016-10-10Rename 'translate' to 'mapkey'.Stephen Blott
2016-10-10Disable grab-back-focus in all frames.Stephen Blott
When the user begins interacting with one frame, we disable the grab-back-focus mode in *all* frames. Previously, grab-back-focus was preventing users from selecting inputs in frames other than the active frame. Fixes #2296 (possibly).
2016-10-09Extend key translation to include Escape.Stephen Blott
Here, these map to escape: translate x <c-[> translate <c-c> <c-[>
2016-10-09Add translate command for key mappings.Stephen Blott
Under *Custom key mappings* (on the options page), this implements: translate x y Whenever the users types `x` in normal mode or in visual mode, the `x` is replaced by `y`. For example: map ç l (which apparently would be helpful on Brazilian keyboards). Issues: - Do we want yet another hack like this? This would be documented only on the wiki. - If we allowed `translate <c-c> <c-[>` (and extended `isEscape()` to use the translation), then we'd get the `exitMode` command for free (#2253). - Alternatively, instead of adding a new "command" called `translate`, we could overload the existing `map` command. Since these are single-key mappings, there's no ambiguity. (Although, I guess there's a risk some user has junk in their key mappings and would be taken by surprise). Inspired by isssue posted by @vhoyer (#2305). Fixes #2305.
2016-10-09Move logging to the frame's port.Stephen Blott
Comminication by the frame's port is faster, and no response is sent.
2016-10-08Grab back focus prevents focusing embeds."Stephen Blott
Partially addresses #2303.
2016-10-08Better positioning of link-hints flash rect.Stephen Blott
When an <a> spans the end of a line and the start of the next line, we now highlight both parts of the link (instead of just the first). Also, refactor code for calculating the position of the viewport into a separate utility in DomUtils.
2016-10-08handle documentElement's top margin correctlygdh1995
2016-10-02Tweak logging.Stephen Blott
2016-10-01Merge pull request #2283 from smblott-github/fix-find-mode-hangsStephen Blott
Find mode can hang Vimium (fixed).
2016-10-01Fix find-mode hangs.Stephen Blott
"/" followed immediately by "i" can hang Vimium. The problem is that launching find mode is asynchronous (we wait until the HUD is available). Because normal mode is still active, we can enter insert mode *before* the find-mode HUD receives the focus. The result is that we end up in both find mode and insert mode, the HUD has the focus, but the HUD is in insert mode, so it ignores keyboard events (including `Escape`). The only way out is to click the page's body and then type `Escape`. This commit demonstrates the problem: 7d2b00411eae3293fa4c7b1f61b384c0c495b5a2. This happens in practice, for example while a busy page is loading. This commit fixes this by ensuring that find-mode blocks keyboard events immediately (and synchronously) on launch.
2016-09-30Remove Coffeescript 1.10 dependency.Stephen Blott
Fixes #2273. Fixes #2281. This fixes the build with Coffeescript 1.11, so we can remove the hard-wired dependency and notes.
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-24Fix key handling for 3-key mappings.Stephen Blott
This only affects key mappings of three keys or longer. Consider: map goa something map gob something Previously, we launched the vomnibar (`o`) on the after `go`, making these mappings unusable. This commit fixes that: `go` no longer launches the Vomnibar, but waits instead to see what the next key is.
2016-09-24Merge pull request #2250 from smblott-github/better-global-marksStephen Blott
Use prefix matching for global marks.
2016-09-24Merge branch 'dpogue-scrollingElement'Stephen Blott
2016-09-24Tweak #2168 (scrolling via scrollingElement).Stephen Blott
Instead of setting a property of document for `scrollingElement` (if it is not defined), just use a function and make the decision dynamically instead.
2016-09-22Use document.scrollingElement for scrollingDarryl Pogue
This fixes Vimium with the 'Experimental Web Platform Features' flag enabled, and ensures compatibility across quirks mode scrolling (via document.body) and standards-compliant scrolling (via document.documentElement).
2016-09-14Require exact match when we will be scrolling.Stephen Blott
If the user is jumping to a scroll position within a tab, then we need an exact match on the URL (because otherwise the scroll position doesn't really have a meaning). Otherwise we only require a prefix match, a la #2250.