2014-03-10 01:18:05 -04:00
|
|
|
$(document).ready(function(){
|
2014-09-30 18:20:37 -04:00
|
|
|
var loading = '<div class="spinner2"></div>';
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
function toggle_torrent_title(){
|
|
|
|
if ($('#use_torrents').prop('checked'))
|
|
|
|
$('#no-torrents').show();
|
|
|
|
else
|
|
|
|
$('#no-torrents').hide();
|
|
|
|
}
|
|
|
|
|
2014-03-20 14:03:22 -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 14:03:22 -04:00
|
|
|
}
|
2014-03-10 01:18:05 -04:00
|
|
|
|
2014-03-20 14:03:22 -04:00
|
|
|
$.fn.torrent_method_handler = function() {
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
var selectedProvider = $('#torrent_method :selected').val();
|
2014-03-20 14:03:22 -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-05-12 06:59:34 -04:00
|
|
|
$('#Torrent_Verify_Cert').hide();
|
2014-04-28 10:34:27 -04:00
|
|
|
$('#Torrent_username').show();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#Torrent_Path').hide();
|
2014-04-28 10:34:27 -04:00
|
|
|
$('#Torrent_Ratio').show();
|
2014-04-28 10:54:08 -04:00
|
|
|
$('#Torrent_Seed_Time').show();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#Torrent_High_Bandwidth').hide();
|
2014-04-28 10:34:27 -04:00
|
|
|
$('#Torrent_Label').show();
|
2014-05-08 18:28:28 -04:00
|
|
|
$('#label_warning').text('');
|
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 14:03:22 -04:00
|
|
|
} else if (selectedProvider == "transmission"){
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#t_blackhole_settings').hide();
|
|
|
|
$('#torrent_settings').show();
|
2014-05-12 06:59:34 -04:00
|
|
|
$('#Torrent_Verify_Cert').hide();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#Torrent_username').show();
|
|
|
|
$('#Torrent_Path').show();
|
|
|
|
$('#Torrent_Ratio').show();
|
2014-08-31 02:41:53 -04:00
|
|
|
$('#Torrent_Seed_Time').show();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#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 14:03:22 -04:00
|
|
|
} else if (selectedProvider == "deluge"){
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#t_blackhole_settings').hide();
|
|
|
|
$('#torrent_settings').show();
|
2014-05-11 03:31:38 -04:00
|
|
|
$('#Torrent_Verify_Cert').show();
|
2014-05-08 18:28:28 -04:00
|
|
|
$('#Torrent_Label').show();
|
2014-05-04 08:35:10 -04:00
|
|
|
$('#Torrent_username').show();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#Torrent_Path').show();
|
|
|
|
$('#Torrent_Ratio').show();
|
2014-04-28 10:54:08 -04:00
|
|
|
$('#Torrent_Seed_Time').hide();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#Torrent_High_Bandwidth').hide();
|
|
|
|
$('#host_desc').text('Deluge Host');
|
|
|
|
$('#username_desc').text('Deluge Username');
|
|
|
|
$('#password_desc').text('Deluge Password');
|
|
|
|
$('#label_desc').text('Deluge Label');
|
2014-05-08 18:28:28 -04:00
|
|
|
$('#label_warning').text('Note: Label plugin must be enabled in Deluge client. No blank spaces are allowed in label name');
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#directory_desc').text('Deluge Directory');
|
2014-03-20 14:03:22 -04:00
|
|
|
} else if (selectedProvider == "download_station"){
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#t_blackhole_settings').hide();
|
|
|
|
$('#torrent_settings').show();
|
2014-05-12 06:59:34 -04:00
|
|
|
$('#Torrent_Verify_Cert').hide();
|
2014-03-20 14:03:22 -04:00
|
|
|
$('#Torrent_Label').hide();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#Torrent_username').show();
|
|
|
|
$('#Torrent_Paused').hide();
|
2014-06-08 19:01:47 -04:00
|
|
|
$('#Torrent_Path').show();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#Torrent_Ratio').hide();
|
2014-04-28 10:54:08 -04:00
|
|
|
$('#Torrent_Seed_Time').hide();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#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-06-08 19:03:28 -04:00
|
|
|
$('#Torrent_Path').find('.fileBrowser').hide();
|
2014-03-20 14:03:22 -04:00
|
|
|
} else if (selectedProvider == "rtorrent"){
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#t_blackhole_settings').hide();
|
|
|
|
$('#torrent_settings').show();
|
2014-05-12 06:59:34 -04:00
|
|
|
$('#Torrent_Verify_Cert').hide();
|
2014-03-20 14:03:22 -04:00
|
|
|
$('#Torrent_Label').show();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#Torrent_username').show();
|
|
|
|
$('#Torrent_Paused').hide();
|
|
|
|
$('#Torrent_Path').show();
|
2014-05-08 18:28:28 -04:00
|
|
|
$('#Torrent_Ratio').hide();
|
2014-04-28 10:54:08 -04:00
|
|
|
$('#Torrent_Seed_Time').hide();
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#Torrent_High_Bandwidth').hide();
|
|
|
|
$('#host_desc').text('rTorrent Host');
|
|
|
|
$('#username_desc').text('rTorrent Username');
|
|
|
|
$('#password_desc').text('rTorrent Password');
|
|
|
|
$('#label_desc').text('rTorrent Label');
|
2014-05-08 18:28:28 -04:00
|
|
|
$('#label_warning').text('');
|
2014-03-10 01:18:05 -04:00
|
|
|
$('#directory_desc').text('rTorrent Directory');
|
|
|
|
}
|
2014-03-20 14:03:22 -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); });
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|