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

Commit 6c0b057

Browse files
committed
Feature: Added Links for Events as Suggested by @mariekythe2
Added also example to showcase how to use the new Links in events Also updated README.md for Event Format Resolves issue #19
1 parent 2ef6cd9 commit 6c0b057

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ var organizer = new Organizer("organizerContainer", // Organizer container id
167167
{
168168
startTime: "00:00",
169169
endTime: "24:00",
170-
text: "Christmas Day"
170+
text: "Christmas Day",
171+
link: "https://github.com/nizarmah" // this is optional :)
171172
}
172173
```
173174
> 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"

calendarorganizer.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,19 @@ Organizer.prototype.list = function (data) {
508508

509509
var paragraph = document.createElement("P");
510510
paragraph.id = this.id + "-list-item-" + i + "-text";
511-
paragraph.appendChild(document.createTextNode(data[i].text));
511+
512+
var textNode = document.createTextNode(data[i].text);
513+
if (data[i].link == undefined || data[i].link == "") {
514+
paragraph.appendChild(textNode);
515+
} else {
516+
var link = document.createElement("A");
517+
link.href = data[i].link;
518+
link.target = "_blank";
519+
link.class = this.id + " link";
520+
link.appendChild(textNode);
521+
522+
paragraph.appendChild(link);
523+
}
512524

513525
listItem.appendChild(division);
514526
listItem.appendChild(paragraph);

0 commit comments

Comments
 (0)