Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Commit

Permalink
Feature: Added Links for Events as Suggested by @mariekythe2
Browse files Browse the repository at this point in the history
Added also example to showcase how to use the new Links in events
Also updated README.md for Event Format

Resolves issue #19
  • Loading branch information
nizarmah committed Mar 5, 2020
1 parent 2ef6cd9 commit 6c0b057
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ var organizer = new Organizer("organizerContainer", // Organizer container id
{
startTime: "00:00",
endTime: "24:00",
text: "Christmas Day"
text: "Christmas Day",
link: "https://github.com/nizarmah" // this is optional :)
}
```
> Since starting and ending time are strings, 24 hour time is not required. You can just use "12:00am" and "12:00pm" instead of "00:00" and "24:00"
Expand Down
14 changes: 13 additions & 1 deletion calendarorganizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,19 @@ Organizer.prototype.list = function (data) {

var paragraph = document.createElement("P");
paragraph.id = this.id + "-list-item-" + i + "-text";
paragraph.appendChild(document.createTextNode(data[i].text));

var textNode = document.createTextNode(data[i].text);
if (data[i].link == undefined || data[i].link == "") {
paragraph.appendChild(textNode);
} else {
var link = document.createElement("A");
link.href = data[i].link;
link.target = "_blank";
link.class = this.id + " link";
link.appendChild(textNode);

paragraph.appendChild(link);
}

listItem.appendChild(division);
listItem.appendChild(paragraph);
Expand Down
Loading

0 comments on commit 6c0b057

Please sign in to comment.