diff options
author | bptato <nincsnevem662@gmail.com> | 2023-01-05 00:57:57 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-01-05 00:57:57 +0100 |
commit | c0ccab9264ed99e75ee42197eed8af7e77e023f5 (patch) | |
tree | d70478a6dfb1e618c19ebf8079469bb52efcdaa3 /doc/config.md | |
parent | 0edb5d3230730990d922328822e19833d807a040 (diff) | |
download | chawan-c0ccab9264ed99e75ee42197eed8af7e77e023f5.tar.gz |
Add ask()
Diffstat (limited to 'doc/config.md')
-rw-r--r-- | doc/config.md | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/doc/config.md b/doc/config.md index 5aec7a5d..70db113a 100644 --- a/doc/config.md +++ b/doc/config.md @@ -218,7 +218,7 @@ Examples: match = '^ddg:' substitute-url = '(x) => "https://lite.duckduckgo.com/lite/?kp=-1&kd=-1&q=" + x.substring(4)' -# Search using wikipedia, Firefox-style. +# Search using Wikipedia, Firefox-style. [[omnirule]] match = '^@wikipedia' substitute-url = '(x) => "https://en.wikipedia.org/wiki/Special:Search?search=" + x.replace(/@wikipedia/, "")' @@ -374,7 +374,7 @@ escape to the keybinding respectively (essentially making `M-` the same as 'C-M-j' = 'pager.load()' # change URL when Control, Escape and j are pressed 'gg' = 'pager.cursorFirstLine()' # go to the first line of the page when g is pressed twice ``` -An action is a JavaScript function called by chawan every time the keybinding +An action is a JavaScript function called by Chawan every time the keybinding is typed in. A list of built-in pager functions can be found below. ### Pager actions @@ -639,6 +639,15 @@ calls allow cycling through the two. (i.e. by default, press u once -> title, press again -> URL)</td> </tr> +<tr> +<td>`pager.ask(prompt)`</td> +<td>Ask the user for confirmation. Useful for e.g. an exit prompt: +``` +q = 'pager.ask("Do you want to exit Chawan?").then(x => x ? pager.quit() : void(0))' +``` +</td> +</tr> + </table> |