Simon Lydell [Mon, 15 Jun 2015 19:29:26 +0000 (21:29 +0200)]
Simplify compatible Firefox version management
The only thing that matters is the minimum version, and it is only the major
number of it that matters.
Including a maximum version number is pretty pointless since most of the time
we've just set it to some version in the future without actually knowing if
VimFx works with that version or not. Firefox's release cycle is also so fast
that it is very hard to keep up with it. Finally, AMO automatically bumps the
maximum version if the addon passes their tests. So it is better to simply set
it to `*` and be done with it.
Simon Lydell [Sat, 23 May 2015 21:17:44 +0000 (23:17 +0200)]
Rewrite the README key features / shortcuts parts
This commit merges those parts into one. The complete list of shortcuts has been
removed. As it will only grow, it gets a little overwhelming. It is also a PITA
to maintain. Instead, only some of the most important default shortcuts are
mentioned, more like on the current AMO page, and there's a link to
lib/defaults.coffee in case somebody wants to easily view all defaults before
installing the add-on.
The above makes the readme suitable as the text used on AMO. Therefore I also
updated a few links to make them work on AMO as well.
Simon Lydell [Sat, 23 May 2015 21:11:13 +0000 (23:11 +0200)]
Refactor defaults
- Define all defaults in lib/defaults.coffee, instead of some in
defaults/preferences/defaults.js, some in lib/commands.coffee and some in
lib/modes.coffee.
- Fix saving of non-ascii strings.
- Remove the autofocus limit option from the UI.
- Make the options UI in the Add-ons Manager DRY.
Simon Lydell [Fri, 30 Jan 2015 21:17:45 +0000 (22:17 +0100)]
Make scrolling commands scroll the focused element
Fixes #11. If the currently focused element is scrollable, it is scrolled by the
scrolling commands. Otherwise the whole document is scrolled.
In other words, you may now choose which element to scroll with the 'f' or 'vf'
command, and then you can scroll it with the scroll commands.
Fixes #399. Using counts with scrolling commands now works reliably.
The scrolling commands respect built-in Firefox prefs:
- general.smoothScroll: Turn smooth scrolling on/off for _all_ scrolling
commands.
- general.smoothScroll.lines: h, j, k, l only.
- general.smoothScroll.pages: d, u, <space>, <s-space> only.
- general.smoothScroll.other: gg, G only.
- toolkit.scrollbox.horizontalScrollDistance: Scroll step for h, l.
- toolkit.scrollbox.verticalScrollDistance: Scroll step for j, k.
The two last prefs replace the scroll step setting.
A bunch of new (hidden) prefs let you customize the smooth scrolling, in the
same spirit as the built-in `general.smoothScroll.<type>.duration{Min,Max}MS`.
They're called `smoothScroll.<type>.spring-constant` and work like
`layout.css.scroll-behavior.spring-constant`.
This commit also bumps the minimum Firefox version to 36, since
`Element.prototype.scroll{To,By}` are used and first available in that version.
Simon Lydell [Thu, 14 May 2015 17:57:48 +0000 (19:57 +0200)]
Split CONTRIBUTING.md into two files and improve them
CONTRIBUTING.md now only contains issue reporting instructions, to make it look
less overwhelming.
CONTRIBUTING-CODE.md contains the rest. Added information about the current
state of development, about the upcoming 0.6.0 release and the future rapid
release cycle plans.
Simon Lydell [Sun, 8 Feb 2015 19:42:16 +0000 (20:42 +0100)]
Fix #47: 'gi' to focus last focused or first text input
'gi' focuses the last focused or the first -- or the count:th to be precise --
text input of the page. Moreover, after you have focused something with 'gi',
<tab> and <s-tab> switch between only text inputs. That's convenient, because
'gi<tab><tab>' is then equivalent to '3gi'. Instead of trying 'gi' followed by
'<esc>2gi' followed by '<esc>3gi' etc. until you get to the input you want, you
can just type 'gi<tab><tab>' instead.
This required updating vim-like-key-notation to support <s-tab> more reliably.
Simon Lydell [Sun, 8 Feb 2015 12:11:14 +0000 (13:11 +0100)]
Add `gulp sync-locales`
To make the implementation easier, all translations must be in a single line and
must not contain superfluos whitespace. All .dtd files were updated to reflect
this.
Simon Lydell [Sat, 7 Feb 2015 22:06:15 +0000 (23:06 +0100)]
Drastically improve speed up hints generation
We used to apply a class to each element, to work around `border-radius`.
Removing that drastically speeds up hints generation. The "loss" is that the
markers no longer appear in the top-left corner, but rather in the left-middle.
That takes a little bit of getting used to, but is definitely worth it.
Simon Lydell [Sat, 7 Feb 2015 21:27:51 +0000 (22:27 +0100)]
Reduce the number of hints on Google Calendar
As noted in https://github.com/akhodakivskiy/VimFx/pull/451#issuecomment-71582664,
Google Calendar gets too many hints. That's because many buttons are implemented
as `<div>`s with lots of `<div>`s inside, all of which have "button" in the
their class names. This commit exludes elements with "button" in the class name
if they contain yet such an element. This works fine on Google Calendar.
Hopefully it does not exlude too much on other pages.
Simon Lydell [Fri, 30 Jan 2015 22:01:00 +0000 (23:01 +0100)]
Drastically speed up hints generation
By using a Firefox native function for getting all elements inside a given
rectangle. This is way faster than getting _all_ elements, and then manually
checking each element.
Simon Lydell [Thu, 29 Jan 2015 19:33:39 +0000 (20:33 +0100)]
Fix #459: Don't treat modified numbers as counts
For example, if you press `<c-5>` or `<a-5>` to select the fifth tab, and then
press `J` to select the fourth, it used to be a risk that it was interpreted as
`5J`.
Simon Lydell [Wed, 28 Jan 2015 20:44:25 +0000 (21:44 +0100)]
Let simulated clicks be cancelable
They used to be, but it was lost in commit 1ee0208. This commit brings it back,
since `<a href="#">` is often used a JavaScript-powered button. If the event
cannot be canceled, clicking such a button will scroll to the top of the page.
Simon Lydell [Mon, 26 Jan 2015 18:59:35 +0000 (19:59 +0100)]
Treat the Youtube video player as an adjustable element
- Pressing `<space>` on the entire player should play/pause.
- Pressing `<space>` on any of its controls should activate that control.
- The arrow keys should let you move the time slider.
Simon Lydell [Mon, 26 Jan 2015 16:29:51 +0000 (17:29 +0100)]
Do not consider links without href as proper links
Links ending with a `#` (`<a href="#">`) as well as `javascript:` links are
already excluded, because they're used as buttons, not links. Links without href
at all (`<a>`) should be excluded too, since they are also used as buttons (for
example, the voting buttons on stackoverflow.com). If they're not excluded, all
such links get the same hint, even though all of them do different things
through JavaScript. Moreover, the 'F' and 'gF' commands would try to open them
in new tabs, which of course wouldn't work.
Simon Lydell [Sun, 25 Jan 2015 20:19:40 +0000 (21:19 +0100)]
Let simulated clicks bubble
They used to, but it was lost in commit 1ee0208. This commit brings it back,
since many buttons are wired up using event delegation, which requires bubbling.
Simon Lydell [Sun, 25 Jan 2015 19:39:52 +0000 (20:39 +0100)]
Add Tree Style Tab support for opening new tabs
Since commit 05d60dba5 we no longer open links in new tabs by simulating
ctrl-clicks on them, but instead use Firefox APIs. Before, the new tabs were
detected by the Tree Style Tab extension and opened as new children of the
current tab. After that commit new tabs opened as new _siblings_ after the
current tab instead. This commit opens new tabs as children again, by using the
public [Tree Style Tab API][tst-api].
Simon Lydell [Sun, 25 Jan 2015 19:02:01 +0000 (20:02 +0100)]
Make scrollable elements markable
This is the first step at fixing #11. You can now focus scrollable elements and
use the arrow keys to scroll it (which is how Firefox works by default). The
next step is to make VimFx's scrolling commands able to scroll them.
Simon Lydell [Sun, 25 Jan 2015 18:09:49 +0000 (19:09 +0100)]
Provide `vim.state`
Instead of just assigning random properties on `vim` objects (such as
`.blacklisted` and `.lastInteraction`) we now assign them to `vim.state`. This
way we can properly initialize those values when new `vim` objects are made, and
easily reset all of them when the URL changes (which means that the state
changes).
Simon Lydell [Sat, 24 Jan 2015 17:05:46 +0000 (18:05 +0100)]
Improve automatic insert mode
- You can now use `<enter>` as a shortcut and still be able to press `<enter>`
on a focused link or button to activate it (without running the command).
- You can now run commands when for example a radio button is focused, but still
move the selection with the arrow keys.
Simon Lydell [Sat, 24 Jan 2015 15:41:38 +0000 (16:41 +0100)]
Improve markable elements matching
- Each 'f' command now gets its own set of markable elements. For example, it
does not make sense to open a button in a new tab.
- The above made it really easy to fix #227: Add 'gf' to follow link in new
foreground/focused tab.
- Links are now opened in new tabs using Firefox APIs instead of simulating
ctrl-clicks on the links. This is more reliable (and required in order to
implement the above point).
- XPath is no longer used. Instead, every element in every frame of the page is
checked with code. This might sound expensive, but it isn't since that's what
the XPath matcher needs to do behind the scenes anyway. The benefit of doing
it with code is that we can do more advanced checks (see below), and no
information is lost along the way: For example, whether or not an element is
considered "semantic" is saved, instead of needing to be re-calculated
afterwards.
- The above fixes #320 in a better way than what was already done in commit 016574212: Elements that have "button" in their class now must not contain an
`<a>` or `<button>` element, so a marker for a "button-wrapper" is likely not
even made and therefore cannot cover the real button inside.
- The above also significantly reduced the number of hints on reddit.com, which
made the all hints shorter.
- While at it, I implemented #450: 'vf' now selects the contents of text inputs.
Simon Lydell [Sat, 24 Jan 2015 13:40:35 +0000 (14:40 +0100)]
Correctly determine viewport size
The old method was wrong and caused no hint to show up when viewing an image
directly to toggle zoom on it.
Moreover, if a page would have a very small height and a link absolutely
positioned below that height (but still inside the viewport) that link would not
get a hint either.
Simon Lydell [Sat, 24 Jan 2015 00:20:38 +0000 (01:20 +0100)]
Simplify hint matching
Just like normal mode keeps track of the entered keys, hints mode now also keeps
track of the entered keys (chars), instead of letting each marker do it. The
markers now only keep track of themselves; how much they are matched.
Simon Lydell [Fri, 23 Jan 2015 22:36:35 +0000 (23:36 +0100)]
Put markers in the browser chrome
Instead of inside the current page. Specifically, the markers are now inserted
at the same place as `alert()` dialogs are. This has a number of advantages:
- We don't need to fight the `z-index`es of the page. The markers will now
always be on top.
- We don't need to fight any other styling of the page. No reset rules needed.
The markers will look the same regardless of what page you view.
- The above point means that we can drop `!important` from all declarations.
This makes it easier to change the styling of the markers using userChrome.css
or Stylish.
- Just like you cannot interact with the page (such as scrolling) while an
`alert()` dialog is visible, you cannot interact with the page when hints are
visible. For example you can no longer scroll, making the hints out of place.
Simon Lydell [Fri, 23 Jan 2015 20:33:12 +0000 (21:33 +0100)]
Move lib/mode-hints/* directly into lib/
lib/mode-hints/mode-hints.coffee was very short and fit really well into
lib/modes.coffee. Then there were only two files left in the lib/mode-hints
directory: hints.coffee and marker.coffee, which made that directory not feeling
warranted anymore. Besides, marker.coffee could be refactored into a more
general marker abstraction that could be used for other things than hints as
well.
Simon Lydell [Fri, 23 Jan 2015 20:21:52 +0000 (21:21 +0100)]
Remove bloomfilter
The bloomfilter can run out of space, and actually does so pretty quickly:
See #176. When it is full it is not of any help anymore. All it does then is
unconditionally giving better hints to `<a>` elements. But since commit 01657421
that is done in a better way.
In summary, the bloomfilter is not useful anymore.
Simon Lydell [Fri, 23 Jan 2015 20:01:57 +0000 (21:01 +0100)]
Give better hints to semantic elements than unsemantic ones
On reddit, each post wrapper has an `onclick` attribute, which makes it
markable. Of course the wrapper has larger area than anything inside of it. This
causes it to get a larger weight than the post title link. The title link is
what the user reads and wants to click, not the entire wrapper. Therefore it
should get a better hint.
There are other similar examples as well. Unsemantic elements (such as those
with `on*` properties, or those whose class contains "button") need to be able
to be clicked, but semantic ones (such as anchors, buttons and form elements)
should be favored.
This commit also fixes #320: Sometimes button elements are wrapped in a div with
a class such as "button-wrapper". Because that contains "button" the wrapper
element gets a marker as well, even though it cannot be clicked. Since it wraps
the actual button it naturally gets a larger weight and therefore a higher
z-index, which makes it overlap the marker for the clickable button. Now,
semantic elements get their z-indexes assigned _after_ the unsemantic ones
instead, which makes them go on top.