Commit graph

2038 commits

Author SHA1 Message Date
Oliver Blanthorn
a0ac1a2878
Update dependencies 2018-09-11 22:24:21 +01:00
glacambre
547065fed7
Add unseturl ex command 2018-09-11 06:34:36 +02:00
glacambre
7bd108dbff
Fix site-specific config not being loaded on page load 2018-09-11 06:14:48 +02:00
glacambre
1a1688a83f
Implement site-specific settings
This PR implements site-specific settings. It requires multiple changes
and new features.

First, I needed to create a new value in `window.tri` named
`contentLocation`. This contentLocation object is either a Location or
URL object containing the URL of the currently selected tab of the
currently selected window. This is required because config.get() is not
asynchronous and we probably want to keep it that way, thus we can't
message the content script just to get the current url.

Then, we create a new object, URLCONFIGS, in content.ts. It behaves
exactly the same as USERCONFIG, except it has a level of indirection,
matching url patterns to config objects. This requires creating new
seturl, geturl and unseturl functions which behave mostly the same as
set, get and unset.

Last, we create a `seturl` ex command in order to interact with this new
object.
2018-09-10 18:51:31 +02:00
glacambre
7bf5198e65
Turn logging levels into string in the config
Using numbers instead of strings made things complicated when dealing
with logging (:set was more complex, :get returned a number instead of a
string...). This commit fixes this.

Note that this commit removes validation for logging levels. This means
that users can now set erroneous logging levels. Fixing this will
require better type info generation in the compiler and will happen in
another commit.
2018-09-10 17:39:08 +02:00
Oliver Blanthorn
9450798006
Merge pull request #998 from glacambre/fix_tabopenpos_last
Respect the tabs.move/tabs.create API
2018-09-10 10:34:04 +01:00
glacambre
a7ddcb1b5a
Respect the tabs.move/tabs.create API
According to MDN[1], when you create a tab that should be placed at the
end of a window, you should use the number of tabs of the window as
index.
But if you use tabs.move(), you should use an index value of -1[2].

Probably fixes https://github.com/tridactyl/tridactyl/issues/990 .

1: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/create#Parameters
2: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/move#Parameters
2018-09-10 07:05:47 +02:00
Oliver Blanthorn
da0604f344
Fix build button but for real this time
Doing this on my phone was a great idea
2018-09-08 23:48:30 +01:00
Oliver Blanthorn
9a9f8406d8
Fix build button 2018-09-08 23:46:57 +01:00
Colin Caine
f35370ac76 Update package-lock.json 2018-09-08 13:00:59 +01:00
Saul Reynolds-Haertle
d25811afc1 Clean up window fetching in BufferAllCompletionSource updateOptions 2018-09-08 12:29:57 +01:00
Saul Reynolds-Haertle
8916bfcb5b Replace "for each window, get tabs" with un-filtered "get all tabs" 2018-09-08 12:29:57 +01:00
Saul Reynolds-Haertle
fabd1b5679 Parallelize async in browserBg.allWindowTabs + BufferAll completion
Didn't bring the average down too much, but I think I killed a
long-tail. I'll have to do more extensive profiling.

Before:
78                  #####
117.78571428571429  ###############################
157.57142857142858  #######################################
197.35714285714286  ############################################################
237.14285714285714  ####################################
276.92857142857144  ##
316.7142857142857   #####
356.5               #######
396.2857142857143
436.07142857142856  #####
475.85714285714283  #####
515.6428571428571   ##
555.4285714285714   #####
595.2142857142857   ##
635                 #####

After:
74                  ###
101.85714285714286  #########################################
129.71428571428572  ######
157.57142857142858  ###########
185.42857142857142  ############################################################
213.28571428571428  ##########
241.14285714285714  ##################
269                 ################
296.85714285714283  ##########
324.7142857142857   ########
352.57142857142856  ######
380.42857142857144  ######
408.2857142857143   ###
436.14285714285717  ######
464                 #####
2018-09-08 12:29:57 +01:00
Oliver Blanthorn
af2b3ca2c9
Merge branch 'clean-hints-before-resolving-callback' 2018-09-07 22:34:00 +01:00
Saul Reynolds-Haertle
98b4faa086 Clean up hint elements and classes before resolving hint callbacks
This fixes the pop-in of the un-selected hints after one is selected,
since on completion we're removing all hints instead of just clearing
the filter. It also fixes hints remaining present on SPAs like github,
see #981.
2018-09-07 00:48:29 -07:00
Oliver Blanthorn
51fcf8aa74
Merge pull request #984 from ajgrf/master
Some small fixes to the native messenger installer
2018-09-06 17:07:43 +01:00
Alex Griffin
e8f216f441 Some small fixes to the native messenger installer 2018-09-06 10:02:31 -05:00
Oliver Blanthorn
d94a44cfbf
release 1.14.0 2018-09-05 16:38:03 +01:00
Oliver Blanthorn
6d7a8bfefd
Update changelog for 1.14.0 2018-09-05 16:37:42 +01:00
Oliver Blanthorn
35f48ae1f5
Merge branch 'key-translation-map' 2018-09-05 14:37:58 +01:00
Oliver Blanthorn
79fec22109
Add keymap excmd 2018-09-05 14:34:10 +01:00
Oliver Blanthorn
4f1ed4b63f
Merge pull request #979 from saulrh/unbreak-gobble
Unbreak gobble-mode
2018-09-05 11:25:31 +01:00
Saul Reynolds-Haertle
14889fbc58 Add key translation maps to help with i18n and accessibility 2018-09-05 03:19:31 -07:00
Saul Reynolds-Haertle
8c8b0a680f Unbreak gobble-mode
I apparently missed putting the relevant excmd into content-mode where
it could actually act on the state. >_>
2018-09-05 03:15:12 -07:00
Colin Caine
8f683f672c Make non-generic mode parsers report isMatch true
Causes keys to be suppressed in these modes too.
2018-09-04 21:51:46 +01:00
Colin Caine
f267291eae Add listener to window
If we want to suppress events we need to see them before anyone else, and window sees events before body.
2018-09-04 21:46:46 +01:00
Oliver Blanthorn
c920964ea1
Update changelog for 1.14.0 2018-09-04 13:21:28 +01:00
Oliver Blanthorn
8a2ec6fda0
Fix link to config help 2018-09-04 13:00:32 +01:00
Oliver Blanthorn
9a030adc71
Merge branch 'parsers-and-state-in-content' 2018-09-04 12:29:26 +01:00
Oliver Blanthorn
da50403a35
Add warning to new tab 2018-09-04 12:29:14 +01:00
Oliver Blanthorn
cb9386285c
Merge pull request #972 from glacambre/fix_followpagepatterns
config.ts: Fix followpagepatterns
2018-09-04 10:39:15 +01:00
glacambre
0fcef90a78
config.ts: Fix followpagepatterns
14d7acc5 accidentally broke the regexes used by followpage. This commit
fixes them.
2018-09-04 06:26:01 +02:00
Saul Reynolds-Haertle
58c3ed6fc6 Nuke msgsafe, since no need to message events any more, and fix ARIA
`pick` in `msgsafe.ts` was not type safe and was concealing an error
where HTMLElements don't have a `pick` property. Then
`MsgSafeNode.pick` would have always been absent, which would have
caused `isTextEditable` to fail to detect elements with the ARIA role
of `application`. Using real types throughout allows us to fix this by
iterating over `Element.attributes`, which appears to do the right
thing.
2018-09-02 16:25:34 -07:00
Saul Reynolds-Haertle
b1e7cce722 Remember to run prettier script on changed files 2018-09-02 16:25:34 -07:00
Saul Reynolds-Haertle
77d17a6d5f Fix typo in exmcds docstring, add TODO in bind-args mode mapping 2018-09-02 16:25:34 -07:00
Saul Reynolds-Haertle
e0fa3d0b52 Update tutor so it says each tab is in a mode instead of the browser 2018-09-02 16:25:34 -07:00
Saul Reynolds-Haertle
e4757a72a0 blacklistadd now only needs DocStart since mode is per-document
Per-document modes might actually leave `TabLeft` completely unused by
most people, so we should be careful to not let that code start to
decay.

Sample tridactylrc turned out to not need updating

It looks like help docs don't reference this functionality anywhere
else, so this should be all the autocommand-related changes.
2018-09-02 16:25:34 -07:00
Saul Reynolds-Haertle
d2d673aa86 when logging err to console, spread message array to unnest 2018-09-02 16:25:34 -07:00
Saul Reynolds-Haertle
fc08fa4471 Un-regress hinting and finding
Turned out this was simple - I'd forgotten to switch the controller to
use the content versions of hinting and finding, so the controller was
using the background versions which were messaging-based proxies for
the content versions that weren't running any more. Calling the
content versions directly fixed hinting immediately.
2018-09-02 16:25:34 -07:00
Saul Reynolds-Haertle
90fa242e84 fix name of content state script to fit style 2018-09-02 16:25:34 -07:00
Saul Reynolds-Haertle
48f433c6a5 Clean up controller_content a bit more 2018-09-02 16:25:34 -07:00
Oliver Blanthorn
b5845d3f03 Add key suppression back 2018-09-02 16:25:34 -07:00
Saul Reynolds-Haertle
d1e6a86539 Janky proof of concept for per-tab state, incl mode and parsers
I've been programming on pure instinct for like five hours and I'm not
sure what exactly I did any more. I *think* that what I did was
something like:
* Split `state.ts` into `state.ts` and `content_state.ts`, then
  removed mode from state and moved it to content_state.
* Made the types in content_state.ts a hair more powerful
* Fixed all errors resulting from those two changes, in the process
  swapping state out for content_state wherever appropriate.
* Moved a couple excmds from background into content since they
  depended heavily on the mode and should live with the mode
* Split the controller in half, moving the parser logic to the content
  script and leaving acceptExCmds in the background
  version. content_controller forwards excmds to background script
  using messaging.
* Nuked the keydown_* code, since we no longer need to forward keys to
  the background.
* Went around fixing everything resulting from *those* changes, mostly
  the various perversions of keydown listeners
* Various tweaks here and there that probably didn't do anything but I
  was just changing things at random a third of the time and I really
  need to go through this and clean it up.

Things that work:
* excmds are nice now. each tab has its own commandline; they stay
  open when you navigate between tabs and you can come back to them
  after doing stuff in another tab and finish your command line input.
* keybinds that don't don't involve mode switching: `[[`, `]]`, `j`,
  `k`, `r`, etc, all still functional.
* You can turn on hinting mode and, again, navigate to another tab
  which will *not* be in hinting mode, do whatever you need to do
  there including excmds or more hinting, and then come back to finish
  the hint you started in the first tab
* You can exit hint mode by pressing escape. :P

Things that I broke:
* ...Actually quite a bunch of stuff, I think.
* I don't seem to be able to *finish* a hint any more. Sometimes I
  can't even get one key in.
2018-09-02 16:25:34 -07:00
Oliver Blanthorn
97416e3510
Merge pull request #967 from glacambre/fix_installnative
config.ts: Fix broken `:installnative` command
2018-09-02 14:41:22 +01:00
glacambre
0840c9eacb
config.ts: Fix broken :installnative command
https://github.com/tridactyl/tridactyl/pull/964 broke `:installnative`
because I forgot to convert both `nativeinstallcmd` and
`win_nativeinstallcmd` to the new format. This commit fixes that.
2018-09-02 15:18:31 +02:00
Oliver Blanthorn
0aa919f73d
Fix link to configuration 2018-09-02 11:08:26 +01:00
glacambre
8b8e8375b4
config.ts: Small improvements to doc/types
This commit turns tts settings into strings and adds documentation where
needed.
2018-09-02 11:52:21 +02:00
Oliver Blanthorn
b109e8d0a8
Make truncation clearer 2018-09-01 22:55:56 +01:00
glacambre
3e9c212b3e
Implement typechecking for known settings
This commit implements typechecking in the `:set` excmd. It uses metadata
to make sure the given argument is valid.

Some of the settings were stored as numbers in the config while they
were passed as strings to `:set()`. This prevented them from being
configurable. This has been fixed by turning them into string in the
config and ensuring that they are correctly deserialized when retrieved
from the config.

Note that there still are a few settings that are stored as int in the
config (namely the tts ones). This should probably be fixed at some
point but is not urgent as it has always been impossible to configure
them and nobody ever complained about it.
2018-09-01 22:45:48 +02:00
glacambre
a7f85f2f73
completions/Settings.ts: Add type and documentation to completion opts 2018-09-01 22:03:19 +02:00