1) Copy the code below to a text editor and edit the first four variables (apikey,sabnzbdserver,useSSL, and defaultCat) to your liking
2) Paste the edited code into the script box at http://userjs.up.seesaa.net/js/bookmarklet.html
3) Change the title of the script to whatever you'd like on the page
4) Bookmark the link at the bottom of the screen.
This has been tested with iPad, iPhone, Firefox and Safari. This code was developed using pieces from this greasemonkey script. Many thanks to the author of this script. YMMV!
Code: Select all
(function () {
var apikey = 'ENTER_API_KEY_HERE';
var sabnzbdserver = 'ENTER_SABNZBD_SERVER_ADDRESS_HERE(e.g. 192.168.1.1:9090)';
var useSSL = true;
var defaultCat = 'tv';
var checked_ids = new Array();
var nzbName = '';
var cat = prompt('Please enter the category for this nzb.', defaultCat);
var NZBcheckboxes = document.evaluate('//input[@type="checkbox"]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var j = 0; j < NZBcheckboxes.snapshotLength; j++) {
if (NZBcheckboxes.snapshotItem(j).checked == true) {
checked_ids.push(NZBcheckboxes.snapshotItem(j).name + '=1');
}
}
var str=location.search.match(/\bq\= *([^\&]+)/);
nzbName=str[1];
nzbName = prompt('Please enter the name for this nzb.', nzbName);
if (cat != '') {cat = 'cat=' + cat + '&';}
var transport = 'http://';
if (useSSL) {transport = 'https://';}
if (nzbName != '') {
window.open(transport + sabnzbdserver + '/sabnzbd/api?mode=addurl&apikey=' + apikey + '&nzbname= ' + escape(nzbName) + '&' + cat + 'name=' + escape('https://www.binsearch.info/?action=nzb&' + checked_ids.join('&')));
} else {
window.open(transport + sabnzbdserver + '/sabnzbd/api?mode=addurl&apikey=' + apikey + '&' + cat + 'name=' + escape('https://www.binsearch.info/?action=nzb&' + checked_ids.join('&')));
}
})()