PageSourceSearch

https://www.upstateramblings.com/wp-content/plugins/wp-recipe-make…ublic-feature-add-to-collection.e447db5d.js

js upstateramblings.com collected 2026-10-04 00:19:14 UTC 8,780 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkWPRecipeMakerPublicSplit=self.webpackChunkWPRecipeMakerPublicSplit||[]).push([[1],{7404:(e,o,t)=>{t.r(o),t.d(o,{default:()=>n});var c=t(4181),i=t(942);const l={checkInbox:e=>{const o=localStorage.getItem("wprm-recipe-collection");if(o){JSON.parse(o).inbox.items["0-0"].filter((o=>o.recipeId===e)).length>0&&l.updateButtons(e)}},updateButtons:e=>{const o=document.querySelectorAll(".wprm-recipe-add-to-collection");for(let t of o)e===parseInt(t.dataset.recipeId)&&(t.classList.contains("wprm-recipe-not-in-collection")?t.style.display="none":t.classList.contains("wprm-recipe-in-collection")&&(t.style.display=""))}},n=l;var r;window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.collections={init(){if(0===parseInt(wprmp_public.user)){const e=document.querySelectorAll(".wprm-recipe-add-to-collection-recipe.wprm-recipe-not-in-collection");for(let o of e){const e=parseInt(o.dataset.recipeId);l.checkInbox(e)}if("choose"===wprmp_public.add_to_collection.behaviour){const e=localStorage.getItem("wprm-recipe-collection");if(e){const o=JSON.parse(e);wprmp_public.add_to_collection.collections.user=o.user}}}if(document.addEventListener("click",(function(e){const o=!!e.target.closest&&e.target.closest(".wprm-recipe-add-to-collection.wprm-recipe-not-in-collection");o&&window.WPRecipeMaker.collections.onClick(o,e)}),!1),"logged_in"===wprmp_public.add_to_collection.access&&0===parseInt(wprmp_public.user)&&wprmp_public.add_to_collection.not_logged_in_tooltip){const e=document.querySelectorAll(".wprm-recipe-add-to-collection");for(let o of e)(0,c.Ay)(o,{theme:"wprm",content:wprmp_public.add_to_collection.not_logged_in_tooltip})}},onClick(e,o){if(o.preventDefault(),"logged_in"===wprmp_public.add_to_collection.access&&0===parseInt(wprmp_public.user)){if("redirect"===wprmp_public.add_to_collection.not_logged_in){const o=wprmp_public.add_to_collection.not_logged_in_redirect;if(o)if(e.classList.contains("wprm-recipe-add-to-collection-grid"))window.location=o;else{const t=parseInt(e.dataset.recipeId),c=WPRecipeMaker.collections.getRecipeServings(t);window.WPRecipeMaker.manager.getRecipe(t).then((e=>{if(e){let o={timestamp:Date.now(),recipe:e.data.collection,servings:c,collection:"inbox"};localStorage.setItem("wprm-added-to-collection-before-login",JSON.stringify(o))}window.location=o}))}}}else e.classList.contains("wprm-recipe-add-to-collection-grid")?WPRecipeMaker.collections.onClickGrid(e):WPRecipeMaker.collections.onClickRecipe(e)},onClickGrid(e){const o=e.dataset.gridId;if(window.hasOwnProperty("WPUPG_Grids")&&window.WPUPG_Grids.hasOwnProperty(`wpupg-grid-${o}`)){const t=WPUPG_Grids[`wpupg-grid-${o}`];if(t){const o=t.isotope.getFilteredItemElements();let c=[];for(let e of o)e.classList.contains("wpupg-type-wprm_recipe")&&c.push({id:parseInt(e.dataset.id)});0<c.length&&("choose"===wprmp_public.add_to_collection.behaviour?WPRecipeMaker.collections.showCollectionPicker(e,(o=>{WPRecipeMaker.collections.addRecipesToCollection(e,c,o)})):WPRecipeMaker.collections.addRecipesToCollection(e,c,{id:"inbox"}))}}},onClickRecipe(e){const o=parseInt(e.dataset.recipeId),t=[{id:o,servings:WPRecipeMaker.collections.getRecipeServings(o)}];"choose"===wprmp_public.add_to_collection.behaviour?WPRecipeMaker.collections.showCollectionPicker(e,(o=>{WPRecipeMaker.collections.addRecipesToCollection(e,t,o)})):WPRecipeMaker.collections.addRecipesToCollection(e,t,{id:"inbox"})},getRecipeServings(e){const o=document.querySelectorAll(".wprm-recipe-servings-"+e);let t=0<o.length&&o[0].dataset.servings;return isNaN(t)&&(t=!1),t},currentTooltip:!1,showCollectionPicker(e,o){if(e.hasOwnProperty("_tippy")){const o=e._tippy.state.isShown;if(e._tippy.destroy(),o)return}(0,c.Ay)(e,{theme:"wprm",trigger:"click",showOnCreate:!0,allowHTML:!0,interactive:!0,content(e){window.WPRecipeMaker.collections.currentTooltip={ref:e,callback:o,collection:"",column:"",group:""};let t='<div class="wprm-add-to-collection-tooltip-container">';t+='<select class="wprm-add-to-collection-tooltip" id="wprm-add-to-collection-tooltip-collection" onchange="window.WPRecipeMaker.collections.selectCollection( this )">',t+='<option value="">'+(0,i.f)("Select a collection")+"</option>",t+='<option value="inbox">'+wprmp_public.add_to_collection.collections.inbox+"</option>";for(let o of wprmp_public.add_to_collection.collections.user)t+='<option value="user-'+o.id+'">'+o.name+"</option>";return t+="</select>","choose_column"!==wprmp_public.add_to_collection.choice&&"choose_column_group"!==wprmp_public.add_to_collection.choice||(t+='<select class="wprm-ad
1d-to-collection-tooltip" id="wprm-add-to-collection-tooltip-column" onchange="window.WPRecipeMaker.collections.selectColumn( this )" disabled="disabled">',t+='<option value="">'+(0,i.f)("Select a column")+"</option>",t+="</select>"),"choose_column_group"===wprmp_public.add_to_collection.choice&&(t+='<select class="wprm-add-to-collection-tooltip" id="wprm-add-to-collection-tooltip-group" onchange="window.WPRecipeMaker.collections.selectGroup( this )" disabled="disabled">',t+='<option value="">'+(0,i.f)("Select a group")+"</option>",t+="</select>"),t+="</div>",t},onShown(e){e.popper.addEventListener("click",(function(e){e.stopPropagation(),e.preventDefault()}),!1)}})},selectCollection(e){const o=e.value;window.WPRecipeMaker.collections.currentTooltip.collection=o,window.WPRecipeMaker.collections.currentTooltip.column="",window.WPRecipeMaker.collections.currentTooltip.group="","inbox"===o?window.WPRecipeMaker.collections.madeTooltipSelection():window.WPRecipeMaker.collections.updateDropdowns()},selectColumn(e){const o=e.value;window.WPRecipeMaker.collections.currentTooltip.column=o,window.WPRecipeMaker.collections.currentTooltip.group="",window.WPRecipeMaker.collections.updateDropdowns()},selectGroup(e){const o=e.value;window.WPRecipeMaker.collections.currentTooltip.group=o,window.WPRecipeMaker.collections.madeTooltipSelection()},updateDropdowns(){const e=window.WPRecipeMaker.collections.currentTooltip,o=document.getElementById("wprm-add-to-collection-tooltip-column"),t=document.getElementById("wprm-add-to-collection-tooltip-group"),c=window.WPRecipeMaker.collections.getSelectedCollection(e.collection);if(e.column)1===c.groups.length&&t?(t.value=c.groups[0].id,window.WPRecipeMaker.collections.selectGroup(t)):t||window.WPRecipeMaker.collections.madeTooltipSelection();else{if(o){o.querySelectorAll('option:not([value=""])').forEach((e=>e.parentNode.removeChild(e)))}if(t){t.querySelectorAll('option:not([value=""])').forEach((e=>e.parentNode.removeChild(e)))}c&&(c.columns.every((e=>{let t=document.createElement("option");return t.value=e.id,t.text=e.name,o?(o.add(t),!0):(window.WPRecipeMaker.collections.currentTooltip.column=e.id,!1)})),c.groups.every((e=>{let o=document.createElement("option");return o.value=e.id,o.text=e.name,t?(t.add(o),!0):(window.WPRecipeMaker.collections.currentTooltip.group=e.id,""!==window.WPRecipeMaker.collections.currentTooltip.column&&window.WPRecipeMaker.collections.madeTooltipSelection(),!1)})),1===c.columns.length&&o&&(o.value=c.columns[0].id,window.WPRecipeMaker.collections.selectColumn(o)))}o&&(o.disabled=!c),t&&(t.disabled=!c||""===e.column)},getSelectedCollection(e){let o=!1;if("user-"===e.substring(0,5)){const t=parseInt(e.substring(5)),c=wprmp_public.add_to_collection.collections.user.find((e=>e.id===t));c&&(o=c)}return o},madeTooltipSelection(){const e=window.WPRecipeMaker.collections.currentTooltip;e.ref._tippy.destroy(),e.callback({id:e.collection,column:e.column,group:e.group})},addRecipesToCollection(e,o,t){const c=localStorage.getItem("wprm-recipe-collection");let i=!1;c&&(i=JSON.parse(c));const n=e.innerHTML;e.style.width=`${e.offsetWidth}px`,e.style.height=`${e.offsetHeight}px`,"inline"===getComputedStyle(e).display&&(e.style.display="inline-block"),e.style.opacity="0.5",e.innerHTML="...";let r={Accept:"application/json","Content-Type":"application/json"};0<parseInt(wprmp_public.user)&&(r["X-WP-Nonce"]=wprm_public.api_nonce),fetch(`${wprmp_public.endpoints.collections_helper}/add`,{method:"POST",headers:r,credentials:"same-origin",body:JSON.stringify({localCollections:i,recipes:o,collection:t})}).then((function(t){t.ok?t.json().then((t=>{if(!1===t)alert("Something went wrong. Please try again later.");else if(!0!==t){const e=!!t.hasOwnProperty("collections")&&t.collections;e&&localStorage.setItem("wprm-recipe-collection",JSON.stringify(e))}e.innerHTML=n,e.style.width="",e.style.height="",e.style.display="",e.style.opacity="";for(let e of o)l.updateButtons(e.id)})):alert("Something went wrong. Please try again later.")}))}},r=()=>{window.WPRecipeMaker.collections.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.