From c0ccab9264ed99e75ee42197eed8af7e77e023f5 Mon Sep 17 00:00:00 2001 From: bptato Date: Thu, 5 Jan 2023 00:57:57 +0100 Subject: Add ask() --- doc/config.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'doc/config.md') 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) + +`pager.ask(prompt)` +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))' +``` + + + -- cgit 1.4.1-2-gfad0