]> gitweb.fluxo.info Git - rhatto/dotfiles/vimperator.git/commitdiff
Scuttle: cleanup
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 18 Jun 2015 14:50:06 +0000 (11:50 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 18 Jun 2015 14:50:06 +0000 (11:50 -0300)
vimperator.dot.link/plugin/scuttle.js

index 8ce21780df4aeee1c5457fa53f7bfac445a8f0e0..06f160afa24f4ef9a4e4a11caa926ae954b607c9 100644 (file)
@@ -35,14 +35,13 @@ commands.addUserCommand(['scuttle'], "Save page as a bookmark on Scuttle",
         var re = new RegExp(/"([^"]+)"/);
         var ext = args.string.match(re);
         if (ext) {
-            tags = args.string.substr(ext[0].length).replace(/,,/g, ';').replace(/,/g, ' ').replace(/;/g, ', ').replace(/%2C/g, ',');
+            tags = args.string.substr(ext[0].length)
             url += "&extended=" + encodeURIComponent(ext[1]);
-            url += tags;
         } else {
-            tags = "&tags=" + encodeURIComponent(args.toString().replace(/,,/g, ';').replace(/,/g, ' ').replace(/;/g, ', ')).replace(/%2C/g, ',');
-            url += tags;
+            tags = args.string;
         }
 
+        url += "&tags=" + encodeURIComponent(tags).replace(/,,/g, ';').replace(/,/g, ' ').replace(/;/g, ', ').replace(/%2C/g, ',');
         var xhr = new XMLHttpRequest();
         xhr.open("POST", url, false);
         xhr.send(null);