1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-14 20:12:19 -05:00
SickRage/gui/slick/js/config.js

50 lines
1.5 KiB
JavaScript
Raw Normal View History

$(document).ready(function(){
$(".enabler").each(function(){
if (!$(this).prop('checked'))
$('#content_'+$(this).attr('id')).hide();
});
$(".enabler").click(function() {
if ($(this).prop('checked'))
$('#content_'+$(this).attr('id')).fadeIn("fast", "linear");
else
$('#content_'+$(this).attr('id')).fadeOut("fast", "linear");
});
// bind 'myForm' and provide a simple callback function
$('#configForm').ajaxForm({
beforeSubmit: function(){
$('.config_submitter').each(function(){
$(this).attr("disabled", "disabled");
$(this).after('<span><img src="'+sbRoot+'/images/loading16.gif"> Saving...</span>');
$(this).hide();
});
},
success: function(){
setTimeout('config_success()', 2000)
}
});
$('#api_key').click(function(){ $('#api_key').select() });
$("#generate_new_apikey").click(function(){
$.get(sbRoot + '/config/general/generateKey',
function(data){
if (data.error != undefined) {
alert(data.error);
return;
}
$('#api_key').val(data);
});
});
});
function config_success(){
$('.config_submitter').each(function(){
$(this).removeAttr("disabled");
$(this).next().remove();
$(this).show();
});
$('#email_show').trigger('notify');
}