Compare commits

..

No commits in common. "master" and "timefix" have entirely different histories.

3 changed files with 4 additions and 21 deletions

View File

@ -7,6 +7,3 @@ select {
.chkbox { .chkbox {
display: inline-block; display: inline-block;
} }
.time_copy_btn {
margin-left: 5px;
}

View File

@ -32,7 +32,7 @@ function startTime(){
hour:'2-digit', hour:'2-digit',
minute:'2-digit', minute:'2-digit',
second:'2-digit',}); second:'2-digit',});
if(display_origTZ){//Test if there is a non-null value for original_tz. If True then the part of the page this pertains to is being displayed. if(original_tz){//Test if there is a non-null value for original_tz. If True then the part of the page this pertains to is being displayed.
document.getElementById('time_original').innerHTML = current_time.toLocaleString('en-EN' ,{ document.getElementById('time_original').innerHTML = current_time.toLocaleString('en-EN' ,{
timeZone: original_tz, timeZone: original_tz,
hourCycle:'h24', hourCycle:'h24',
@ -46,14 +46,3 @@ function startTime(){
} }
//document.getElementById('JStz').innerHTML = current_tz; //document.getElementById('JStz').innerHTML = current_tz;
} }
function copy_timestamp(to_copy) {
var copyText = document.getElementById(to_copy).innerText;
var temp_element = document.createElement("textarea");
document.body.appendChild(temp_element)
temp_element.value = copyText;
temp_element.select();
temp_element.setSelectionRange(0,999);
document.execCommand("copy");
document.body.removeChild(temp_element);
}

View File

@ -15,9 +15,6 @@
$scriptHour = date('O'); $scriptHour = date('O');
$scriptTZ = date_default_timezone_get(); $scriptTZ = date_default_timezone_get();
} }
if($_POST['originalTZ']){
$orig_TZ_display = True;
}
} else{ } else{
$selectedTimezone = date_default_timezone_get(); $selectedTimezone = date_default_timezone_get();
$scriptTZ = date_default_timezone_get(); $scriptTZ = date_default_timezone_get();
@ -35,7 +32,7 @@
<meta name="author" content="efrick"/> <meta name="author" content="efrick"/>
<link href="/styles.css" type="text/css" rel="stylesheet"/> <link href="/styles.css" type="text/css" rel="stylesheet"/>
<link href="clock.css" type="text/css" rel="stylesheet"/> <link href="clock.css" type="text/css" rel="stylesheet"/>
<script>var current_tz=<?php echo json_encode($scriptTZ) . ',original_tz = ' . json_encode($originalTZ) . ',display_origTZ = ' . json_encode($orig_TZ_display);?></script> <script>var current_tz=<?php echo json_encode($scriptTZ) . ',original_tz = ' . json_encode($originalTZ);?></script>
<script type="text/javascript" src="clock.js"></script> <script type="text/javascript" src="clock.js"></script>
</head> </head>
<body> <body>
@ -48,13 +45,13 @@
"<br><span>". "<br><span>".
"<p id='time_body'>". "<p id='time_body'>".
date("D, M d, Y, H:i:s") . date("D, M d, Y, H:i:s") .
"</p><p> GMT". date("O T") ."</p><button class=\"time_copy_btn\" onclick='copy_timestamp(\"time_body\")'>Copy Timestamp</button>\n\t\t</span>"; "</p><p> GMT". date("O T") ."</p>\n\t\t</span>";
if($_POST['originalTZ']){// if the user want display the browser detected timezone as well as the selected one. if($_POST['originalTZ']){// if the user want display the browser detected timezone as well as the selected one.
date_default_timezone_set($originalTZ); date_default_timezone_set($originalTZ);
echo'<h3>Time in original Timezone</h3>'. echo'<h3>Time in original Timezone</h3>'.
'<span><p id="time_original">'. '<span><p id="time_original">'.
date("D, M d, Y, H:i:s") . date("D, M d, Y, H:i:s") .
"</p><p> GMT". date("O T") ."</p><button class=\"time_copy_btn\" onclick='copy_timestamp(\"time_original\")'>Copy Timestamp</button></span>"; "</p><p> GMT". date("O T") .'</p></span>';
date_default_timezone_set($scriptTZ); date_default_timezone_set($scriptTZ);
} }
if($_POST['displayOffset']){ if($_POST['displayOffset']){