Skip to content
Open
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
[5]: http://nodejs.org
37 changes: 25 additions & 12 deletions assets/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -545,7 +559,6 @@ function hideOrShowEmailButton() {
}
}
hideOrShowEmailButton();
setInterval(hideOrShowEmailButton, interval);

shareButton.onclick = function emailSelectedHours() {
var shareableHours = document.querySelectorAll('.selectedhourforsharing');
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: 10640264966dcf689c4045145650b570de38ae8cd5add8fe9b483bbed856364c
# hash: 5ba467f0916c6a75c11b36bb761830b094b131b40ce225834accd77f5ad66bc3
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!doctype html>
<html lang="en" manifest="homeslice.appcache">
<!-- <html lang="en" manifest="homeslice.appcache"> -->
<html lang="en">

<head>
<meta charset="utf-8"/>
Expand Down