web/wp-admin/js/comment.dev.js
changeset 204 09a1c134465b
parent 203 f507feede89a
child 205 a4f7897e21a9
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
     1 jQuery(document).ready( function($) {
       
     2 
       
     3 	var stamp = $('#timestamp').html();
       
     4 	$('.edit-timestamp').click(function () {
       
     5 		if ($('#timestampdiv').is(":hidden")) {
       
     6 			$('#timestampdiv').slideDown("normal");
       
     7 			$('.edit-timestamp').hide();
       
     8 		}
       
     9 		return false;
       
    10 	});
       
    11 
       
    12 	$('.cancel-timestamp').click(function() {
       
    13 		$('#timestampdiv').slideUp("normal");
       
    14 		$('#mm').val($('#hidden_mm').val());
       
    15 		$('#jj').val($('#hidden_jj').val());
       
    16 		$('#aa').val($('#hidden_aa').val());
       
    17 		$('#hh').val($('#hidden_hh').val());
       
    18 		$('#mn').val($('#hidden_mn').val());
       
    19 		$('#timestamp').html(stamp);
       
    20 		$('.edit-timestamp').show();
       
    21 		return false;
       
    22 	});
       
    23 
       
    24 	$('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
       
    25 		var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
       
    26 			newD = new Date( aa, mm - 1, jj, hh, mn );
       
    27 
       
    28 		if ( newD.getFullYear() != aa || (1 + newD.getMonth()) != mm || newD.getDate() != jj || newD.getMinutes() != mn ) {
       
    29 			$('.timestamp-wrap', '#timestampdiv').addClass('form-invalid');
       
    30 			return false;
       
    31 		} else {
       
    32 			$('.timestamp-wrap', '#timestampdiv').removeClass('form-invalid');
       
    33 		}
       
    34 
       
    35 		$('#timestampdiv').slideUp("normal");
       
    36 		$('.edit-timestamp').show();
       
    37 		$('#timestamp').html(
       
    38 			commentL10n.submittedOn + ' <b>' +
       
    39 			$( '#mm option[value="' + mm + '"]' ).text() + ' ' +
       
    40 			jj + ', ' +
       
    41 			aa + ' @ ' +
       
    42 			hh + ':' +
       
    43 			mn + '</b> '
       
    44 		);
       
    45 		return false;
       
    46 	});
       
    47 });