PageSourceSearch

https://www.tritanbp.co.uk/cdn/shop/t/30/assets/uk-measure.js?v=123454608118436163021790786605

js tritanbp.co.uk collected 2026-10-09 22:01:35 UTC 3,859 bytes, 2 lines download raw bytes

1(function(global){"use strict";var MM={mm:1,cm:10,m:1e3,in:25.4,ft:304.8},UNITS=["m","cm","mm","in","ft"],LEGACY_UNITS={ftin:"ft"},STORE_KEY="uk:measure:unit",DEFAULT_UNIT="m",M={};M.UNITS=UNITS,M.MM_PER=MM,M.parse=function(raw,unit){if(raw==null)return null;var s=String(raw).trim().toLowerCase();if(!s)return null;s=s.replace(/,/g,".").replace(/′/g,"'").replace(/″|”|’’/g,'"');var ftin=s.match(/^(-?\d+(?:\.\d+)?)\s*(?:'|ft|feet|foot)\s*(\d+(?:\.\d+)?)?\s*(?:"|in|inch|inches)?$/);if(ftin){var ft=parseFloat(ftin[1]),inch=ftin[2]?parseFloat(ftin[2]):0;return!isFinite(ft)||!isFinite(inch)?null:Math.round(ft*MM.ft+inch*MM.in)}var withUnit=s.match(/^(-?\d+(?:\.\d+)?)\s*(mm|millimetres?|millimeters?|cm|centimetres?|centimeters?|m|metres?|meters?|in|inch|inches|"|ft|feet|foot|')$/);if(withUnit){var n=parseFloat(withUnit[1]);if(!isFinite(n))return null;var u=withUnit[2],per=/^(mm|milli)/.test(u)?MM.mm:/^(cm|centi)/.test(u)?MM.cm:/^(m|metre|meter)/.test(u)?MM.m:/^(in|inch|")/.test(u)?MM.in:MM.ft;return Math.round(n*per)}var bare=s.match(/^(-?\d+(?:\.\d+)?)$/);if(bare){var v=parseFloat(bare[1]);if(!isFinite(v))return null;var mmPer=MM[M.normUnit(unit)]||MM.m;return Math.round(v*mmPer)}return null},M.parseFeetInches=function(feet,inches){var f=parseFloat(String(feet==null?"":feet).trim()),i=parseFloat(String(inches==null?"":inches).trim());return isFinite(f)||(f=0),isFinite(i)||(i=0),!f&&!i?null:Math.round(f*MM.ft+i*MM.in)};var round=function(n,dp){var f=Math.pow(10,dp);return(Math.round(n*f)/f).toFixed(dp)};M.format=function(mm,unit,opts){if(mm==null||!isFinite(mm))return"";var o=opts||{};switch(unit){case"mm":return round(mm,0)+(o.bare?"":" mm");case"cm":return round(mm/MM.cm,0)+(o.bare?"":" cm");case"in":return round(mm/MM.in,1)+(o.bare?"":" in");case"ft":return round(mm/MM.ft,1)+(o.bare?"":" ft");case"ftin":{var totalIn=mm/MM.in,ft=Math.floor(totalIn/12),inch=Math.round((totalIn-ft*12)*10)/10;inch>=12&&(ft+=1,inch-=12);var inchTxt=Math.round(inch*10)%10===0?String(Math.round(inch)):String(round(inch,1));return ft+"' "+inchTxt+'"'}default:return round(mm/MM.m,2)+(o.bare?"":" m")}},M.formatForInput=function(mm,unit){return mm==null?"":unit==="ftin"?M.format(mm,"ftin"):M.format(mm,unit,{bare:!0}).replace(/\.0+$|(\.\d*?)0+$/,"$1")},M.toFeetInches=function(mm){var totalIn=mm/MM.in,ft=Math.floor(totalIn/12),inch=Math.round((totalIn-ft*12)*10)/10;return inch>=12&&(ft+=1,inch-=12),{feet:ft,inches:inch}},M.isUnit=function(u){return UNITS.indexOf(u)!==-1},M.normUnit=function(u){return LEGACY_UNITS[u]?LEGACY_UNITS[u]:M.isUnit(u)?u:DEFAULT_UNIT},M.getUnit=function(){try{var u=global.localStorage&&global.localStorage.getItem(STORE_KEY);if(u&&LEGACY_UNITS[u])return LEGACY_UNITS[u];if(u&&M.isUnit(u))return u}catch(e){}return DEFAULT_UNIT},M.setUnit=function(u){if(LEGACY_UNITS[u]&&(u=LEGACY_UNITS[u]),!M.isUnit(u))return M.getUnit();try{global.localStorage&&global.localStorage.setItem(STORE_KEY,u)}catch(e){}try{global.dispatchEvent(new CustomEvent("uk:unitchange",{detail:{unit:u}}))}catch(e){var ev=document.createEvent("CustomEvent");ev.initCustomEvent("uk:unitchange",!1,!1,{unit:u}),global.dispatchEvent(ev)}return u},M.onUnitChange=function(fn){var h=function(e){fn(e&&e.detail&&e.detail.unit||M.getUnit())};return global.addEventListener("uk:unitchange",h),function(){global.removeEventListener("uk:unitchange",h)}},M.unitLabel=function(u){return{m:"m",cm:"cm",mm:"mm",in:"in",ft:"ft",ftin:"ft"}[u]||u},M.areaM2=function(wMm,hMm){return wMm/MM.m*(hMm/MM.m)},M.panelsFor=function(wMm,hMm,coverageM2,wastePct){if(!(coverageM2>0))return 0;var waste=1+(wastePct||0)/100;return Math.ceil(M.areaM2(wMm,hMm)/coverageM2*waste)},global.UKMeasure=M,global.UK&&(global.UK.measure=M)})(typeof window!="undefined"?window:globalThis);
2//# sourceMappingURL=/cdn/shop/t/30/assets/uk-measure.js.map?v=123454608118436163021790786605

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.