-/**
- * Display JavaScript on the page.
- *
- * @package WordPress
- * @subpackage General_Settings_Screen
- */
-function add_js() {
-?>
-<script type="text/javascript">
-//<![CDATA[
- jQuery(document).ready(function($){
- $("input[name='date_format']").click(function(){
- if ( "date_format_custom_radio" != $(this).attr("id") )
- $("input[name='date_format_custom']").val( $(this).val() ).siblings('.example').text( $(this).siblings('span').text() );
- });
- $("input[name='date_format_custom']").focus(function(){
- $("#date_format_custom_radio").attr("checked", "checked");
- });
-
- $("input[name='time_format']").click(function(){
- if ( "time_format_custom_radio" != $(this).attr("id") )
- $("input[name='time_format_custom']").val( $(this).val() ).siblings('.example').text( $(this).siblings('span').text() );
- });
- $("input[name='time_format_custom']").focus(function(){
- $("#time_format_custom_radio").attr("checked", "checked");
- });
- $("input[name='date_format_custom'], input[name='time_format_custom']").change( function() {
- var format = $(this);
- format.siblings('img').css('visibility','visible');
- $.post(ajaxurl, {
- action: 'date_format_custom' == format.attr('name') ? 'date_format' : 'time_format',
- date : format.val()
- }, function(d) { format.siblings('img').css('visibility','hidden'); format.siblings('.example').text(d); } );
- });
- });
-//]]>
-</script>
-<?php
-}
-add_action('admin_head', 'add_js');