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

86 lines
2.8 KiB
JavaScript
Raw Normal View History

2014-09-30 18:20:37 -04:00
$(document).ready(function(){
$(".enabler").each(function(){
if (!$(this).prop('checked'))
2014-09-30 18:20:37 -04:00
$('#content_'+$(this).attr('id')).hide();
});
2014-09-30 18:20:37 -04:00
$(".enabler").click(function() {
if ($(this).prop('checked'))
2014-09-30 18:20:37 -04:00
$('#content_'+$(this).attr('id')).fadeIn("fast", "linear");
else
2014-09-30 18:20:37 -04:00
$('#content_'+$(this).attr('id')).fadeOut("fast", "linear");
});
2014-09-30 18:20:37 -04:00
$(".viewIf").click(function() {
if ($(this).prop('checked')) {
2014-09-30 18:20:37 -04:00
$('.hide_if_'+$(this).attr('id')).css('display','none');
$('.show_if_'+$(this).attr('id')).fadeIn("fast", "linear");
} else {
2014-09-30 18:20:37 -04:00
$('.show_if_'+$(this).attr('id')).css('display','none');
$('.hide_if_'+$(this).attr('id')).fadeIn("fast", "linear");
}
});
2014-09-30 18:20:37 -04:00
$(".datePresets").click(function() {
var def = $('#date_presets').val()
if ($(this).prop('checked') && '%x' == def) {
def = '%a, %b %d, %Y'
$('#date_use_system_default').html('1')
} else if (!$(this).prop('checked') && '1' == $('#date_use_system_default').html())
def = '%x'
$('#date_presets').attr('name', 'date_preset_old')
$('#date_presets').attr('id', 'date_presets_old')
$('#date_presets_na').attr('name', 'date_preset')
$('#date_presets_na').attr('id', 'date_presets')
$('#date_presets_old').attr('name', 'date_preset_na')
$('#date_presets_old').attr('id', 'date_presets_na')
if (def)
$('#date_presets').val(def)
});
2014-09-30 18:20:37 -04:00
// bind 'myForm' and provide a simple callback function
$('#configForm').ajaxForm({
2014-09-30 18:20:37 -04:00
beforeSubmit: function(){
$('.config_submitter').each(function(){
$(this).attr("disabled", "disabled");
$(this).after('<span><img src="' + sbRoot + '/images/loading16' + themeSpinner + '.gif"> Saving...</span>');
$(this).hide();
});
},
2014-09-30 18:20:37 -04:00
success: function(){
setTimeout('config_success()', 2000)
}
});
2014-09-30 18:20:37 -04:00
$('#api_key').click(function(){ $('#api_key').select() });
$("#generate_new_apikey").click(function(){
$.get(sbRoot + '/config/general/generateApiKey',
2014-09-30 18:20:37 -04:00
function(data){
if (data.error != undefined) {
alert(data.error);
return;
}
$('#api_key').val(data);
2014-09-30 18:20:37 -04:00
});
});
$('#branchCheckout').click(function () {
2014-07-27 20:45:05 -04:00
url = sbRoot+'/home/branchCheckout?branch='+$("#branchVersion").val();
2014-09-30 18:20:37 -04:00
window.location.href = url;
});
2014-09-30 18:20:37 -04:00
});
2014-09-30 18:20:37 -04:00
function config_success(){
$('.config_submitter').each(function(){
$(this).removeAttr("disabled");
$(this).next().remove();
$(this).show();
});
$('#email_show').trigger('notify');
}