PageSourceSearch

https://neenahfoundry.com/wp-content/themes/starter-theme/assets/js/weir-pdf-export.js?ver=1781319138

js neenahfoundry.com collected 2026-10-10 00:14:52 UTC 9,998 bytes, 1 lines download raw bytes

1!function(){"use strict";const e=["DISCLAIMER: This Flow Capacity Chart for sag conditions is provided for informational purposes only, and all data and results are provided “as is.”","Although Neenah Foundry Company makes reasonable efforts to ensure accuracy, it does not warrant or guarantee the completeness or applicability of the information and assumes no responsibility for errors, omissions, or outcomes resulting from its use.","This tool does not constitute engineering or design advice. Results depend on user-supplied inputs and assumptions, which are not verified by Neenah Foundry. A qualified design professional must review and confirm all information and is solely responsible for determining its suitability for specific project conditions, governing codes, and regulatory requirements.","Neenah Foundry Company is not liable for any direct or indirect damages arising from the use or misuse of this tool.","For sheet flow conditions, refer to the Federal Highway Hydraulic Toolbox."];window.nfcDisclaimerParas=e;let t=null;function n(e,t){return new Promise((n,o)=>{const a=document.createElement("script");a.src=e,t&&(a.integrity=t,a.crossOrigin="anonymous"),a.onload=n,a.onerror=()=>o(new Error("Failed to load "+e)),document.head.appendChild(a)})}function o(){if(t)return t;const{jspdf:e,svg2pdf:o}=window.nfcWeirConfig.pdfLibUrls,a=window.nfcWeirConfig.pdfLibIntegrity||{};return t=n(e,a.jspdf||null).then(()=>n(o,a.svg2pdf||null)),t}const a=new WeakMap;function r(e,t){const n={idle:"Download Flow Capacity Chart (PDF)",loading:"Generating PDF…",success:"PDF Opened in New Tab",error:"PDF generation failed. Try again."},o={idle:"Download Flow Capacity Chart as PDF",loading:"Generating PDF, please wait",success:"PDF opened in new tab. Click to download again.",error:"PDF generation failed. Click to try again."},i=a.get(e);null!=i&&(clearTimeout(i),a.delete(e));const s=e.querySelector(".wfc__export-btn-label");if(s?s.textContent=n[t]||n.idle:e.textContent=n[t]||n.idle,e.setAttribute("aria-busy","loading"===t?"true":"false"),e.setAttribute("aria-label",o[t]||o.idle),"loading"===t?(e.setAttribute("aria-disabled","true"),e.style.pointerEvents="none"):(e.removeAttribute("aria-disabled"),e.style.pointerEvents=""),e.disabled=!1,e.classList.remove("wfc__export-btn--loading","wfc__export-btn--success","wfc__export-btn--error"),"idle"!==t&&e.classList.add("wfc__export-btn--"+t),"success"===t){const t=setTimeout(()=>{r(e,"idle")},2500);a.set(e,t)}}function i(e){const t=function(){let e=document.getElementById("nf-a11y-announce");return e||(e=document.createElement("div"),e.id="nf-a11y-announce",e.setAttribute("aria-live","polite"),e.className="screen-reader-text",document.body.appendChild(e)),e}();t.textContent="",requestAnimationFrame(()=>{t.textContent=e})}let s=null,c=null;function d(e){const t=s||(s=function(){const e=document.createElement("div");return e.className="wfc__toast",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),document.body.appendChild(e),e}());c&&(clearTimeout(c),c=null),t.textContent=e,t.classList.add("wfc__toast--visible"),c=setTimeout(()=>{t.classList.remove("wfc__toast--visible"),c=null},6e3)}function l(e,t,n){return new Promise(o=>{const a=new Image;a.crossOrigin="anonymous",a.onload=()=>{const e=a.naturalWidth/a.naturalHeight;let r,i;e>t/n?(r=t,i=t/e):(i=n,r=n*e);const s=document.createElement("canvas");s.width=2*r,s.height=2*i;const c=s.getContext("2d");c.scale(2,2),c.drawImage(a,0,0,r,i);try{o(s.toDataURL("image/png"))}catch{o(null)}},a.onerror=()=>o(null),a.src=e})}async function u(){"scheduler"in window&&"function"==typeof window.scheduler.yield?await window.scheduler.yield():await new Promise(e=>setTimeout(e,0))}async function f(t,n){const o=await async function(e){if(e._wfcInstance){const t=1e4,n=100,o=Date.now()+t;for(;Date.now()<o;){const t=e._wfcInstance.exportSVG();if(t)return t;await new Promise(e=>setTimeout(e,n))}throw new Error("Chart did not finish rendering within 10 s.")}if(!window.NFC||!window.NFC.WeirFlowChart)throw new Error("WeirFlowChart class not available on window.NFC");const t="wfc-pdf-offscreen-"+Date.now(),n=document.createElement("div");n.id=t,n.style.cssText="position:absolute;
1left:-9999px;top:0;width:800px;height:480px;overflow:hidden;visibility:hidden;",document.body.appendChild(n);try{const e=new window.NFC.WeirFlowChart(t);await e.render();const n=e.exportSVG();if(!n)throw new Error("exportSVG() returned null after off-screen render");return n}finally{n.remove()}}(t);if(!o)throw new Error("Could not acquire chart SVG for PDF generation.");o.style.cssText="position:absolute;left:-9999px;top:0;",document.body.appendChild(o);const a=40,r=12,s=792,c=Math.round(124.74576271186442),f=Math.round(89.76271186440678),w=(window.nfcWeirConfig.themeUrl||"").replace(/\/$/,""),p=w?w+"/assets/img/CPF-Infrastructure.png":null,m=w?w+"/assets/img/logo-NeenahFoundry.svg":null,[g,h]=await Promise.all([p?l(p,c,a):Promise.resolve(null),m?l(m,f,a):Promise.resolve(null)]),{jsPDF:y}=window.jspdf,C=new y({orientation:"landscape",unit:"pt",format:"letter"});if(C.setFillColor(255,255,255),C.rect(0,0,s,60,"F"),g&&C.addImage(g,"PNG",r,10,c,a),h){const e=r+c+10;C.addImage(h,"PNG",e,10,f,a)}C.setFont("helvetica","bold"),C.setFontSize(16),C.setTextColor(4,30,66),C.text("Flow Capacity Chart",396,36,{align:"center"});const v=String(n&&n.catalog||window.nfcWeirConfig.catalogNumber||""),b=String(n&&n.grate||window.nfcWeirConfig.grateType||"");if(v||b){const e=8,t=Math.round(1.2*e),n=780,o=10+t;C.setFont("helvetica","normal"),C.setTextColor(4,30,66),v&&(C.setFontSize(t),C.text(v,n,o,{align:"right"})),b&&(C.setFontSize(e),C.text("Grate Type: "+((F=b)?1===F.length?F.toUpperCase():F.charAt(0).toUpperCase()+F.slice(1).toLowerCase():F),n,o+e+2,{align:"right"}))}var F;await u();try{await window.svg2pdf.svg2pdf(o,C,{x:0,y:60,width:s,height:472})}finally{o.parentNode&&document.body.removeChild(o)}await u();const E=532;C.setFillColor(255,255,255),C.rect(0,E,s,80,"F"),C.setDrawColor(180,180,180),C.setLineWidth(.5),C.line(r,E,780,E),C.setFont("helvetica","normal"),C.setFontSize(5.5),C.setTextColor(90,90,90);let x=540;for(const t of e){const e=C.splitTextToSize(t,633.6);C.text(e,r,x),x+=7.975*e.length+2}const S=new Date,P=S.getFullYear().toString()+String(S.getMonth()+1).padStart(2,"0")+String(S.getDate()).padStart(2,"0")+"-"+String(S.getHours()).padStart(2,"0")+String(S.getMinutes()).padStart(2,"0"),D=b||"unknown",_="CPFI-NFC_FlowCapacityChart_"+(v||"unknown").toUpperCase()+"-GRATE"+D.toUpperCase()+"_"+P+".PDF";C.save(_),i("PDF download started. Check your downloads folder."),function(){const e=navigator.userAgent;return(/iPad|iPhone|iPod/.test(e)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&/Safari/.test(e)&&!/Chrome|CriOS|FxiOS/.test(e)}()&&d("Tap the share icon (↑) → Save to Files to keep your PDF.")}async function w(e){e.preventDefault();const t=this;if(t.dataset.pdfBusy)return;const n=t.dataset.chartId?document.getElementById(t.dataset.chartId):t.closest(".wfc-section__chart-wrapper");if(n){if(window.innerWidth<=768&&!sessionStorage.getItem("wfc-pdf-warned")){const e=await(a=t,new Promise(e=>{const t=document.querySelector(".wfc__bandwidth-warning");t&&t.remove();const n=document.createElement("div");n.className="wfc__bandwidth-warning",n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby","wfc-bw-title");const o=document.createElement("p");o.id="wfc-bw-title",o.textContent="Generating PDF loads ≈200 KB of scripts.";const r=document.createElement("button");r.className="wfc__bw-confirm",r.textContent="Generate PDF",r.type="button";const i=document.createElement("button");i.className="wfc__bw-cancel",i.textContent="Cancel",i.type="button",n.appendChild(o),n.appendChild(r),n.appendChild(i),document.body.appendChild(n);const s=Array.from(document.body.children).filter(e=>e!==n);function c(t){s.forEach(e=>e.removeAttribute("inert")),n.remove(),a.focus(),e(t)}s.forEach(e=>e.setAttribute("inert","")),r.focus(),r.addEventListener("click",()=>{sessionStorage.setItem("wfc-pdf-warned","1"),c(!0)}),i.addEventListener("click",()=>c(!1)),n.addEventListener("keydown",e=>{if("Escape"===e.key)return e.preventDefault(),void c(!1);if("Tab"===e.key){const t=[r,i],n=t[0],o=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),o.focus()):e.shiftKey||document.activeElement!==o||(e.preventDefault(),n.focus())}})}));if(!e)return}var a;t.dataset.pdfBusy="1",r(t,"loading");try{await o(),await f(n),r(t,"success")}catch(e){console.error("[weir-pdf-export] PDF generation failed:",e),r(t,"error"),i("PDF generation failed. Please try again."),t.focu
1s()}finally{delete t.dataset.pdfBusy}}}function p(){document.querySelectorAll(".wfc__export-btn").forEach(e=>{e.dataset.pdfInitialised||(e.dataset.pdfInitialised="1",e.addEventListener("click",w),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),w.call(e,t))}))})}document.addEventListener("nfc:flow-capacity:download",async function(e){const t=e&&e.detail?e.detail:{},n=t.productId,a=t.catalog||"",r=t.grateSlug||"";if(!n)return;const i="nfc-fc-dl-busy-"+n;if(!sessionStorage.getItem(i)){sessionStorage.setItem(i,"1");try{const e=document.getElementById("chart-area-"+n);if(!e)throw new Error("chart-area not found for product "+n);const t=e.querySelector(".chart-canvas svg");if(!t)throw new Error("SVG not yet rendered for product "+n);const i={_wfcInstance:{exportSVG:function(){return t.cloneNode(!0)}}};await o(),await f(i,{catalog:a,grate:r}),document.dispatchEvent(new CustomEvent("nfc:flow-capacity:download-complete",{detail:{productId:n}}))}catch(e){console.error("[weir-pdf-export] Flow capacity PDF failed:",e),document.dispatchEvent(new CustomEvent("nfc:flow-capacity:download-complete",{detail:{productId:n,error:!0}}))}finally{sessionStorage.removeItem(i)}}}),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",p):p()}();

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.