Commit graph

67 commits

Author SHA1 Message Date
glacambre
e59dde5a0f
{dom,hinting}.ts: Add elements located in iframes to hintable elements 2018-04-02 19:15:29 +02:00
glacambre
ddc83c7c37
{excmds,hinting}.ts: use DOM.focus() instead of elem.focus() 2018-04-02 14:53:13 +02:00
Oliver Blanthorn
120f1951c5
Merge branch 'master' of github.com:cmcaine/tridactyl into glacambre-hijack_listeners 2018-04-02 13:00:04 +01:00
glacambre
1eea9ea76f
hinting.ts: Prevent hint auto-selection on 'javascript:' hrefs 2018-03-18 17:57:42 +01:00
Oliver Blanthorn
972e69ad9c
Find mode tidied up for intrepid explorers. 2018-03-18 15:08:09 +00:00
Oliver Blanthorn
6d8fe17069
Add nascent find mode 2018-03-18 13:11:11 +00:00
Colin Caine
6afda3b632 Rewrite tabopen and openInNewTab
Fixes #342 and a bug where I used id rather than index.
2018-03-12 22:42:51 +00:00
Oliver Blanthorn
c042fd14b3
Add winopen equivalent to webext.ts, add and document private and window hints 2018-03-12 17:07:42 +00:00
Oliver Blanthorn
b8e1131281
Add hint window/private (untested) 2018-03-11 12:53:02 +00:00
Fabian Furger
9a19d872b1 WIP: Attempt to apply theme to hints
CSS adapted from here:
https://gist.github.com/KrazyCavin/a2fcda9d0e2980ab9a3caf5576081397
2018-03-08 21:57:21 +00:00
Colin Caine
7ea938f74f Revert "src: Simplify HintState constructor"
This reverts commit 092e501db4.

This was causing a bug identified by @glacambre and @Lexi where
sometimes the html function isn't defined when returning to a page with
history back.

Personally, I think it's probably webpack or Firefox's fault: content.ts
clearly imports html-tagged-template as it's first action.

If it's not their fault then it's html-tagged-template's fault: it must
be refusing to set window.html.
2018-03-05 23:06:18 +00:00
Oliver Blanthorn
a0e465c7b0
Merge branch 'master' of github.com:cmcaine/tridactyl into glacambre-impl_#309 2018-03-05 13:23:26 +00:00
glacambre
119758454f
Add cleanslate.css 2018-03-04 14:15:26 +01:00
glacambre
21994a1102
hinting.ts: Only add js elems to hintables for hintPageSimple/Background 2018-03-03 14:20:13 +01:00
glacambre
f584c67f16
src/{content,dom,hinting}.ts: Implement addEventListener hijacking
This commit makes Tridactyl aware of elements made interactive through
JavaScript and lets Tridactyl put hints on them.
Something possibly dangerous is done here: exporting a function to the
page's context. While it is believed that the current implementation is
secure and that pages can't discover whether the function has been
exported or not, this might change due to new standards being adopted by
firefox. One of these standards is the Custom Elements api:
https://developer.mozilla.org/en-US/docs/Web/Web_Components/Custom_Elements

It will be necessary to check how Tridactyl behaves once this API has
landed. The status of this API seems to be tracked here:
https://bugzilla.mozilla.org/show_bug.cgi?id=1406825
2018-03-03 14:20:06 +01:00
glacambre
3cd0125783
hinting.ts: Make hintPage follow link if there's only 1 option 2018-02-28 22:01:36 +01:00
Colin Caine
5937ee284b Fix #288 2018-02-18 22:22:47 +00:00
Colin Caine
259e4f182f Make tab opening behaviour more consistent 2018-02-18 16:08:19 +00:00
Colin Caine
b9292cd25e Typo: fix #310
Testing is hard.
2018-02-14 17:38:09 +00:00
Colin Caine
092e501db4 src: Simplify HintState constructor 2018-02-13 23:57:29 +00:00
Colin Caine
128080fed2 src: Fix vimperator-reflow hintfilter 2018-02-13 23:56:37 +00:00
Colin Caine
4884e0d6bb src: Truncate long hint text 2018-02-13 23:28:04 +00:00
Colin Caine
772da93894 src: simplify hintnames 2018-02-13 23:14:20 +00:00
Saul Reynolds-Haertle
b53de98903 escape hintchar regex in hint building for vimperator hintfiltermode 2018-02-13 23:08:53 +00:00
Saul Reynolds-Haertle
3231852dab Code quality: replace if-else blocks with switches 2018-02-13 23:08:53 +00:00
Saul Reynolds-Haertle
335d4bb167 Default hint build/filter is a function instead of a const dict 2018-02-13 23:08:53 +00:00
Saul Reynolds-Haertle
fcbda44a4f Unify code for 'vimperator' and 'vimperator-reflow' hintfiltermodes 2018-02-13 23:08:53 +00:00
Saul Reynolds-Haertle
282766ed1e Add vimperator-reflow hint filter mode
This mode works like vimperator-mode, but additionally renames hints
as they're filtered.
2018-02-13 23:08:53 +00:00
Saul Reynolds-Haertle
30d6dd1c2f Add hintmode config and new "vimperator" hinting mode
hintmode = "simple" is the default hinting mode, naming hints using
the hintchars configuration. It is the current tridactyl behavior and
is preserved unchanged.

hintmode = "vimperator" is a new hinting mode that allows the user to
filter hints using non-hintchar :alnum: characters. Hints with targets
whose html does not contain these characters as a subsequence (not
contiguous) will be filtered out.
2018-02-13 23:08:53 +00:00
Colin Caine
53e51497e7 logging: rewrite in OOP style 2017-12-30 00:46:26 +00:00
Colin Caine
f398895dce logging: introduce convenience functions 2017-12-29 23:58:23 +00:00
John Beard
fde956df53 Add save link/img hint submode (;s, ;S, ;a, ;A)
This adds the ability to save link targets or images. The save location
can be default, or the save as dialog can be invoked.

Somewhat sensible default filenames are provided.

Data URLs are also supported (though they need quite a bit of massaging
to get past the WebExt security limitations). Specificially, they need
to be round-tripped though a Blob, and must be saved from the background
context.
2017-12-24 11:20:26 +00:00
John Beard
080d6df9a3 Add hint kill submode (;k)
This submode deletes the selected hinted item. Useful for removing
overlay blockers or even unwanted/annoying content.
2017-12-17 17:39:54 +00:00
John Beard
c80d610068 Add <summary> tags to standard hinting
Used at least for Github user menu (top right) and Github wiki
expandable sections.
2017-12-04 02:20:29 +00:00
Oliver Blanthorn
8fa42bc442
Remove now disused hintorder setting 2017-12-03 13:55:56 +00:00
Orangenschalen
e06b98d220 fix 'if' scope and respect the javascript integer arithmetic 2017-12-02 16:34:06 +01:00
Orangenschalen
4991689dd7 use hint names of various lenghts 2017-12-02 14:49:19 +01:00
Orangenschalen
34aa42061e generate hint names with variable length
If the longer hint names use a shorter one as prefix,
then the shorter hint name is dropped from the hint
name list.
2017-12-02 14:48:46 +01:00
Oliver Blanthorn
8695552fe6
Fix #168: some pages didn't like the htmlblah strings. 2017-11-30 15:35:37 +00:00
John Beard
c69aac0a53 Add Text To Speech API (and hint mode)
This adds an excmd interface to the Web Speech API (TTS), which allows
users to read text out and set voice and parameters via config options.

Excmds:

    - ttsread: reads out the given text or element content (CSS selected)
    - ttsvoices: lists available voice names (can be used in the
      'ttsvoice' option)
    - ttscontrol: stops the current reading (should also pause/resume,
      but that doesn't seem to work right now)

Config options:
    - ttsvoice: the name of the voice to use
    - ttsrate: (0.1-10)
    - ttsvolume: (0-1)
    - ttspitch: (0-2)

Also the ;r hint submode is added which reads the textcontent of the
element with the configured voice
2017-11-30 04:43:55 +00:00
Oliver Blanthorn
bd6d3d4bb6
Add configuration options for hinting and documentation 2017-11-29 20:22:56 +00:00
Oliver Blanthorn
b990125792
Add hint -c [selector]: add hints that match selector
It's particularly good on Hacker News and Reddit with

`bind ;c hint -c [class*="expand"],[class="togg"]` for minimising
comments and expanding images.
2017-11-29 13:23:30 +00:00
Oliver Blanthorn
6cd93b233d
Allow ;p to yank any element which contains text 2017-11-29 12:09:37 +00:00
John Beard
f0dfe1d5da Refactor document CSS selector queries with dom.ts
The DOM.getElemsBySelector function makes it a bit less verbose to
construct an array of filtered elements matching a selector.

Also, this function is expanded to take multiple filters, applied
sequentially.
2017-11-29 02:27:49 +00:00
John Beard
a3ca5cd2c1 Add yank anchor hint submode (;#)
THis yanks the page URL with the hinted elements id or title as a hash
fragment, which can be used to link to the page at that element's
location.

For example: https://en.wikipedia.org/wiki/Vim_(text_editor)#History

;# nmap added, from Vimperator
2017-11-29 02:27:23 +00:00
Colin Caine
4a3a25751c hinting: Fix #136.
Hints still don't work for images, but I don't see any way we can detect that they're clickable, besides special casing instagram.
2017-11-28 17:19:50 +00:00
John Beard
221b94c8ff Add hint focus mode (;;)
This focuses the hinted element with excmd ":hint -;".

Includes VImperator binding to ";;"
2017-11-25 01:47:56 +00:00
Oliver Blanthorn
f018af900c
Merge branch 'master' of github.com:cmcaine/tridactyl into emanresusername-master 2017-11-23 10:24:40 +00:00
Oliver Blanthorn
1ecf2c9bc5
Merge branch 'master' of github.com:cmcaine/tridactyl into johnbeard-imghint 2017-11-23 10:01:54 +00:00
j
b95af255e4 add pre, code, span to HINTTAGS_text_selectors 2017-11-23 10:46:48 +09:00