Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ If you'd like to request a city, please check out the [list of timezones in the
4. `gulp` to start a local server and watch changes.
5. Open <http://localhost:8000>

### Disabling Application Cache for Development in Chrome

1. Remove `manifest="homeslice.appcache"` from `<html lang="en" manifest="homeslice.appcache">`.
2. Visit <chrome://appcache-internals/> and delete the cache.

## License

![Creative Commons License](http://i.creativecommons.org/l/by-nc/4.0/80x15.png)
Expand Down
21 changes: 9 additions & 12 deletions assets/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,9 @@ var creditEl = document.createElement("div");
creditEl.setAttribute("class", "credit");
var creditCopy = "<p>Homeslice is a project by <a href=\"http://andytaylor.me/\">Andy&nbsp;Taylor</a> (@<a href=\"http://twitter.com/andytlr/\">andytlr</a>).</p> <p>If you find it useful (I hope you do), why not <a href=\"http://twitter.com/home?status=Homeslice: Find time across timezones. http://homeslice.in\">Tweet about it</a> or <a href=\"https://www.facebook.com/sharer/sharer.php?u=http://homeslice.in\">post it on&nbsp;Facebook</a>.</p> <p>Please submit bugs and requests on <a href=\"https://github.com/andytlr/homeslice/issues/\">GitHub</a>.</p>"

var formatCurrentTime = ''
var formatTime = ''
var formatNewDay = ''
var formatTimePlusThirty = ''
var formatMidday = ''
var formatTimeForList = ''
var formatForEmail = ''

function setTimeFormat() {
setCookie("timeformat", "12hr", 365);

function setTimeFormats() {
if (getCookie("timeformat") == "12hr" || getCookie("timeformat") == undefined) {
timeFormatButtonEl.innerHTML = "Use 24hr"
formatCurrentTime = 'ddd h:mma'
Expand All @@ -142,10 +136,9 @@ function setTimeFormat() {
}
}

setTimeFormat()
setInterval(setTimeFormat, interval);
setTimeFormats();

timeFormatButtonEl.onclick = function setTwentyFourHourTime() {
function changeTimeFormatting() {
if (getCookie("timeformat") == "12hr" || getCookie("timeformat") == undefined) {
setCookie("timeformat", "24hr", 365);
// console.log(getCookie("timeformat"));
Expand All @@ -155,6 +148,10 @@ timeFormatButtonEl.onclick = function setTwentyFourHourTime() {
}
}

timeFormatButtonEl.addEventListener("click", changeTimeFormatting, false);
timeFormatButtonEl.addEventListener("click", setTimeFormats, false);
timeFormatButtonEl.addEventListener("click", updateCities, false);

function areCookiesEnabled() {
var cookieEnabled = (navigator.cookieEnabled) ? true : false;

Expand Down
2 changes: 1 addition & 1 deletion homeslice.appcache
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ assets/icon.png
NETWORK:
*

# hash: 41ca710515bfa242fc44f8c7d19c7b3de9832e34b477c227ab5fff572408f937
# hash: 10640264966dcf689c4045145650b570de38ae8cd5add8fe9b483bbed856364c