2014-03-10 01:18:05 -04:00
|
|
|
$(document).ready(function(){
|
|
|
|
var loading = '<img src="'+sbRoot+'/images/loading16.gif" height="16" width="16" />';
|
|
|
|
|
|
|
|
function toggle_torrent_title(){
|
|
|
|
if ($('#use_torrents').prop('checked'))
|
|
|
|
$('#no-torrents').show();
|
|
|
|
else
|
|
|
|
$('#no-torrents').hide();
|
|
|
|
}
|
|
|
|
|
2014-03-20 13:51:21 -04:00
|
|
|
$.fn.nzb_method_handler = function () {
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
var selectedProvider = $('#nzb_method :selected').val();
|
|
|
|
|
|
|
|
if (selectedProvider == "blackhole") {
|
|
|
|
$('#blackhole_settings').show();
|
|
|
|
$('#sabnzbd_settings').hide();
|
|
|
|
$('#testSABnzbd').hide();
|
|
|
|
$('#testSABnzbd-result').hide();
|
|
|
|
$('#nzbget_settings').hide();
|
|
|
|
} else if (selectedProvider == "nzbget") {
|
|
|
|
$('#blackhole_settings').hide();
|
|
|
|
$('#sabnzbd_settings').hide();
|
|
|
|
$('#testSABnzbd').hide();
|
|
|
|
$('#testSABnzbd-result').hide();
|
|
|
|
$('#nzbget_settings').show();
|
|
|
|
} else {
|
|
|
|
$('#blackhole_settings').hide();
|
|
|
|
$('#sabnzbd_settings').show();
|
|
|
|
$('#testSABnzbd').show();
|
|
|
|
$('#testSABnzbd-result').show();
|
|
|
|
$('#nzbget_settings').hide();
|
|
|
|
}
|
|
|
|
|
2014-03-20 13:51:21 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
$.fn.torrent_method_handler = function () {
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
var selectedProvider = $('#torrent_method :selected').val();
|
2014-03-20 13:51:21 -04:00
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
if (selectedProvider == "blackhole") {
|
|
|
|
$('#t_blackhole_settings').show();
|
|
|
|
$('#torrent_settings').hide();
|
|
|
|
} else if (selectedProvider == "utorrent") {
|
|
|
|
$('#t_blackhole_settings').hide();
|
|
|
|
$('#torrent_settings').show();
|
2014-03-20 13:51:21 -04:00
|
|
|
$('#Torrent_username').show();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#Torrent_Path').hide();
|
|
|
|
$('#Torrent_Ratio').hide();
|
|
|
|
$('#Torrent_High_Bandwidth').hide();
|
2014-03-20 13:51:21 -04:00
|
|
|
$('#Torrent_Label').show();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#host_desc').text('uTorrent Host');
|
|
|
|
$('#username_desc').text('uTorrent Username');
|
|
|
|
$('#password_desc').text('uTorrent Password');
|
|
|
|
$('#label_desc').text('uTorrent Label');
|
2014-03-20 13:51:21 -04:00
|
|
|
} else if (selectedProvider == "transmission") {
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#t_blackhole_settings').hide();
|
|
|
|
$('#torrent_settings').show();
|
|
|
|
$('#Torrent_username').show();
|
|
|
|
$('#Torrent_Path').show();
|
|
|
|
$('#Torrent_Ratio').show();
|
|
|
|
$('#Torrent_High_Bandwidth').show();
|
|
|
|
$('#Torrent_Label').hide();
|
|
|
|
$('#host_desc').html('Transmission Host');
|
|
|
|
$('#username_desc').text('Transmission Username');
|
|
|
|
$('#password_desc').text('Transmission Password');
|
|
|
|
$('#directory_desc').text('Transmission Directory');
|
2014-03-20 13:51:21 -04:00
|
|
|
} else if (selectedProvider == "deluge") {
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#t_blackhole_settings').hide();
|
|
|
|
$('#torrent_settings').show();
|
2014-03-20 13:51:21 -04:00
|
|
|
$('#Torrent_Label').show();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#Torrent_username').hide();
|
|
|
|
$('#Torrent_Path').show();
|
|
|
|
$('#Torrent_Ratio').show();
|
|
|
|
$('#Torrent_High_Bandwidth').hide();
|
|
|
|
$('#host_desc').text('Deluge Host');
|
|
|
|
$('#username_desc').text('Deluge Username');
|
|
|
|
$('#password_desc').text('Deluge Password');
|
|
|
|
$('#label_desc').text('Deluge Label');
|
|
|
|
$('#directory_desc').text('Deluge Directory');
|
2014-03-20 13:51:21 -04:00
|
|
|
} else if (selectedProvider == "download_station") {
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#t_blackhole_settings').hide();
|
|
|
|
$('#torrent_settings').show();
|
2014-03-20 13:51:21 -04:00
|
|
|
$('#Torrent_Label').hide();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#Torrent_username').show();
|
|
|
|
$('#Torrent_Paused').hide();
|
|
|
|
$('#Torrent_Path').hide();
|
|
|
|
$('#Torrent_Ratio').hide();
|
|
|
|
$('#Torrent_High_Bandwidth').hide();
|
|
|
|
$('#host_desc').text('Synology Host');
|
|
|
|
$('#username_desc').text('Synology Username');
|
|
|
|
$('#password_desc').text('Synology Password');
|
|
|
|
$('#label_desc').text('Synology Label');
|
|
|
|
$('#directory_desc').text('Synology Directory');
|
2014-03-20 13:51:21 -04:00
|
|
|
} else if (selectedProvider == "rtorrent") {
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#t_blackhole_settings').hide();
|
|
|
|
$('#torrent_settings').show();
|
2014-03-20 13:51:21 -04:00
|
|
|
$('#Torrent_Label').show();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#Torrent_username').show();
|
|
|
|
$('#Torrent_Paused').hide();
|
|
|
|
$('#Torrent_Path').show();
|
|
|
|
$('#Torrent_Ratio').show();
|
|
|
|
$('#Torrent_High_Bandwidth').hide();
|
|
|
|
$('#host_desc').text('rTorrent Host');
|
|
|
|
$('#username_desc').text('rTorrent Username');
|
|
|
|
$('#password_desc').text('rTorrent Password');
|
|
|
|
$('#label_desc').text('rTorrent Label');
|
|
|
|
$('#directory_desc').text('rTorrent Directory');
|
|
|
|
}
|
2014-03-20 13:51:21 -04:00
|
|
|
};
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
$('#nzb_method').change($(this).nzb_method_handler);
|
|
|
|
|
|
|
|
$(this).nzb_method_handler();
|
|
|
|
|
|
|
|
$('#testSABnzbd').click(function(){
|
|
|
|
$('#testSABnzbd-result').html(loading);
|
|
|
|
var sab_host = $('#sab_host').val();
|
|
|
|
var sab_username = $('#sab_username').val();
|
|
|
|
var sab_password = $('#sab_password').val();
|
|
|
|
var sab_apiKey = $('#sab_apikey').val();
|
|
|
|
|
|
|
|
$.get(sbRoot+"/home/testSABnzbd", {'host': sab_host, 'username': sab_username, 'password': sab_password, 'apikey': sab_apiKey},
|
|
|
|
function (data){ $('#testSABnzbd-result').html(data); });
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('#torrent_method').change($(this).torrent_method_handler);
|
|
|
|
|
|
|
|
$(this).torrent_method_handler();
|
|
|
|
|
|
|
|
$('#use_torrents').click(function(){
|
|
|
|
toggle_torrent_title();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#testTorrent').click(function(){
|
|
|
|
$('#testTorrent-result').html(loading);
|
|
|
|
var torrent_method = $('#torrent_method :selected').val();
|
|
|
|
var torrent_host = $('#torrent_host').val();
|
|
|
|
var torrent_username = $('#torrent_username').val();
|
|
|
|
var torrent_password = $('#torrent_password').val();
|
|
|
|
|
|
|
|
$.get(sbRoot+"/home/testTorrent", {'torrent_method': torrent_method, 'host': torrent_host, 'username': torrent_username, 'password': torrent_password},
|
|
|
|
function (data){ $('#testTorrent-result').html(data); });
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|