PageSourceSearch

https://tiki.org/public/generated/js/jquery-tiki/eventcalendar_to_pdf.js

js tiki.org collected 2026-10-02 03:28:09 UTC 1,665 bytes, 2 lines download raw bytes

1import{jsPDF as N}from"common-reexported/jspdf";import S from"html2canvas-pro";$.fn.addEventCalendarPrint=function(h,z){let u=$(this);var c="#"+$(this).attr("id");if(!u){console.warn(c+" not found");return}u.append($(h)),$(h).show(),$(h).off("click"),$(h).on("click",function(R){R.preventDefault();var p=$(c+" .ec");$("html, body").animate({scrollTop:0},0),setTimeout(function(){S(p[0],{scrollY:0,scrollX:0}).then(function(t){var w=$(c+" .ec-title").text().trim(),D=t.toDataURL("image/jpeg",1),n=180,g=250,l=t.height*n/t.width,x=l,a=new N("p","mm");a.setFontSize(14);const d=210;if(a.text((d-n)/2,20,w.replace(/\s+/g," ")),jqueryTiki.calendar_pdf_export_layout==="fit_to_width"){let Y=function(e){let o=e;for(let i=0;i<m.length;i++)if(m[i].top<e&&m[i].bottom>e){o=m[i].top;break}return o};var b=30,_=20,P=10;const H=297,j=H-b-P,k=t.width/n,y=j*k,E=d-_,F=H-P,T=$(c+" .ec-days"),v=p[0].getBoundingClientRect(),C=[];T.each(function(){const e=this.getBoundingClientRect();C.push({top:e.top-v.top,bottom:e.bottom-v.top})});const M=t.height/p[0].scrollHeight,m=C.map(e=>({top:e.top*M,bottom:e.bottom*M}));let r=0,f=1;for(;r<t.height;){let e=r+y,o=Y(e);o<=r&&(o=Math.min(e,t.height)),o=Math.min(o,t.height);const i=Math.max(0,o-r);if(i<=1)break;const s=document.createElement("canvas");s.width=t.width,s.height=i,s.getContext("2d").drawImage(t,0,r,t.width,i,0,0,t.width,i);const B=s.toDataURL("image/jpeg",1),L=i/k;f>1&&a.addPage(),a.addImage(B,"JPEG",(d-n)/2,b,n,L),a.setFontSize(7),a.text("Page "+f,E,F),f++,r=o}}else l>g&&(l=g,n=t.width*l/t.height),a.addImage(D,"JPEG",(d-n)/2,30,n,x>g?g:x);a.save(w+".pdf")})},200)})};
2//# sourceMappingURL=eventcalendar_to_pdf.js.map

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.