Skip to content

Commit c5ee4ea

Browse files
committed
add methods private
1 parent 286faf8 commit c5ee4ea

File tree

1 file changed

+27
-53
lines changed

1 file changed

+27
-53
lines changed

pf-calendar-events.html

Lines changed: 27 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@
823823
if (current) {
824824
var self = this;
825825
window.setTimeout(function () {
826-
self.openDay(current);
826+
self._openDay(current);
827827
}, 500);
828828
}
829829
}
@@ -887,9 +887,9 @@
887887
this.oldMonth.addEventListener('webkitAnimationEnd', function () {
888888
self.oldMonth.parentNode.removeChild(self.oldMonth);
889889
self.month = self._createElement('div', 'month');
890-
self.backFill();
891-
self.currentMonth();
892-
self.fowardFill();
890+
self._backFill();
891+
self._currentMonth();
892+
self._fowardFill();
893893
self.el.appendChild(self.month);
894894
window.setTimeout(function () {
895895
self.month.className = 'month in ' + (self.next ? 'next' : 'prev');
@@ -898,15 +898,15 @@
898898
} else {
899899
this.month = this._createElement('div', 'month');
900900
this.el.appendChild(this.month);
901-
this.backFill();
902-
this.currentMonth();
903-
this.fowardFill();
901+
this._backFill();
902+
this._currentMonth();
903+
this._fowardFill();
904904
this.month.className = 'month new';
905905
}
906906
}
907907

908908

909-
backFill() {
909+
_backFill() {
910910

911911
var clone = this.current.clone();
912912
var dayOfWeek = clone.day();
@@ -918,11 +918,11 @@
918918
clone.subtract('days', dayOfWeek + 1);
919919

920920
for (var i = dayOfWeek; i > 0; i--) {
921-
this.drawDay(clone.add('days', 1));
921+
this._drawDay(clone.add('days', 1));
922922
}
923923
}
924924

925-
fowardFill() {
925+
_fowardFill() {
926926

927927
var clone = this.current.clone().add('months', 1).subtract('days', 1);
928928
var dayOfWeek = clone.day();
@@ -932,23 +932,23 @@
932932
}
933933

934934
for (var i = dayOfWeek; i < 6; i++) {
935-
this.drawDay(clone.add('days', 1));
935+
this._drawDay(clone.add('days', 1));
936936
}
937937
}
938938

939939

940-
currentMonth() {
940+
_currentMonth() {
941941

942942
var clone = this.current.clone();
943943

944944
while (clone.month() === this.current.month()) {
945-
this.drawDay(clone);
945+
this._drawDay(clone);
946946
clone.add('days', 1);
947947
}
948948
}
949949

950950

951-
getWeek(day) {
951+
_getWeek(day) {
952952

953953
if (!this.week || day.day() === 0) {
954954
this.week = this._createElement('div', 'week');
@@ -957,16 +957,16 @@
957957
}
958958

959959

960-
drawDay(day) {
960+
_drawDay(day) {
961961

962962
var self = this;
963-
this.getWeek(day);
963+
this._getWeek(day);
964964

965965
//Outer Day
966-
var outer = this._createElement('div', this.getDayClass(day));
966+
var outer = this._createElement('div', this._getDayClass(day));
967967
if (day.month() == this.current.month()) {
968968
outer.addEventListener('click', function () {
969-
self.openDay(this);
969+
self._openDay(this);
970970
var currentSelected = self.shadowRoot.querySelector('.numberCircle');
971971
if(currentSelected) {
972972
currentSelected.className = "day-number"
@@ -985,15 +985,15 @@
985985

986986
//Events
987987
var events = this._createElement('div', 'day-events');
988-
this.drawEvents(day, events);
988+
this._drawEvents(day, events);
989989

990990
outer.appendChild(name);
991991
outer.appendChild(number);
992992
outer.appendChild(events);
993993
this.week.appendChild(outer);
994994
}
995995

996-
drawEvents(day, element) {
996+
_drawEvents(day, element) {
997997
var self = this;
998998
if (day.month() === this.current.month()) {
999999
var todaysEvents = this.events.reduce(function (memo, ev) {
@@ -1022,7 +1022,7 @@
10221022
}
10231023
}
10241024

1025-
getDayClass(day,newClass) {
1025+
_getDayClass(day,newClass) {
10261026
var classes = ['day'];
10271027
if (day.month() !== this.current.month()) {
10281028
classes.push('other');
@@ -1039,7 +1039,7 @@
10391039
var mevent = event
10401040
this.dispatchEvent(new CustomEvent('date-select', { detail: { date: d, events: eve } }));
10411041
}
1042-
openDay(el) {
1042+
_openDay(el) {
10431043
var details, arrow;
10441044
var dayNumber = +el.querySelectorAll('.day-number')[0].innerText || +el.querySelectorAll('.day-number')[0].textContent;
10451045
var day = this.current.clone().date(dayNumber);
@@ -1086,7 +1086,7 @@
10861086
return memo;
10871087
}, []);
10881088
this._daySelected(day, todaysEvents);
1089-
this.renderEvents(day, todaysEvents, details);
1089+
this._renderEvents(day, todaysEvents, details);
10901090

10911091
arrow.style.left = el.offsetLeft - el.parentNode.offsetLeft + 27 + 'px';
10921092
}
@@ -1108,7 +1108,7 @@
11081108
var mEv = date;
11091109
this.dispatchEvent(new CustomEvent('event-add', { detail: { date: date } }));
11101110
}
1111-
renderEvents(day, events, ele) {
1111+
_renderEvents(day, events, ele) {
11121112
var self = this;
11131113
//Remove any events in the current details element
11141114
var currentWrapper = ele.querySelector('.events');
@@ -1268,37 +1268,11 @@
12681268
var eve = e.detail.events;
12691269
}
12701270
connectedCallback() {
1271-
/*
1272-
var data= [
1273-
{ eventName: 'Lunch Meeting', calendar: 'Work', color: 'orange',date:'1491322091394' },
1274-
{ eventName: 'Physio Appointment', calendar: 'health', color: 'blue',date:'1499185140000' },
1275-
{ eventName: 'Appointment with Dr. John', calendar: 'health', color: 'blue',date:'1491581940000' },
1276-
{ eventName: 'Public Holiday', calendar: 'holiday', color: 'green',date:'1494173940000' }
1277-
1278-
{ eventName: 'Polymer Interview - Jr. Web Developer', calendar: 'Work', color: 'orange' },
1279-
{ eventName: 'Demo New App to the Board', calendar: 'Work', color: 'orange' },
1280-
{ eventName: 'Dinner w/ Marketing', calendar: 'Work', color: 'orange' },
1281-
{ eventName: 'Game vs Portalnd', calendar: 'Sports', color: 'blue' },
1282-
{ eventName: 'Game vs Houston', calendar: 'Sports', color: 'blue' },
1283-
{ eventName: 'Game vs Denver', calendar: 'Sports', color: 'blue' },
1284-
{ eventName: 'Game vs San Degio', calendar: 'Sports', color: 'blue' },
1285-
{ eventName: 'School Play', calendar: 'Kids', color: 'yellow' },
1286-
{ eventName: 'Parent/Teacher Conference', calendar: 'Kids', color: 'yellow' },
1287-
{ eventName: 'Pick up from Soccer Practice', calendar: 'Kids', color: 'yellow' },
1288-
{ eventName: 'Ice Cream Night', calendar: 'Kids', color: 'yellow' },
1289-
{ eventName: 'Free Tamale Night', calendar: 'Other', color: 'green' },
1290-
{ eventName: 'Bowling Team', calendar: 'Other', color: 'green' },
1291-
{ eventName: 'Teach Kids to Code', calendar: 'Other', color: 'green' },
1292-
{ eventName: 'Startup Weekend', calendar: 'Other', color: 'green' }
1293-
1294-
];*/
1295-
this._drawCalendar();
12961271

1297-
// window.Calendar = Calendar;
1298-
// drawCal(this.$.calendar,this);
1299-
// var el2 = new PfCalendar(this.$.calendar,data);
1300-
// var ele3="aa"
13011272
super.connectedCallback();
1273+
this._drawCalendar();
1274+
1275+
13021276

13031277

13041278
}

0 commit comments

Comments
 (0)