Skip to content

Commit

Permalink
Changed Foreach to for to enable safari support
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Aug 4, 2018
1 parent 8bbac11 commit 43d4bda
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions MMM-GoogleTasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Module.register("MMM-GoogleTasks",{
wrapper.className = "container ";
wrapper.className += this.config.tableClass;

// var numTasks = Object.keys(this.tasks).length;
var numTasks = Object.keys(this.tasks).length;

if (!this.tasks) {
wrapper.innerHTML = (this.loaded) ? "EMPTY" : "LOADING";
Expand All @@ -96,8 +96,9 @@ Module.register("MMM-GoogleTasks",{

var titleWrapper, dateWrapper, noteWrapper;

this.tasks.forEach((item, index) => {

//this.tasks.forEach((item, index) => {
for (i = 0; i < numTasks; i++) {
item = this.tasks[i];
titleWrapper = document.createElement('div');
titleWrapper.className = "item title";
titleWrapper.innerHTML = "<i class=\"fa fa-circle-thin\" ></i>" + item.title;
Expand Down Expand Up @@ -127,14 +128,14 @@ Module.register("MMM-GoogleTasks",{
}

// Create borders between parent items
if (index < this.tasks.length-1 && !this.tasks[index+1].parent) {
if (numTasks < this.tasks.length-1 && !this.tasks[numTasks+1].parent) {
titleWrapper.style.borderBottom = "1px solid #666";
dateWrapper.style.borderBottom = "1px solid #666";
}

wrapper.appendChild(titleWrapper);
wrapper.appendChild(dateWrapper);
});
};

return wrapper;
}
Expand Down

0 comments on commit 43d4bda

Please sign in to comment.