47 } |
47 } |
48 |
48 |
49 $siteName.text( title ); |
49 $siteName.text( title ); |
50 }); |
50 }); |
51 |
51 |
52 $("input[name='date_format']").click(function(){ |
52 $( 'input[name="date_format"]' ).click( function() { |
53 if ( "date_format_custom_radio" != $(this).attr("id") ) |
53 if ( 'date_format_custom_radio' !== $(this).attr( 'id' ) ) |
54 $( 'input[name="date_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() ); |
54 $( 'input[name="date_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() ); |
55 }); |
55 }); |
|
56 |
56 $( 'input[name="date_format_custom"]' ).on( 'click input', function() { |
57 $( 'input[name="date_format_custom"]' ).on( 'click input', function() { |
57 $( '#date_format_custom_radio' ).prop( 'checked', true ); |
58 $( '#date_format_custom_radio' ).prop( 'checked', true ); |
58 }); |
59 }); |
59 |
60 |
60 $("input[name='time_format']").click(function(){ |
61 $( 'input[name="time_format"]' ).click( function() { |
61 if ( "time_format_custom_radio" != $(this).attr("id") ) |
62 if ( 'time_format_custom_radio' !== $(this).attr( 'id' ) ) |
62 $( 'input[name="time_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() ); |
63 $( 'input[name="time_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() ); |
63 }); |
64 }); |
64 |
65 |
65 $( 'input[name="time_format_custom"]' ).on( 'click input', function() { |
66 $( 'input[name="time_format_custom"]' ).on( 'click input', function() { |
66 $( '#time_format_custom_radio' ).prop( 'checked', true ); |
67 $( '#time_format_custom_radio' ).prop( 'checked', true ); |
78 // If custom date is not empty. |
79 // If custom date is not empty. |
79 if ( format.val() ) { |
80 if ( format.val() ) { |
80 spinner.addClass( 'is-active' ); |
81 spinner.addClass( 'is-active' ); |
81 |
82 |
82 $.post( ajaxurl, { |
83 $.post( ajaxurl, { |
83 action: 'date_format_custom' == format.attr( 'name' ) ? 'date_format' : 'time_format', |
84 action: 'date_format_custom' === format.attr( 'name' ) ? 'date_format' : 'time_format', |
84 date : format.val() |
85 date : format.val() |
85 }, function( d ) { spinner.removeClass( 'is-active' ); example.text( d ); } ); |
86 }, function( d ) { spinner.removeClass( 'is-active' ); example.text( d ); } ); |
86 } |
87 } |
87 }, 500 ) ); |
88 }, 500 ) ); |
88 } ); |
89 } ); |