metric-cooking icon indicating copy to clipboard operation
metric-cooking copied to clipboard

Only partially works on preppykitchen.com

Open Moraxes opened this issue 1 year ago • 1 comments

See e.g. https://preppykitchen.com/easy-tiramisu/:

image

Only the size of the baking dish got converted, and some additional stuff in the instructions later on (not included in screenshot).

Moraxes avatar Jun 26 '23 09:06 Moraxes

This one is tricky. The HTML is:

<li class="wprm-recipe-ingredient" style="list-style-type: none;">
    <span class="wprm-checkbox-container">
        <input type="checkbox" 
               id="wprm-checkbox-3" 
               class="wprm-checkbox" 
               aria-label="&nbsp;1 1/2 cups espresso">
        <label for="wprm-checkbox-3" class="wprm-checkbox-label">
            <span class="sr-only screen-reader-text wprm-screen-reader-text">▢</span>
        </label>
    </span>
    <span class="wprm-recipe-ingredient-amount">1 1/2</span> 
    <span class="wprm-recipe-ingredient-unit">cups</span> 
    <span class="wprm-recipe-ingredient-name">espresso</span>
</li>

So there's an input element, which is normally used to transfer something to the server. I'd normally want to keep the script out of that to avoid any danger of submitting modified text to a server, so I'd avoid touching anything in this <li>. However here it's not actually submitting something to a server (there's no name or value attribute), it's just used to get the user interaction (ticking off the items). I'll have to think about whether I can handle this somehow.

falk-hueffner avatar Jul 09 '23 20:07 falk-hueffner