Add second timestamp copy button.
When two timezones are displayed there is now a button to copy each of the timestamps.
This commit is contained in:
parent
3e7189690a
commit
95ad27846a
4
clock.js
4
clock.js
@ -47,8 +47,8 @@ function startTime(){
|
|||||||
//document.getElementById('JStz').innerHTML = current_tz;
|
//document.getElementById('JStz').innerHTML = current_tz;
|
||||||
}
|
}
|
||||||
|
|
||||||
function copy_timestamp() {
|
function copy_timestamp(to_copy) {
|
||||||
var copyText = document.getElementById("time_body").innerText;
|
var copyText = document.getElementById(to_copy).innerText;
|
||||||
var temp_element = document.createElement("textarea");
|
var temp_element = document.createElement("textarea");
|
||||||
document.body.appendChild(temp_element)
|
document.body.appendChild(temp_element)
|
||||||
temp_element.value = copyText;
|
temp_element.value = copyText;
|
||||||
|
@ -48,13 +48,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 onclick='copy_timestamp()'>Copy Timestamp</button>\n\t\t</span>";
|
"</p><p> GMT". date("O T") ."</p><button onclick='copy_timestamp(\"time_body\")'>Copy Timestamp</button>\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></span>';
|
"</p><p> GMT". date("O T") ."</p><button onclick='copy_timestamp(\"time_original\")'>Copy Timestamp</button></span>";
|
||||||
date_default_timezone_set($scriptTZ);
|
date_default_timezone_set($scriptTZ);
|
||||||
}
|
}
|
||||||
if($_POST['displayOffset']){
|
if($_POST['displayOffset']){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user