1function Calendar(ajaxId, node, initMonth, initYear) { 2 var url; 3 var self = this; 4 this.currentMonth = initMonth; 5 this.currentYear = initYear; 6 node.addEventListener('click', calendarEventHandler, false); 7 8 function calendarEventHandler(event) { 9 var btnClassName = event.target.className; 10 11 if (~btnClassName.indexOf('calendar__button_prev-month')) { 12 if (!(self.currentMonth - 1)) { 13 url = getUrl(12, self.currentYear - 1); 14 self.currentMonth = 12; 15 self.currentYear--; 16 } else { 17 url = getUrl(self.currentMonth - 1, self.currentYear); 18 self.currentMonth--; 19 } 20 updateCalendar(url); 21 } 22 23 if (~btnClassName.indexOf('calendar__button_prev-year')) { 24 url = getUrl(self.currentMonth, self.currentYear - 1); 25 self.currentYear--; 26 updateCalendar(url); 27 } 28 if (~btnClassName.indexOf('calendar__button_next-month')) { 29 if (self.currentMonth == 12) { 30 url = getUrl(1, self.currentYear + 1); 31 self.currentMonth = 1; 32 self.currentYear++; 33 } else { 34 url = getUrl(self.currentMonth + 1, self.currentYear); 35 self.currentMonth++; 36 } 37 updateCalendar(url); 38 } 39 if (~btnClassName.indexOf('calendar__button_next-year')) { 40 url = getUrl(self.currentMonth, self.currentYear + 1); 41 self.currentYear++; 42 updateCalendar(url); 43 } 44 45 var href = event.target.dataset.href || event.target.parentNode.dataset.href; 46 if (href) { 47 location.href = href; 48 } 49 50 } 51 52 function getUrl(month, year) { 53 return location.pathname + '?month=' + month + '&year=' + year + '&bxajaxid=' + ajaxId; 54 } 55 56 function updateCalendar(url) { 57 BX.ajax.insertToNode(url, 'comp_' + ajaxId); 58 } 59 60 return true; 61}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.