1/* 2JavaScript for Zap Calendar 3*/ 4 5var initZArray = []; 6function initZ(viewid){ 7 if(initZArray.indexOf(viewid)>= 0) 8 return; 9 initZArray.push(viewid); 10 refreshZ(viewid); 11} 12 13function refreshZ(viewid){ 14 jQuery.noConflict(); 15 cleanPopup(); 16 refreshTips(viewid); 17 refreshPopovers(viewid); 18 refreshPropagation(); 19 runPluginJS(); 20} 21 22function refreshPropagation() 23{ 24 jQuery(document).ready(function() { 25 jQuery(".stop-bubble-up").each(function() { 26 jQuery(this).click(function(e) { 27 e.stopPropagation(); 28 }); 29 }); 30 }); 31} 32 33function refreshTips(viewid){ 34 jQuery(document).ready(function() { 35 jQuery('.hasTooltip'+viewid).tooltip({"html": true,"container": "body"}); 36 }); 37} 38 39function refreshPopovers(viewid){ 40 jQuery(document).ready(function() { 41 jQuery('[data-toggle="popover"]').popover() 42 }); 43} 44 45// jQuery version 46function runPluginJS(){ 47jQuery(document).ready(function() { 48 jQuery(".zplugin").each(function(){ 49 var pfunction = new Function(jQuery(this).attr("title")); 50 pfunction(); 51 }); 52}); 53} 54 55/* 56// old MooTools version (switched to jQuery) 57function runPluginJS(){ 58window.addEvent('domready', function() { 59 $$(".zplugin").each(function(el){ 60 var pfunction = new Function(el.title); 61 pfunction(); 62 }); 63}); 64} 65*/ 66 67 68// this cleans up the popup box that may not have received mouseout event in ajax view 69function cleanPopup(){ 70 jQuery(".tooltip").remove(); 71} 72 73function padZeros(num,count) 74{ 75 var tnum = num + ''; 76 while(tnum.length < count) 77 tnum = "0" + tnum; 78 return tnum; 79} 80 81function get(name,s){ 82 s = (s) ? s : window.location.search; 83 if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(s)) 84 return decodeURIComponent(name[1]); 85} 86 87function setGridView(viewid, mode){ 88 calview = document.getElementById("calview_" + viewid); 89 if(calview){ 90 calview.value = mode; 91 } 92} 93 94function setDisplayMode(viewid, mode){ 95 caldisplay = document.getElementById("caldisplay_" + viewid); 96 if(caldisplay){ 97 caldisplay.value = mode; 98 } 99} 100 101function setCalendarState(viewid){ 102 elem = document.getElementById('zc_cal_cal_' + viewid); 103 if(elem != null){ 104 state = readCookie("zc_calendar_"+viewid); 105 if(state != null){ 106 elem.style.display = state; 107 } 108 } 109} 110 111function toggleCalendar(viewid){ 112 elem = document.getElementById('zc_cal_cal_' + viewid); 113 if(elem != null){ 114 if(elem.style.display != "none") { 115 elem.style.display = "none"; 116 createCookie("zc_calendar_"+viewid,"none"); 117 } 118 else { 119 elem.style.display = "inherit"; 120 createCookie("zc_calendar_"+viewid,"inherit"); 121 } 122 } 123} 124 125 126function createCookie(name,value,hours) { 127 if(!hours) 128 hours = 24; 129 var date = new Date(); 130 date.setTime(date.getTime()+(hours*60*60*1000)); 131 var expires = "; expires="+date.toGMTString(); 132 document.cookie = name+"="+value+expires+"; path=/"; 133} 134 135function deleteCookie(name){ 136 createCookie(name,"",-1); 137} 138 139function readCookie(name) { 140 var nameEQ = name + "="; 141 var ca = document.cookie.split(';'); 142 for(var i=0;i < ca.length;i++) { 143 var c = ca[i]; 144 while (c.charAt(0)==' ') c = c.substring(1,c.length); 145 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 146 } 147 return null; 148} 149 150function addMonth(dateobj,addmonth){ 151 newmonth = dateobj.getMonth() + addmonth; 152 addyear = 0; 153 if(newmonth > 11){ 154 addyear = Math.floor(newmonth / 12); 155 newmonth = newmonth % 12; 156 } 157 dateobj.setMonth(newmonth); 158 dateobj.setFullYear(dateobj.getFullYear() + addyear); 159 return dateobj; 160} 161 162function refreshCalendar(calid){ 163 refreshurl=document.getElementById("zc_refreshurl_" + calid); 164 if(refreshurl) { 165 url = refreshurl.value; 166 if(url == "") 167 { 168 url = "/index.php?option=com_zcalendar&view=calendar&id=" + calid + "&ajax=1&format=raw"; 169 } 170 zloadURL(calid,url); 171 } 172} 173 174function zloadURL(calid,url) 175{ 176 cleanPopup(); 177 urlhttp=null; 178 // code for Mozilla, etc. 179 if (window.XMLHttpRequest) 180 { 181 urlhttp=new XMLHttpRequest(); 182 } 183 // code for IE 184 else if (window.ActiveXObject) 185 { 186 urlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 187 } 188 if (urlhttp!=null) 189 { 190 jQuery("#zc_calajax_"+calid).addClass("zc_wait"); 191 refresh=document.getElementById("zc_refreshurl_" + calid); 192 if(refresh) 193 refresh.value = url; 194 urlhttp.onreadystatechange=function() { 195 // only if req shows "complete" 196 if (urlhttp.readyState == 4) { 197 // only if "OK" 198 if (urlhttp.status == 200) { 199 jQuery("#zc_calajax_" + calid).removeClass("zc_wait"); 200 jQuery("#zc_calajax_" + calid).html(urlhttp.responseText); 201 setCalendarState(calid); 202 refreshZ(calid); 203 } 204 } 205 } 206 urlhttp.open("GET",url,true); 207 urlhttp.send(null); 208 } 209} 210
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.