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.
Andreas Lindhé [Sat, 17 Jan 2015 01:13:33 +0000 (02:13 +0100)]
Created a Swedish translation
Most of it is correct, some minor details are a bit awkward but that's
mostly because not all technical terms ("web terms") has a proper
Swedish translation.
> We don’t bother with `<link>`s since the commands are substitutes for clicking
> a visible element. (And at least in my experience, they’re not commonly used.)
> Moreover, if there’s a `<link>` with a `rel` attribute, there’s likely a
> corresponding `<a>`, too.
But that's wrong. `<link rel=prev/next>` is actually a _better_ candidate for
the previous or next page than looking for a link to them.
Simon Lydell [Sat, 17 Jan 2015 23:22:53 +0000 (00:22 +0100)]
Fix #249: Support other keyboard layouts than en-US
This uses lydell/vim-like-key-notation. The old notation is supported too, for
backwards compatibility: Old customizations still work, and continue to work if
the user downgrades.
Simon Lydell [Sat, 17 Jan 2015 16:38:06 +0000 (17:38 +0100)]
Add default shortcuts to new commands
- Toggle pin tab: gp (go pin)
- Duplicate tab: yt (yank tab, same as Vimium)
- Close tabs to the right: gx$ (like g$ (go to last tab), but with an x in it as
in "remove it!")
- Close other tabs: gxa (similar to gx$, go close tabs around the current)
Simon Lydell [Sat, 17 Jan 2015 16:19:25 +0000 (17:19 +0100)]
Fix #382: Support 'selection' clipboard
Supersedes #397. The p and P commands now use either the selection clipboard or
the global clipboard, whichever was used last or is supported by the OS. This is
a slightly breaking change since we used to only use the global clipboard, but
I've used this new behavior and it doesn't bother me. Morever, it is how
Pentadactyl works, and how the built-in `readFromClipboard()` function works.
Simon Lydell [Sat, 6 Dec 2014 22:42:32 +0000 (23:42 +0100)]
Make `require` more like Node.js
- Add support for `module.exports`.
- Add support for npm modules in `require()`. Note the following differences
with Node’s `require()` though:
- Only `require(path)` is supported, not `require.resolve()` or related
`module` properties etc.
- Absolute paths (`/foo/bar.js`) are not supported.
- Only JavaScript files may be required (not JSON files, for example). Paths
must not end with `.js`.
Moreover:
- `module.onShutdown(handler)` is used instead of
`require('unloader').unloader.add(handler)`.
- bootstrap.coffee has been cleaned up. I had a lot of help from looking at
<https://github.com/adblockplus/buildtools/blob/7a305df14bf3d26ff559f06082b87ff7cff4b3b8/bootstrap.js.tmpl>
- `extension/packages/` has been renamed to the more Node-style
`extension/lib/`.
- The huffman module has become its own repository, and is now `npm install`ed.
This change allows users to blacklist only some keys on a website.
These keys are not suppressed and the corresponding VimFx command is not executed.
Blacklist rules can now be of the form `<pattern>##<keyString1>#<keyString2>`.
Existing rules not using this syntax will continue to work.