1$(function() { 2 var events = {}; 3 var year = new Date().getFullYear(); 4 var monthNum = new Date().getMonth() + 1; 5 var month = monthNum.toString().padStart(2, "0"); 6 $.ajax({ 7 url: "/calendar/?year="+year+"&month="+month+"&api=true", 8 data: { 9 action: 'api', 10 year: year, 11 month: month 12 }, 13 dataType: 'json', 14 success: function(data) { 15 // ãã¼ã¸è¡¨ç¤ºæã®ã«ã¬ã³ãã¼ãã¼ã¿åå¾ 16 events = {}; 17 for(var date in data) { 18 for(var category in data[date]) { 19 if(typeof events[date] == "undefined") { 20 events[date] = {title:''}; 21 } 22 events[date]['title'] += data[date][category]['name'] + "\n"; 23 } 24 } 25 }, 26 complete: function() { 27 var weeklist = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; 28 var option = { 29 week: weeklist, 30 moveTime: 0, 31 }; 32 33 // ã«ã¬ã³ãã¼è¡¨ç¤ºè¨å® 34 $('#calendarView').calendar({ 35 week: weeklist, 36 moveTime: 0, 37 events: events, 38 beforeMove: function(option,y, m) { 39 // æåãæ¿ãæã®åå¦ç â ã«ã¬ã³ãã¼ãã¼ã¿åå¾ 40 // https://rewish.jp/blog/releases/jquery_calendar#addEvent 41 events = {}; 42 $.ajax({ 43 url: "/calendar/?year="+y+"&month="+m+"&api=true", 44 data: { 45 action: 'api', 46 year: y, 47 month: m 48 }, 49 dataType: 'json', 50 async: false, 51 success: function(data) { 52 for(var date in data) { 53 for(var category in data[date]) { 54 if(typeof events[date] == "undefined") { 55 events[date] = {title:''}; 56 } 57 events[date]['title'] += data[date][category]['name'] + "\n"; 58 } 59 } 60 } 61 }); 62 option.events = events; 63 }, 64 afterMove: function(option,y, m) { 65 // æåãæ¿ãæã®å¾å¦ç â ã«ã¬ã³ãã¼ã¯ãªãã¯æã®å¦ç 66 pages(y,m); 67 } 68 }); 69 70 // ãã¼ã¸è¡¨ç¤ºæã®ã«ã¬ã³ãã¼ã¯ãªãã¯æã®å¦çè¨å® 71 pages(year,month); 72 73 $(".todayLink").hide(); 74 }, 75 // ã¨ã©ã¼ç¢ºèªç¨ 76 // error: function(xhr, status, error) { 77 // console.error('AJAX Error:', status, error); 78 // console.error('Response Text:', xhr.responseText); 79 // }, 80 81 }); 82}); 83function pages(y,m) { 84 // ã«ã¬ã³ãã¼ è¦åºãã¯ãªãã¯æã®å¦ç 85 $('#calendar .caption').click(function(){ 86 location.href = "/calendar/?year="+y+"&month="+m; 87 }); 88 // ã«ã¬ã³ãã¼ æ¥ä»é¨åã¯ãªãã¯æã®å¦ç 89 $('#calendar table td.event').click(function(){
90 setLink($(this).attr('id')); 91 }); 92} 93function setLink(val) { 94 val = val.split("-"); 95 location.href = "/calendar/?year="+val[1]+"&month="+val[2]+"#d"+val[3]; 96}
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.