4 ms·
Has anyone figured out how to pass multiple arguments to js? I want ":pocket my-tag" to trigger a bookmarklet with current url and the tag, but I think the pip
by anotheryou 8y ago
Has anyone figured out how to pass multiple arguments to js?
I want ":pocket my-tag" to trigger a bookmarklet with current url and the tag, but I think the piping only ever passes 1 parameter. I guess JS_VAR could be an array(?), but I wouldn't know how to fill it.
I guess I could just use one optional tag and get the url myself in js (window.location.href).
This worked in pentadactyl (also this is a functioning, non documented bookmarklet for pocket :) ):
function(){window.open('https://getpocket.com/edit?url='+escape(window.location.href)+'&tags=<args>', '_self');}
- bovine3dom 8y agoJS_ARG is a string. If you want an array, just split it on space or some other character of your choosing. E.g, `:alias only_first js -p window.alert(JS_ARG.split('|')[0])` `:only_first this bit | not this`. NB: untested, posted from 'phone.