Add a README.md for documentation.
Removed the index.php file as this should be a simlink back to clock.php and git doesn't track it this way.
This commit is contained in:
parent
6e85595081
commit
ed4652ace1
23
README.md
Normal file
23
README.md
Normal file
@ -0,0 +1,23 @@
|
||||
# WebClock
|
||||
It's a clock. It runs in your browser.
|
||||
#### Description
|
||||
A simple clock for your web based timekeeping needs.
|
||||
Includes the abality to set the timezone you want if the one your browser chooes isn't what you need.
|
||||
The time will appear not only on the main page but also in the page's title so you can leave the page and still keep an eye on the time.
|
||||
#### Requierments
|
||||
```
|
||||
php - I'm running it on 5.6 so that or anything newer should work
|
||||
a webserver - I use apache. It's nice.
|
||||
A javascript interpriter - Basicaly a modernish webbrowser.
|
||||
```
|
||||
### Install
|
||||
1. git clone into a directory accessable by your webserver.
|
||||
`git clone https://efrick.ddns.net/scm/git/WebClock`
|
||||
2. Optional steps
|
||||
1. Edit `clock.php` to point to your CSS files.
|
||||
2. Add a symlink from `clock.php` to a file called `index.php`.
|
||||
`ln -s clock.php index.php`
|
||||
|
||||
### ToDo
|
||||
- [ ] Add a timer.
|
||||
- [ ] Multiple clocks for tracking regions.
|
107
index.php
107
index.php
@ -1,107 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<?php
|
||||
/* Catches the form post to update the timezone.
|
||||
* If there is no form submission it will just inishilize the
|
||||
* timezone variables to be passed to the JS.
|
||||
*/
|
||||
if(isset($_POST['formSubmit'])){
|
||||
$selectedTimezone = $_POST['userTimezone'];
|
||||
if(!isset($selectedTimezone)){
|
||||
//I don't have any error message set here. It will just reload the page.
|
||||
} else{
|
||||
date_default_timezone_set($selectedTimezone);
|
||||
$scriptTZ = date_default_timezone_get();
|
||||
}
|
||||
} else{
|
||||
$selectedTimezone = date_default_timezone_get();
|
||||
//date_default_timezone_set("America/Los_Angeles");
|
||||
$scriptTZ = date_default_timezone_get();
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title id='time_title'>
|
||||
<?php
|
||||
echo "Time is: " . date("H:i:s e");
|
||||
?>
|
||||
</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<meta name="author" content="efrick"/>
|
||||
<link href="/styles.css" type="text/css" rel="stylesheet"/>
|
||||
<script>var current_tz=<?php echo json_encode($scriptTZ);?></script>
|
||||
<script type="text/javascript" src="clock.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
Date and Time
|
||||
</h1>
|
||||
<div class="body">
|
||||
<?php //Print default time and date values for the JS to update.
|
||||
echo "The full date and time:".
|
||||
"<br>".
|
||||
"<p id='time_body'>".
|
||||
date("D, M d, Y, H:i:s") .
|
||||
" GMT" . date("O") . " (" . date("T") . ")"."</p>\n\t\t";
|
||||
echo '<p>The user timezone is now set to ' . $selectedTimezone . "</p>\n\t\t";
|
||||
echo '<p>The system timezone is now set to ' . $scriptTZ . "</p>\n";
|
||||
?>
|
||||
<div class="tz_select">
|
||||
<p>
|
||||
If the detcted timezone is not correct selct your timezone from the dropdown below.
|
||||
</p>
|
||||
</div>
|
||||
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
|
||||
<!---
|
||||
<select name="userTimezone" class="tz_select">
|
||||
<option value="" disabled selected class="invisable">Timezone</option>
|
||||
<option value="EDT">EDT</option>
|
||||
<option value="America/Denver">MDT</option>
|
||||
<option value="UTC">UTC</option>
|
||||
<option value="America/Los_Angeles">PDT</option>
|
||||
</select><br/>
|
||||
-->
|
||||
|
||||
<select name="userTimezone" class="tz_select">
|
||||
<option value="-12" >(GMT -12:00) Eniwetok, Kwajalein</option>
|
||||
<option value="-11" >(GMT -11:00) Midway Island, Samoa</option>
|
||||
<option value="America/Honolulu">(GMT -10:00 Hawaii No DST</option>
|
||||
<option value="America/Adak" >(GMT -10:00) Hawaii</option>
|
||||
<option value="America/Anchorage" >(GMT -9:00) Alaska</option>
|
||||
<option value="America/Los_Angeles" >(GMT -8:00) Pacific Time (US & Canada)</option>
|
||||
<option value="America/Denver" >(GMT -7:00) Mountain Time (US & Canada)</option>
|
||||
<option value="America/Chicago" >(GMT -6:00) Central Time (US & Canada), Mexico City</option>
|
||||
<option value="America/New_York" >(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima</option>
|
||||
<option value="-4.5">(GMT -4:30) Caracas</option>
|
||||
<option value="-4" >(GMT -4:00) Atlantic Time (Canada), La Paz, Santiago</option>
|
||||
<option value="-3.5">(GMT -3:30) Newfoundland</option>
|
||||
<option value="-3" >(GMT -3:00) Brazil, Buenos Aires, Georgetown</option>
|
||||
<option value="" >(GMT -2:00) Mid-Atlantic</option>
|
||||
<option value="Atlantic/Azores" >(GMT -1:00 hour) Azores, Cape Verde Islands</option>
|
||||
<option value="0" selected="selected">(GMT) Western Europe Time, London, Lisbon, Casablanca, Greenwich</option>
|
||||
<option value="1" >(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris</option>
|
||||
<option value="2" >(GMT +2:00) Kaliningrad, South Africa, Cairo</option>
|
||||
<option value="3" >(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg</option>
|
||||
<option value="3.5" >(GMT +3:30) Tehran</option>
|
||||
<option value="4" >(GMT +4:00) Abu Dhabi, Muscat, Yerevan, Baku, Tbilisi</option>
|
||||
<option value="4.5" >(GMT +4:30) Kabul</option>
|
||||
<option value="5" >(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent</option>
|
||||
<option value="5.5" >(GMT +5:30) Mumbai, Kolkata, Chennai, New Delhi</option>
|
||||
<option value="5.75">(GMT +5:45) Kathmandu</option>
|
||||
<option value="6" >(GMT +6:00) Almaty, Dhaka, Colombo</option>
|
||||
<option value="6.5" >(GMT +6:30) Yangon, Cocos Islands</option>
|
||||
<option value="7" >(GMT +7:00) Bangkok, Hanoi, Jakarta</option>
|
||||
<option value="Asia/Hong_Kong" >(GMT +8:00) Beijing, Perth, Singapore, Hong Kong</option>
|
||||
<option value="Asia/Tokyo" >(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk</option>
|
||||
<option value="Australia/Darwin" >(GMT +9:30) Adelaide, Darwin</option>
|
||||
<option value="Australia/Sydney" >(GMT +10:00) Eastern Australia, Guam, Vladivostok</option>
|
||||
<option value="11" >(GMT +11:00) Magadan, Solomon Islands, New Caledonia</option>
|
||||
<option value="12" >(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka</option>
|
||||
</select>
|
||||
|
||||
<input type="submit" name="formSubmit" value="Update" >
|
||||
</form>
|
||||
<p id="JStz">JS Timezone</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user