]> gitweb.fluxo.info Git - rhatto/dotfiles/vimperator.git/commitdiff
Initial links posting code
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 2 Jun 2015 14:53:22 +0000 (11:53 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 2 Jun 2015 14:53:22 +0000 (11:53 -0300)
vimperatorrc.dot.link

index 0662fdcb04d79372db9ded22a505f0992d57819e..0ba99727031bdeb5afdcf05ac3791293e775826e 100644 (file)
@@ -46,3 +46,18 @@ command sendtabs :emenu File.Send Tab URLs...
 " Copy URLs shortcut
 " https://addons.mozilla.org/en-US/firefox/addon/copyurls/
 command copyurls :emenu Edit.Copy Urls Expert.Tabs In This Window
+
+" FIXME
+" Post to Links Saraventos
+command! -nargs=* link js link(<args>);
+:js <<EOJS
+  link = function(args) {
+    var instance = 'https://links.sarava.org/bookmarks?action=add&address=';
+    var doc      = content.document;
+    var href     = encodeURIComponent(content.document.location);
+    var title    = encodeURIComponent(content.document.title);
+    var desc     = encodeURIComponent(doc.getSelection());
+    var tags     = encodeURIComponent(args.toString().replace(/,,/g, ';').replace(/,/g, ' ').replace(/;/g, ', '));
+    commands.execute('tabopen ' + instance + href + '&title=' + title + '&description=' + desc + '&tags=' + tags);
+  }
+EOJS