Make WordPress Core

Ticket #14364: 14364.diff

File 14364.diff, 1.3 KB (added by rohan013, 10 years ago)

Adds a current time button to change the timestamp to the current date and time

  • src/wp-admin/includes/template.php

     
    775775
    776776<p>
    777777<a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e('OK'); ?></a>
     778<a href="#edit_timestamp" class="current-timestamp hide-if-no-js button"><?php _e('Current Time'); ?></a>
    778779<a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
    779780</p>
    780781<?php
  • src/wp-admin/js/post.js

     
    840840                        event.preventDefault();
    841841                });
    842842
     843                $timestampdiv.find('.current-timestamp').click( function( event ) {
     844                        $timestampdiv.slideUp('fast').siblings('a.edit-timestamp').show().focus();
     845                        $('#mm').val($('#cur_mm').val());
     846                        $('#jj').val($('#cur_jj').val());
     847                        $('#aa').val($('#cur_aa').val());
     848                        $('#hh').val($('#cur_hh').val());
     849                        $('#mn').val($('#cur_mn').val());
     850                        updateText();
     851                        event.preventDefault();
     852                });
     853
    843854                $('#post').on( 'submit', function( event ) {
    844855                        if ( ! updateText() ) {
    845856                                event.preventDefault();