diff --git a/README.md b/README.md index 05362e7..fa6df72 100644 --- a/README.md +++ b/README.md @@ -35,4 +35,4 @@ Homeslice is licensed under a [Creative Commons Attribution-NonCommercial 4.0 In [2]: http://www.iana.org/time-zones [3]: http://creativecommons.org/licenses/by-nc/4.0/ [4]: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones -[5]: http://nodejs.org \ No newline at end of file +[5]: http://nodejs.org diff --git a/assets/app.js b/assets/app.js index 7dc9887..13a9c59 100644 --- a/assets/app.js +++ b/assets/app.js @@ -90,7 +90,7 @@ cities = {} // Setup var defaultCities = "melbourne,sanfrancisco," -var interval = 500 +var interval = 2000 var hoursInTheFuture = 24 * 7 // Regex to match if a time difference is plus or minus 30min. // E.g. Adelaide is +0930. @@ -369,21 +369,35 @@ function updateCities(){ hourNode.setAttribute("data-email-content", cities[city][0] + "%0D%0A" + currentTime.format(formatForEmail) + "%0D%0A%0D%0A"); } - if (!hourNode.classList.contains("current")) { - hourNode.onclick = function toggleClassOnSelectedHours() { - selectedIndex = index; - } + // if (!hourNode.classList.contains("current")) { + // } + + // function setSelectedIndex() { + // selectedIndex = index; + // } + + // function clearSelection() { + // selectedIndex = undefined; + // } + + function addSelectedClass() { + this.classList.add("selectedhourforsharing"); + selectedIndex = index; } - if (index == selectedIndex) { - hourNode.classList.add("selectedhourforsharing"); - hourNode.onclick = function clearSelection() { - selectedIndex = undefined; + hourNode.addEventListener("click", addSelectedClass, true); + hourNode.addEventListener("click", hideOrShowEmailButton, true); + + function selectOtherCellsInRow(index, selectedIndex, hourNode) { + if (index == selectedIndex) { + hourNode.classList.add("selectedhourforsharing"); + } else { + hourNode.classList.remove("selectedhourforsharing"); } - } else { - hourNode.classList.remove("selectedhourforsharing"); } + hourNode.addEventListener("click", function(){ selectOtherCellsInRow(index, selectedIndex, hourNode) }, true); + // If timezone doesn't have a half hour difference, // And it's midnight, // and it isn't the first item (current time). @@ -545,7 +559,6 @@ function hideOrShowEmailButton() { } } hideOrShowEmailButton(); -setInterval(hideOrShowEmailButton, interval); shareButton.onclick = function emailSelectedHours() { var shareableHours = document.querySelectorAll('.selectedhourforsharing'); diff --git a/homeslice.appcache b/homeslice.appcache index 7435ef9..281361a 100755 --- a/homeslice.appcache +++ b/homeslice.appcache @@ -15,4 +15,4 @@ assets/icon.png NETWORK: * -# hash: 10640264966dcf689c4045145650b570de38ae8cd5add8fe9b483bbed856364c \ No newline at end of file +# hash: 5ba467f0916c6a75c11b36bb761830b094b131b40ce225834accd77f5ad66bc3 \ No newline at end of file diff --git a/index.html b/index.html index f943b74..08e5b36 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,6 @@ - + +