diff options
Diffstat (limited to 'pentadactyl')
-rw-r--r-- | pentadactyl/.pentadactylrc | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/pentadactyl/.pentadactylrc b/pentadactyl/.pentadactylrc index a227d71..7826648 100644 --- a/pentadactyl/.pentadactylrc +++ b/pentadactyl/.pentadactylrc @@ -35,9 +35,27 @@ hi HintActive command! reader -js <<EOF if ( buffer.URL.spec.startsWith('about:reader?') ) { - dactyl.execute('back') + dactyl.execute('back') } else { - dactyl.open('about:reader?url=' + encodeURIComponent(buffer.URL.spec)) + dactyl.open('about:reader?url=' + encodeURIComponent(buffer.URL.spec)) } EOF map -builtin -ex <F9> :reader + +command! push2inbox -js <<EOF +function escape(msg) { + return msg.replace(/([^a-zA-Z0-9_])/g, "\\$1"); +} + +var selection = content.getSelection().toString(); +var entry = '\\* ' + escape(buffer.URL); + +if ( selection ) { + entry += '\\n\\t\\* ' + escape(selection); +} else if ( content.document.title ) { + entry += '\\n\\t\\* ' + escape(content.document.title); +} + +dactyl.execute('!echo ' + entry + ' >> ~/note/src/web/inbox.wiki'); +EOF +nmap b :push2inbox<CR> |