PageSourceSearch

https://creative-culinary.com/wp-content/plugins/wp-recipe-maker-p…/public-feature-unit-conversion.f58d1731.js

js creative-culinary.com collected 2026-09-25 19:05:35 UTC 4,213 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkWPRecipeMakerPublicSplit=self.webpackChunkWPRecipeMakerPublicSplit||[]).push([[864],{9467:(e,t,n)=>{n.r(t);var r,i=n(9707);window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.conversion={init(){document.addEventListener("click",(function(e){const t=!!e.target.closest&&e.target.closest(".wprm-unit-conversion, .wprm-unit-conversion-checkbox");t&&(t.matches(".wprm-unit-conversion")?(e.preventDefault(),WPRecipeMaker.conversion.clickSystem(t)):t.matches(".wprm-unit-conversion-checkbox")&&WPRecipeMaker.conversion.toggleSwitch(t))}),!1),document.addEventListener("change",(function(e){e.target.matches(".wprm-unit-conversion-dropdown")&&WPRecipeMaker.conversion.changeDropdown(e.target)}),!1),document.addEventListener("wprm-recipe-change",(e=>{"unitSystem"===e.detail.type&&window.WPRecipeMaker.manager.getRecipe(e.detail.id).then((e=>{e&&(WPRecipeMaker.conversion.updateSelectors(e),WPRecipeMaker.conversion.updateTemperatures(e),wprmp_public.settings.unit_conversion_enabled&&wprmp_public.settings.unit_conversion_remember&&localStorage.setItem("wprm-unit-system",e.data.currentSystem))}))})),setTimeout((()=>{WPRecipeMaker.conversion.setPreferedUnitSystem()}),100)},setPreferedUnitSystem(){if(wprmp_public.settings.unit_conversion_enabled&&wprmp_public.settings.unit_conversion_remember){let e=localStorage.getItem("wprm-unit-system");if(e&&(e=parseInt(e),!isNaN(e)&&0<e)){const t=window.WPRecipeMaker.manager.findRecipesOnPage();for(let n of t)window.WPRecipeMaker.manager.getRecipe(n).then((t=>{t&&t.data.currentSystem!==e&&t.setUnitSystem(e)}))}}},clickSystem(e){const t=e.dataset.recipe,n=parseInt(e.dataset.system);e.classList.contains("wprmpuc-active")||(window.WPRecipeMaker.hasOwnProperty("analytics")&&window.WPRecipeMaker.analytics.registerActionOnce(t,wprm_public.post_id,"unit-conversion",{type:"link"}),this.setSystem(t,n))},toggleSwitch(e){const t=e.dataset.recipe;let n=e.checked?e.dataset.onSystem:e.dataset.offSystem;n=parseInt(n),window.WPRecipeMaker.hasOwnProperty("analytics")&&window.WPRecipeMaker.analytics.registerActionOnce(t,wprm_public.post_id,"unit-conversion",{type:"switch"}),this.setSystem(t,n)},changeDropdown(e){const t=e.dataset.recipe,n=parseInt(e.value);window.WPRecipeMaker.hasOwnProperty("analytics")&&window.WPRecipeMaker.analytics.registerActionOnce(t,wprm_public.post_id,"unit-conversion",{type:"dropdown"}),this.setSystem(t,n)},setSystem(e,t){window.WPRecipeMaker.manager.getRecipe(e).then((e=>{e&&e.setUnitSystem(t)}))},updateSelectors(e){const t=document.querySelectorAll(".wprm-unit-conversion-container-"+e.id);for(let n of t){const t=n.querySelector(".wprm-unit-conversion-dropdown"),r=n.querySelector(".wprm-unit-conversion-checkbox");if(t)t.value=e.data.currentSystem;else if(r)r.checked=e.data.currentSystem===parseInt(r.dataset.onSystem);else{const t=n.querySelectorAll(".wprm-unit-conversion");for(let n of t){const t=parseInt(n.dataset.system);e.data.currentSystem===t?n.classList.add("wprmpuc-active"):n.classList.remove("wprmpuc-active")}}}},updateTemperatures(e){if("change"===wprmp_public.settings.unit_conversion_temperature){const t=wprmp_public.settings[`unit_conversion_system_${e.data.currentSystem}_temperature`],n=document.querySelectorAll(`#wprm-recipe-container-${e.id}, .wprm-recipe-roundup-item-${e.id}, .wprm-print-recipe-${e.id}, .wprm-recipe-${e.id}-instructions-container`);for(let e of n){const n=e.querySelectorAll(".wprm-temperature-container");for(let e of n){const n=WPRecipeMaker.temperature.getData(e);if((e.dataset.hasOwnProperty("currentUnit")?e.dataset.currentUnit:n.unit)!==t){let r;if(t===n.unit)r=n.value;else{const e=(0,i.L)(n.value);r="C"===t?5*(e-32)/9:9*e/5+32,"round_5"===wprmp_public.settings.unit_conversion_temperature_precision?r=5*Math.round(r/5):"round_10"===w
1prmp_public.settings.unit_conversion_temperature_precision&&(r=10*Math.round(r/10)),r=(0,i.V)(r,0)}e.querySelector(".wprm-temperature-value").innerHTML=r,e.querySelector(".wprm-temperature-unit").innerHTML=` °${t}`,e.dataset.currentUnit=t}}}}}},r=()=>{window.WPRecipeMaker.conversion.init()},"loading"!=document.readyState?r():document.addEventListener("DOMContentLoaded",r)}}]);

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.