From 97b698f22aded064b93de2b2af7dd5807997b796 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 8 Sep 2014 21:01:34 +1000 Subject: [PATCH 1/2] Update readme --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 0107748..05362e7 100644 --- a/README.md +++ b/README.md @@ -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 +### Disabling Application Cache for Development in Chrome + +1. Remove `manifest="homeslice.appcache"` from ``. +2. Visit and delete the cache. + ## License ![Creative Commons License](http://i.creativecommons.org/l/by-nc/4.0/80x15.png) From df80f3b58bc8e84ab4af3f55db2e813ce537b000 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Mon, 8 Sep 2014 21:09:01 +1000 Subject: [PATCH 2/2] Use EventListeners for time formatting --- assets/app.js | 21 +++++++++------------ homeslice.appcache | 2 +- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/assets/app.js b/assets/app.js index ab44956..7dc9887 100644 --- a/assets/app.js +++ b/assets/app.js @@ -110,15 +110,9 @@ var creditEl = document.createElement("div"); creditEl.setAttribute("class", "credit"); var creditCopy = "

Homeslice is a project by Andy Taylor (@andytlr).

If you find it useful (I hope you do), why not Tweet about it or post it on Facebook.

Please submit bugs and requests on GitHub.

" -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' @@ -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")); @@ -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; diff --git a/homeslice.appcache b/homeslice.appcache index 7ad10f6..7435ef9 100755 --- a/homeslice.appcache +++ b/homeslice.appcache @@ -15,4 +15,4 @@ assets/icon.png NETWORK: * -# hash: 41ca710515bfa242fc44f8c7d19c7b3de9832e34b477c227ab5fff572408f937 \ No newline at end of file +# hash: 10640264966dcf689c4045145650b570de38ae8cd5add8fe9b483bbed856364c \ No newline at end of file