PageSourceSearch

https://www.pertanian.go.id/assets/js/clndr-site.js

js pertanian.go.id collected 2026-09-24 17:12:43 UTC 2,958 bytes, 86 lines download raw bytes

1var calendars = {};
2$(document).ready(function() {
3    if ($('.cal1').length) {
4      calendars = $('.cal1').clndr({
5          currDate: moment().format('YYYY-MM-DD'),
6          events: [],
7          ready: function() {
8            loadCalData(calendars, this.currDate)
9          },
10          clickEvents: {
11              click: function(target) {
12                  if ($(target.element).hasClass('inactive')) {
13                      console.log('not a valid datepicker date.');
14                  } else {
15                      if (target.events.length >= 1) {
16                          var arrEvent = [];
17                          $.each(target.events, function(key, value) {
18                              arrEvent.push(value.title);
19                          });
20                          $('#modal-event-cal-body').html(arrEvent.join('<br/>'));
21                          $('#agenda-date-selected').html(target.date.format('DD-MM-YYYY').toString());
22                          $('#modal-event-cal').modal('show');
23                      }
24                  }
25              },
26              nextMonth: function() {
27                  // console.log('next month.');
28              },
29              previousMonth: function() {
30                  // console.log('previous month.');
31              },
32              onMonthChange: function(month) {
33                  this.currDate = month.format('YYYY-MM-DD');
34                  // console.log('month changed.' + this.currDate);
35                  loadCalData(calendars, this.currDate);
36
37              },
38              nextYear: function() {
39                  // console.log('next year.');
40              },
41              previousYear: function() {
42                  // console.log('previous year.');
43              },
44              onYearChange: function(year) {
45                  this.currDate = year.format('YYYY-MM-DD');                
46                  // console.log('year changed.' + this.currDate);
47                  loadCalData(calendars, this.currDate);
48              }
49          },
50          multiDayEvents: {
51              startDate: 'startDate',
52              endDate: 'endDate'
53          },
54          showAdjacentMonths: true,
55          adjacentDaysChangeMonth: false
56      });
57      
58      $(document).keydown(function(e) {
59          if (e.keyCode == 37) {
60              calendars.back();
61          }
62          if (e.keyCode == 39) {
63              calendars.forward();
64          }
65      });
66    }
67    
68    function loadCalData(objCal, strDate) {
69      let cal = objCal;
70      jQuery.ajax({
71          method: "POST",
72          dataType: "json",
73          url: '/event_api.php',
74          data: {
75            'date' : strDate
76          },
77          success: function(eventArray) {
78            if (eventArray.length)
79              cal.addEvents(eventArray);
80          },
81          error: function(jqXHR, textStatus, errorThrown) {
82              console.log(errorThrown);
83          }
84      });      
85    }
86});

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.