Skip to content

Commit

Permalink
fix bug with clicking on presenters timer > relates #8
Browse files Browse the repository at this point in the history
  • Loading branch information
VirtualDOMinic committed Sep 8, 2018
1 parent 0653120 commit 09ce9d3
Showing 1 changed file with 1 addition and 38 deletions.
39 changes: 1 addition & 38 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@ function createStopwatchArea(ppl, time, pplArr) {
// create "overview" text description
var areaIntro = document.createElement("p");

// parseFloat is to avoid using scientific/exp (e) notation
// var minsPerPerson = parseFloat((time / (ppl * 60000)).toPrecision(2));

areaIntro.textContent =
"There are " +
ppl +
Expand All @@ -158,7 +155,7 @@ stopwatchAreaListener = function() {
document
.getElementById("stopwatch-area")
.addEventListener("click", function(x) {
if (x.target.id.includes("presenter")) {
if (x.target.id.includes("presenter") && !x.target.id.includes("timer")) {
divSelectionHandler(x.target);
} else if (x.target.parentElement.id.includes("presenter")){
// this else if statement is to handle any div children
Expand Down Expand Up @@ -209,8 +206,6 @@ function createPeopleTest(i) {
presenterDiv.appendChild(presenterTime);
presenterDiv.appendChild(timerButton);
stopwatchArea.appendChild(presenterDiv);

console.log("finished createPeopleTest");
}

selectUserForTimer = function(usr) {
Expand All @@ -223,38 +218,6 @@ selectUserForTimer = function(usr) {
}
};

/*
basicTimer = function() {
console.log("Run: basicTimer");
var timerSched = window.setInterval(timerCB, 1000);
console.log(timerSched, "timersched ID");
};
timerCB = function() {
console.log("Run: timerCB");
var timeTest = 795000;
// 13 mins 15 seconds
formatTime(timeTest);
};
formatTime = function(ms) {
console.log("Run: formatTime");
var mins = 0;
var secs = 0;
mins += ms / 60000;
secs += (ms % 60000) / 1000;
console.log(Math.floor(mins) + "m:" + secs + "s");
};
*/

// Future plans...

// on form reset, check put the last used vals for number of people, total time, and names into form inputs
// edit: ^ this may not be necessary!


// CODE IS (WAS?) WAY TOO WET! Below, I'm making a function to update the div style, button text and userSelected, with input being the presenter div that has been clicked:

function divSelectionHandler(divClicked) {
console.log("divSelectionHandler called");
divClicked.parentElement.childNodes.forEach(function(div) {
Expand Down

0 comments on commit 09ce9d3

Please sign in to comment.