<aside> 💡 從這個 Source Code 拿出來的

https://github.com/zhxie/chiikawa-market-storage-checker

感謝前人種樹 🙏🏻

</aside>


Untitled

Untitled

Untitled


書籤 → 新增網頁,貼上底下的程式碼(只能在個別的商品頁面 or 購物車頁面按這個書籤)

javascript: (function () {
  if (document.location.pathname === "/cart") {
    for (const item of document.getElementsByClassName("cart--item")) {
      const quantity = item.getAttribute("data-inventory-quantity");
      const label =
        item.getElementsByClassName("cart--item--title")?.[0]?.children?.[0]
          ?.children?.[0];
      if (quantity !== undefined && label) {
        label.textContent += `(${quantity})`;
      }
    }
  } else {
    const quantity = document
      .getElementsByClassName("product-form--variant-select")?.[0]
      ?.children?.[0]?.getAttribute("data-inventory-quantity");
    const label = document.getElementsByClassName("product-page--title")?.[0];
    if (quantity !== undefined && label) {
      label.textContent += ` (${quantity})`;
    }
  }
})();

電腦版操作(書籤列可以直接戳)

IMG_1754.jpeg

IMG_1755.jpeg

手機版操作(一樣去按書籤)

IMG_1746.png

IMG_1747.png

IMG_1748.png