| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | (function ($) { |
| 2 | - "use strict"; | |
| 2 | + 'use strict' | |
| 3 | 3 | $(function () { |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Checkbox value switcher |
| @@ -17,69 +17,69 @@ | ||
| 17 | 17 | // }); |
| 18 | 18 | /** End Checkbox value switcher **/ |
| 19 | 19 | |
| 20 | 20 | /* Ensure groups visibility */ |
| 21 | - $('.switch input[type=checkbox], .select select').each(function(){ | |
| 21 | + $('.switch input[type=checkbox], .select select').each(function () { | |
| 22 | 22 | |
| 23 | - if ( $(this).data('show_group') ) { | |
| 23 | + if ($(this).data('show_group')) { | |
| 24 | 24 | |
| 25 | - var show = false; | |
| 26 | - if ( $(this).attr('checked') ) { | |
| 25 | + var show = false | |
| 26 | + if ($(this).attr('checked')) { | |
| 27 | 27 | show = true |
| 28 | - } else if ( typeof $(this).data('display_option') !== "undefined" && $(this).data('display_option') === $(this).val() ) { | |
| 29 | - show = true; | |
| 28 | + } else if (typeof $(this).data('display_option') !== 'undefined' && $(this).data('display_option') === $(this).val()) { | |
| 29 | + show = true | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - toggleGroup( $(this).data('show_group'), show); | |
| 32 | + toggleGroup($(this).data('show_group'), show) | |
| 33 | 33 | } |
| 34 | - }); | |
| 34 | + }) | |
| 35 | 35 | |
| 36 | - $('.switch, .select ').on('change', 'input[type=checkbox], select', function(){ | |
| 37 | - if ( $(this).data('show_group') ) { | |
| 38 | - var show = false; | |
| 39 | - if ( $(this).attr('checked') ) { | |
| 40 | - show = true; | |
| 41 | - } else if ( typeof $(this).data('display_option') !== "undefined" && $(this).data('display_option') === $(this).val() ) { | |
| 42 | - show = true; | |
| 36 | + $('.switch, .select ').on('change', 'input[type=checkbox], select', function () { | |
| 37 | + if ($(this).data('show_group')) { | |
| 38 | + var show = false | |
| 39 | + if ($(this).attr('checked')) { | |
| 40 | + show = true | |
| 41 | + } else if (typeof $(this).data('display_option') !== 'undefined' && $(this).data('display_option') === $(this).val()) { | |
| 42 | + show = true | |
| 43 | 43 | } |
| 44 | - toggleGroup( $(this).data('show_group'), show); | |
| 44 | + toggleGroup($(this).data('show_group'), show) | |
| 45 | 45 | } |
| 46 | - }); | |
| 47 | - }); | |
| 46 | + }) | |
| 47 | + }) | |
| 48 | 48 | |
| 49 | - var toggleGroup = function( name, show ){ | |
| 50 | - var $group = $( '#' + name ); | |
| 49 | + var toggleGroup = function (name, show) { | |
| 50 | + var $group = $('#' + name) | |
| 51 | 51 | |
| 52 | - if ( show ) { | |
| 53 | - $group.show(); | |
| 52 | + if (show) { | |
| 53 | + $group.show() | |
| 54 | 54 | } else { |
| 55 | - $group.hide(); | |
| 55 | + $group.hide() | |
| 56 | 56 | } |
| 57 | - }; | |
| 57 | + } | |
| 58 | 58 | |
| 59 | 59 | /* |
| 60 | 60 | * Useful functions |
| 61 | 61 | */ |
| 62 | - function check_checkbox_checked( input ){ // yes the name is an ironic | |
| 63 | - if ( $(input).attr('checked') === 'checked' ) { | |
| 64 | - $(input).siblings('input:hidden').val('on'); | |
| 62 | + function check_checkbox_checked (input) { // yes the name is an ironic | |
| 63 | + if ($(input).attr('checked') === 'checked') { | |
| 64 | + $(input).siblings('input:hidden').val('on') | |
| 65 | 65 | } else { |
| 66 | - $(input).siblings('input:hidden').val('off'); | |
| 66 | + $(input).siblings('input:hidden').val('off') | |
| 67 | 67 | } |
| 68 | 68 | } /* End check_checkbox_checked() */ |
| 69 | 69 | |
| 70 | - $.fn.check_for_extended_options = function() { | |
| 71 | - var extended_options = $(this).siblings('fieldset.group'); | |
| 72 | - if ( $(this).data('show-next') ) { | |
| 73 | - if ( extended_options.data('extended') === true) { | |
| 70 | + $.fn.check_for_extended_options = function () { | |
| 71 | + var extended_options = $(this).siblings('fieldset.group') | |
| 72 | + if ($(this).data('show-next')) { | |
| 73 | + if (extended_options.data('extended') === true) { | |
| 74 | 74 | extended_options |
| 75 | 75 | .data('extended', false) |
| 76 | - .css('height', '0'); | |
| 77 | - } else if ( (typeof extended_options.data('extended') === 'undefined' && $(this).attr('checked') === 'checked' ) || extended_options.data('extended') === false ) { | |
| 76 | + .css('height', '0') | |
| 77 | + } else if ((typeof extended_options.data('extended') === 'undefined' && $(this).attr('checked') === 'checked') || extended_options.data('extended') === false) { | |
| 78 | 78 | extended_options |
| 79 | 79 | .data('extended', true) |
| 80 | - .css('height', 'auto'); | |
| 80 | + .css('height', 'auto') | |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - }; | |
| 83 | + } | |
| 84 | 84 | |
| 85 | -}(jQuery)); | |
| 85 | +}(jQuery)) | |