18 Commits

Author SHA1 Message Date
20xd6 8eaa613659 Merge pull request '20xd6-patch-issue#8' (#9) from 20xd6-patch-issue#8 into master
Reviewed-on: #9
2021-11-23 08:57:23 -05:00
20xd6 e9425d87d2 Fix error adding class to copy buttons
The quotes arround the class assignment had not been properly escaped.
This was causing PHP to fail and return a blank page.
2021-11-23 08:54:28 -05:00
20xd6 cb83a330ef Update 'clock.css'
CSS portion of fix for issue #8
2021-11-19 17:17:01 -05:00
20xd6 7df5bbd271 Fix a display issue #8
Update index.php with class tags for the timestamp copy buttons.
2021-11-19 17:12:43 -05:00
20xd6 fb2e531f0d Merge pull request 'display_fix' (#7) from display_fix into master
Reviewed-on: #7
2021-05-09 15:45:29 -04:00
20xd6 95ad27846a Add second timestamp copy button.
When two timezones are displayed there is now a button to copy each of
the timestamps.
2021-05-09 15:28:56 -04:00
20xd6 3e7189690a Remove testing code. 2021-05-09 15:23:27 -04:00
20xd6 3cc49403c9 Fix an error attempting to update missing value.
The original timezone display was attempting to be updated even when it
was not displayed.
2021-05-09 15:19:44 -04:00
20xd6 dbad2b51a4 Merge pull request 'Merge change in prod into master branch.' (#6) from prod into master
Reviewed-on: #6
2021-05-09 15:05:13 -04:00
20xd6 e06839d684 Merge branch 'master' into prod 2021-05-09 15:04:06 -04:00
20xd6 163b2fdb3a Add readme to prod 2021-05-09 12:32:14 -04:00
20xd6 732a063229 Add Copy Timestamp
A button that will copy the current timestamp has been added.
2021-05-09 12:28:02 -04:00
20xd6 955cc9544b Merge branch 'timefix' into prod 2020-09-27 17:29:36 -04:00
20xd6 004fe37680 Merge pull request 'Resolution for #1' (#2) from timefix into master
Reviewed-on: #2
2020-09-27 17:17:30 -04:00
20xd6 7e3cf8ccd6 Fix #1
This should reslove the issue with the time not updating.
It appears that an issue with conflicting options for the time
formatting has been introduced.
2020-09-27 16:58:10 -04:00
20xd6 de2e79491c Rebasing from master.
I had started work on a new feature on the production branch. Master
having been protected.
2020-09-27 16:40:06 -04:00
20xd6 05a1f50ce0 Rebase master as true master.
I had started a new feature on master. This is not how it should be done
and I am now atoning for my mistakes.
2020-09-27 16:37:52 -04:00
20xd6 b10810b120 Remove the README.md from prod branch
This should be present on master but is unessary for deployment.
2020-09-06 11:35:47 -04:00
3 changed files with 23 additions and 10 deletions
+3
View File
@@ -7,3 +7,6 @@ select {
.chkbox { .chkbox {
display: inline-block; display: inline-block;
} }
.time_copy_btn {
margin-left: 5px;
}
+12 -4
View File
@@ -18,14 +18,12 @@ function startTime(){
+ current_time.toLocaleString('en-US', + current_time.toLocaleString('en-US',
{timeZone: current_tz, {timeZone: current_tz,
hourCycle:'h24', hourCycle:'h24',
timeStyle:'long',
hour: '2-digit', hour: '2-digit',
minute:'2-digit', minute:'2-digit',
second:'2-digit', second:'2-digit',
timeZoneName:'short'}); timeZoneName:'short'});
document.getElementById('time_body').innerHTML = current_time.toLocaleString('en-EN' ,{ document.getElementById('time_body').innerHTML = current_time.toLocaleString('en-EN' ,{
timeZone: current_tz, timeZone: current_tz,
dateStyle:'long',
hourCycle:'h24', hourCycle:'h24',
weekday:'short', weekday:'short',
month:'short', month:'short',
@@ -34,10 +32,9 @@ function startTime(){
hour:'2-digit', hour:'2-digit',
minute:'2-digit', minute:'2-digit',
second:'2-digit',}); second:'2-digit',});
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. 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.
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,
dateStyle:'long',
hourCycle:'h24', hourCycle:'h24',
weekday:'short', weekday:'short',
month:'short', month:'short',
@@ -49,3 +46,14 @@ 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);
}
+8 -6
View File
@@ -15,6 +15,9 @@
$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();
@@ -32,7 +35,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);?></script> <script>var current_tz=<?php echo json_encode($scriptTZ) . ',original_tz = ' . json_encode($originalTZ) . ',display_origTZ = ' . json_encode($orig_TZ_display);?></script>
<script type="text/javascript" src="clock.js"></script> <script type="text/javascript" src="clock.js"></script>
</head> </head>
<body> <body>
@@ -45,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>\n\t\t</span>"; "</p><p> GMT". date("O T") ."</p><button class=\"time_copy_btn\" 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 class=\"time_copy_btn\" 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']){
@@ -109,14 +112,13 @@
<br/> <br/>
<label for="originalTZ">Display original timezone</label> <label for="originalTZ">Display original timezone</label>
<input type="checkbox" name="originalTZ" value="origTZ"> <input type="checkbox" name="originalTZ" value="origTZ">
<span class="chkbox> <span class="chkbox">
<label for="displayOffset">Display offset of selected timezones</label> <label for="displayOffset">Display offset of selected timezones</label>
<input type="checkbox" name="displayOffset" value="disOS"/> <input type="checkbox" name="displayOffset" value="disOS"/>
</span> </span>
</form> </form>
<p id="JStz"><?php echo date("e");?></p> <p id="JStz"><?php echo date("e");?></p>
<h3>Timer</h3>
<a href="timer/" title="The timer page">Timer</a>
</div><!--end of "body" div--> </div><!--end of "body" div-->
</body> </body>
</html> </html>