1var $ = jQuery.noConflict(); 2 3function formatDate(date) { 4 var d = new Date(date), 5 month = "" + (d.getMonth() + 1), 6 day = "" + d.getDate(), 7 year = d.getFullYear(); 8 9 if (month.length < 2) month = "0" + month; 10 if (day.length < 2) day = "0" + day; 11 12 return [year, month, day].join("-"); 13} 14 15$(function () { 16 var boxABC = $("#calendar").data('click-mode'); 17 18 var box2; 19 $("#calendar").fullCalendar({ 20 header: { 21 left: "prev,next today", 22 center: "title", 23 right: "month,agendaWeek,agendaDay", 24 }, 25 loading: function (bool) { 26 if (bool) 27 box2 = new ajaxLoader($("#calendar"), { classOveride: "blue-loader" }); 28 else if (box2) box2.remove(); 29 }, 30 editable: true, 31 firstDay: 1, 32 minTime: "08:00", 33 maxTime: "21:00", 34 defaultView: "agendaWeek", 35 allDaySlot: true, 36 eventLimit: false, // allow "more" link when too many events 37 // events: function (start, end, timezone, callback) { 38 // fetchCalendarEvents(function (eventsData) { 39 // // callback(JSON.parse(eventsData)); 40 // }); 41 // }, 42 events: { 43 url: ajaxurl, 44 method: "POST", 45 data: { 46 action: "custom_calendar_ajax" 47 }, 48 success: function (data) { 49 // Handle the response data (events) here 50 //console.log(data); 51 }, 52 }, 53 eventRender: function (event, element) { 54 // element.find('.fc-title').html(event.message); 55 // var check = formatDate(event.end); 56 // var today = formatDate(new Date()); 57 // if (check < today) { 58 // Previous Day. show message if you want otherwise do nothing. 59 // So it will be unselectable 60 //element.css("background-color", "rgba(124, 124, 124, 1)"); 61 // element.css("border-color", "rgba(124, 124, 124)"); 62 // } 63 }, 64 eventClick: function (event) { 65 if (boxABC == "a") { 66 return false; 67 } else if (boxABC == "b") { 68 if (event.url) { 69 window.open(event.url, "_blank"); 70 return false; 71 } 72 } 73 }, 74 eventMouseover: function (data, event, view) { 75 tooltip = 76 '<div class="tooltiptopicevent" style="width:300px;height:auto;background:#e6e6e6;position:absolute;z-index:10001;padding:10px 10px 10px 10px ; font-size:18px; line-height: 150%;">' + 77 data.title + 78 "</div>"; 79 $("body").append(tooltip); 80 $(this) 81 .mouseover(function (e) { 82 $(this).css("z-index", 10000); 83 $(".tooltiptopicevent").fadeIn("500"); 84 $(".tooltiptopicevent").fadeTo("10", 1.9); 85 }) 86 .mousemove(function (e) { 87 $(".tooltiptopicevent").css("top", e.pageY + 10); 88 $(".tooltiptopicevent").css("left", e.pageX - 350); 89 }); 90 }, 91 eventMouseout: function (data, event, view) { 92 $(this).css("z-index", 8); 93 $(".tooltiptopicevent").remove(); 94 }, 95 }); 96 97 function fetchCalendarEvents(callback) { 98 $.ajax({ 99 url: adminurl, 100 type: "POST", 101 data: { 102 action: "custom_calendar_ajax", 103 }, 104 success: function (response) { 105 //console.info(response); 106 if (callback && typeof callback === "function") { 107 callback(response); 108 } 109 }, 110 error: function (error) { 111 console.error("Error fetching calendar events: " + error.statusText); 112 }, 113 }); 114 } 115}); 116$(document).ready(function () { 117 118 $('#reloadCalendar').click(function (e) { 119 console.log('reload'); 120 e.preventDefault(); 121 var calendar = $('#calendar').fullCalendar(); 122 // To refetch events and refresh the calendar 123 calendar.fullCalendar('refetchEvents'); 124 }); 125 126 $("#datepicker_calendar").datepicker({ 127 inline: true, 128 dateFormat: "yy-mm-dd", 129 firstDay: 1, 130 changeMonth: true, 131 changeYear: true, 132 onSelect: function (dateText, inst) { 133 // console.log("calendar event"); 134 var d = new Date(dateText); 135 $('#calendar').fullCalendar('gotoDate', d); 136 }, 137 }); 138 139}); 140 141function getQueryString(val) { 142 var uri = window.location.search; 143 var re = new RegExp("" + val + "=([^&?]*)", "ig"); 144 if (uri.match(re)) { 145 return uri.match(re)[0].substr(val.length + 1); 146 } else { 147 return "0"; 148 } 149} 150 151/* 152 * Ajax overlay 1.0 153 * Author: Simon Ilett @ aplusdesign.com.au 154 * Descrip: Creates and inserts an ajax loader for ajax calls / timed events 155 * Date: 03/08/2011 156 */ 157function ajaxLoader(el, options) { 158 // Becomes this.options 159 var defaults = { 160 bgColor: "#fff",
161 duration: 800, 162 opacity: 0.7, 163 classOveride: false, 164 }; 165 this.options = jQuery.extend(defaults, options); 166 this.container = $(el); 167 168 this.init = function () { 169 var container = this.container; 170 // Delete any other loaders 171 this.remove(); 172 // Create the overlay 173 var overlay = $("<div></div>") 174 .css({ 175 "background-color": this.options.bgColor, 176 opacity: this.options.opacity, 177 width: "100%", 178 height: container.height(), 179 position: "absolute", 180 top: "0px", 181 left: "0px", 182 "z-index": 99999, 183 }) 184 .addClass("ajax_overlay"); 185 // add an overiding class name to set new loader style 186 if (this.options.classOveride) { 187 overlay.addClass(this.options.classOveride); 188 } 189 // insert overlay and loader into DOM 190 container.append( 191 overlay 192 .append($("<div></div>").addClass("ajax_loader")) 193 .fadeIn(this.options.duration) 194 ); 195 }; 196 197 this.remove = function () { 198 var overlay = this.container.children(".ajax_overlay"); 199 if (overlay.length) { 200 overlay.fadeOut(this.options.classOveride, function () { 201 overlay.remove(); 202 }); 203 } 204 }; 205 206 this.init(); 207}
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.