From aa3adf3a7ac095f8745a56599df8bf33ae3adf93 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 26 Mar 2012 21:08:36 -0400 Subject: Clear selection and searches on ESCAPE --- examples/config/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/config/config b/examples/config/config index 77686a0..febfba0 100644 --- a/examples/config/config +++ b/examples/config/config @@ -192,6 +192,8 @@ set ebind = @mode_bind global,-insert @on_event ESCAPE @set_mode @on_event ESCAPE event KEYCMD_CLEAR @on_event ESCAPE js uzbl.follow.clearHints() +@on_event ESCAPE search_clear +@on_event ESCAPE js window.getSelection().removeAllRanges() @bind = event ESCAPE @bind [ = event ESCAPE -- cgit v1.2.3 From e387bb4f79c126066193c1db5173faab82cd531a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 26 Mar 2012 21:09:15 -0400 Subject: Clear the KEYCMD before doing the action --- examples/data/scripts/follow.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/data/scripts/follow.sh b/examples/data/scripts/follow.sh index de126eb..7c2710a 100755 --- a/examples/data/scripts/follow.sh +++ b/examples/data/scripts/follow.sh @@ -20,6 +20,8 @@ case "$result" in uriaction=$1 uri=${result#XXXRETURNED_URIXXX} + printf 'set mode=\nevent KEYCMD_CLEAR\n' > "$UZBL_FIFO" + case "$uriaction" in set) printf 'uri '"$uri"'\n' | sed -e 's/@/\\@/' > "$UZBL_FIFO" @@ -28,5 +30,4 @@ case "$result" in printf "$uri" | xclip ;; esac - printf 'set mode=\nevent KEYCMD_CLEAR\n' > "$UZBL_FIFO" esac -- cgit v1.2.3 From 2ec145e0e5e2b7c15b0dd549962ca84515084622 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 26 Mar 2012 21:09:28 -0400 Subject: Do nothing if the URI is empty --- examples/data/scripts/follow.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/data/scripts/follow.sh b/examples/data/scripts/follow.sh index 7c2710a..5ed0fbb 100755 --- a/examples/data/scripts/follow.sh +++ b/examples/data/scripts/follow.sh @@ -22,6 +22,8 @@ case "$result" in printf 'set mode=\nevent KEYCMD_CLEAR\n' > "$UZBL_FIFO" + [ -z "$uri" ] && exit + case "$uriaction" in set) printf 'uri '"$uri"'\n' | sed -e 's/@/\\@/' > "$UZBL_FIFO" -- cgit v1.2.3 From cfbc480c78da072174b8df70d776f6c057a048c0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 26 Mar 2012 21:09:48 -0400 Subject: Mirror follow bindings for following text content --- examples/config/config | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/config/config b/examples/config/config index febfba0..c22178b 100644 --- a/examples/config/config +++ b/examples/config/config @@ -362,6 +362,11 @@ set follow_hint_keys = 0123456789 @cbind FL* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'returnuri') >\@ clipboard @cbind fi = spawn @scripts_dir/go_input.sh +@cbind ft* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'returnuri') >\@ set +@cbind fT* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'click') >\@ +@cbind Ft* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'newwindow') >\@ +@cbind FT* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'returnuri') >\@ clipboard + @cbind '* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'click') >\@ # Form filler binds -- cgit v1.2.3 From e14d88de39e8ac0e3502e5f24d85d78d33962218 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 26 Mar 2012 21:10:15 -0400 Subject: Add code and bindings to follow the current search --- examples/config/config | 6 ++++++ examples/data/scripts/follow.js | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/examples/config/config b/examples/config/config index c22178b..11f1d82 100644 --- a/examples/config/config +++ b/examples/config/config @@ -325,6 +325,7 @@ set ebind = @mode_bind global,-insert @cbind yu = sh 'echo -n "$UZBL_URI" | xclip' @cbind yU = sh 'echo -n "$1" | xclip' '\@SELECTED_URI' @cbind yy = sh 'echo -n "$UZBL_TITLE" | xclip' +@cbind ys = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('returnuri') >\@ clipboard # Clone current window @cbind c = event REQ_NEW_WINDOW \@uri @@ -362,6 +363,11 @@ set follow_hint_keys = 0123456789 @cbind FL* = spawn @scripts_dir/follow.sh \@< uzbl.follow("\@follow_hint_keys", "%s", 'returnuri') >\@ clipboard @cbind fi = spawn @scripts_dir/go_input.sh +@cbind fs = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('returnuri') >\@ set +@cbind fS = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('click') >\@ +@cbind Fs = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('newwindow') >\@ +@cbind FS = spawn @scripts_dir/follow.sh \@< uzbl.follow.followSelection('returnuri') >\@ clipboard + @cbind ft* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'returnuri') >\@ set @cbind fT* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'click') >\@ @cbind Ft* = spawn @scripts_dir/follow.sh \@< uzbl.follow.followTextContent("%s", 'newwindow') >\@ diff --git a/examples/data/scripts/follow.js b/examples/data/scripts/follow.js index 88f80f2..83bbf55 100644 --- a/examples/data/scripts/follow.js +++ b/examples/data/scripts/follow.js @@ -326,3 +326,19 @@ uzbl.follow.followLinks = function(str) { this.reDrawHints(leftover, len); } } + +uzbl.follow.followSelection = function(mode) { + var selection = window.getSelection() + if (!selection) + return + + var node = selection.anchorNode + if (!node) + return + + var el = node.parentElement + if (!el) + return + + this.elementSelected(el) +} -- cgit v1.2.3