Merge branch 'master' of github.com:cmcaine/tridactyl into glacambre-fix_#67

This commit is contained in:
Oliver Blanthorn 2018-04-11 17:42:01 +01:00
commit a50cd6efc3
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
4 changed files with 89 additions and 5 deletions

View file

@ -30,3 +30,45 @@ This add-on is very usable, but is in an early stage of development. We intend
to implement the majority of Vimperator's features.
We recommend that you use the beta versions below.
**Permissions:**
Since Tridactyl aims to provide all the features Vimperator and Pentadactyl
had, it requires quite a few permissions. Here we describe the specific
permissions and why we need them.
- Access your data for all websites:
* This is Mozilla's way of saying that Tridactyl can read the content of web
pages. This is necessary in order to e.g. find the links you can follow
with the `:hint` command (bound to `f` by default).
- Read and modify bookmarks:
* Tridactyl's command line has a powerful autocompletion mechanism. In
order to be able to autocomplete your bookmarks, Tridactyl needs to read
them.
- Clear recent browsing history, cookies, and related data:
* Tridactyl implements the `:sanitize` command Vimperator and Pentadactyl
had. It works a bit like the "Clear All History" dialog you can access by
pressing `Ctrl+Shift+Del` on default Firefox.
- Get data from the clipboard:
* If your clipboard contains a URL, pressing `p` will make Tridactyl follow
this URL in the current tab.
- Input data to the clipboard:
* Tridactyl lets you copy various elements to the clipboard such as a page's
URL with `yy`, a link's URL with `;y` or the content of an HTML element
with `;p`.
- Download files and read and modify the browser's download history:
* By pressing `;s`, `;S`, `;a` and `;A` you can save documents and pictures
from a page to your download folder.
- Access browsing history:
* The URLs of websites you've visited previously can be suggested as
arguments for `:tabopen` and similar commands.
- Access recently closed tabs:
* If you've accidentally closed a tab or window, Tridactyl will let you open
it again with the `:undo` command which is bound to `u` by default.
- Access browser tabs:
* Tridactyl provides a quick tab-switching menu/command with the `:buffer`
command (bound to `b`). This permission is also required to close, move,
and pin tabs, amongst other things.
- Access browser activity during navigation:
* This is needed for Tridactyl to be able to go back to normal mode every
time you open a new page. In the future we may use it for autocommands.

View file

@ -120,6 +120,9 @@ NOTE: key modifiers (eg: control, alt) are not supported yet. See the FAQ below.
## Frequently asked questions
- Why doesn't Tridactyl respect my search engine settings?
It's a webextension limitation. Firefox doesn't allow reading user preferences.
- How can I change the search engine?
@ -149,7 +152,7 @@ NOTE: key modifiers (eg: control, alt) are not supported yet. See the FAQ below.
- When I type 'f', can I type link names (like Vimperator) in order to narrow down the number of highlighted links?
Not yet. See [issue #28](https://github.com/cmcaine/tridactyl/issues/28).
You can, thanks to @saulrh. First `set hintfiltermode vimperator` and then `set hintchars 1234567890`.
- How to remap keybindings in both normal mode and ex mode?
@ -165,11 +168,11 @@ NOTE: key modifiers (eg: control, alt) are not supported yet. See the FAQ below.
- Why doesn't Tridactyl work on websites with frames?
   It should work on some frames now. See [#122](https://github.com/cmcaine/tridactyl/issues/122).
It should work on some frames now. See [#122](https://github.com/cmcaine/tridactyl/issues/122).
- Can I change proxy via commands?
No, this is a limitation of WebExtensions.
Not yet, but this feature will eventually be implemented.
- How do I disable Tridactyl on certain sites?

View file

@ -0,0 +1,6 @@
#!/bin/sh
# Put the AMO flavour text in your clipboard for easy pasting.
# AMO doesn't support all HTML in markdown so we strip it out.
marked doc/amo.md | sed -r "s/<.?p>//g" | sed -r "s/<.?h.*>//g" | xclip -selection "clipboard"

View file

@ -202,7 +202,10 @@ export function unfocus() {
//#content
export function scrollpx(a: number, b: number) {
window.scrollBy(a, b)
let top = document.body.getClientRects()[0].top;
window.scrollBy(a, b);
if (top == document.body.getClientRects()[0].top)
recursiveScroll(a, b, [document.body])
}
/** If two numbers are given, treat as x and y values to give to window.scrollTo
@ -226,13 +229,43 @@ export function scrollto(a: number, b: number | "x" | "y" = "y") {
}
}
//#content_helper
function recursiveScroll(x: number, y: number, nodes: Element[]) {
let rect = null;
let node = null;
do {
node = nodes.splice(0, 1)[0]
if (!node)
return
rect = node.getClientRects()[0]
} while (!rect)
let top = rect.top
node.scrollBy(x, y);
if (top == node.getClientRects()[0].top) {
// children used to be .filter(DOM.isVisible)'d but apparently nodes
// that are !DOM.isVisible can have children that are DOM.isVisible
let children = Array.prototype.slice.call(node.childNodes)
recursiveScroll(x, y, nodes.concat(children))
}
}
//#content
export function scrollline(n = 1) {
let top = document.body.getClientRects()[0].top
window.scrollByLines(n)
if (top == document.body.getClientRects()[0].top) {
const cssHeight = window.getComputedStyle(document.body).getPropertyValue('line-height')
// Remove the "px" at the end
const lineHeight = parseInt(cssHeight.substr(0, cssHeight.length - 2))
// lineHeight probably can't be NaN but let's make sure
if (lineHeight)
recursiveScroll(0, lineHeight * n, [window.document.body])
}
}
//#content
export function scrollpage(n = 1) {
window.scrollBy(0, window.innerHeight * n)
scrollpx(0, window.innerHeight * n)
}
//export function find(query: string) {