<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">const replaceCartInfo = (oldCartInfo, newCartInfo) =&gt; {
  if (location.href.indexOf("https://") == -1) {
    const url_arr = location.href.replace("http://", "").split("/")[0].split(".");
    // ä»Šã¯imgã®ã¿ã®ï¼‘ãƒ¶æ‰€ãªã®ã§OKã€‚ä»Šå¾Œsrcã‚’å¢—ã‚„ã™å&nbsp;´åˆã¯æ³¨æ„ã€‚
    while (newCartInfo.indexOf("src=\"/" + url_arr[0], 0) != -1) {
      newCartInfo = newCartInfo.replace("src=\"/" + url_arr[0], "src=\"");
    }
  }
  const selectors = [
    '.sysCartInfoItemCount',
    '.sysCartInfoTotalPrice',
    '.sysCartInfoRemainFreeShipping',
    '.sysCartInfoItemList',
    '.sysCartInfoItemListWithImage',
  ];

  for (const selectorIndex in selectors) {
    const target = oldCartInfo.querySelector(selectors[selectorIndex]);
    const newTarget = newCartInfo.querySelector(selectors[selectorIndex]);
    if (target !== null &amp;&amp; newTarget !== null) {
      target.innerHTML = newTarget.innerHTML;
    }
  }
};

var cartInfoCount = 0;
const registerCartInfoUpdateListener = (uri) =&gt; {
  const cartInfoElement = document.querySelectorAll('.sysFuncCartInfo')[cartInfoCount];
  cartInfoCount++;

  addEventListener('cartupdated', function () {
    fetch(
      uri,
      {
        method: 'GET',
        headers: {
          'X-Requested-With': 'XMLHttpRequest' // _previous.urlã‚»ãƒƒã‚·ãƒ§ãƒ³ã«ã‚»ãƒƒãƒˆã•ã‚Œãªã„ã‚ˆã†ã«XMLHttpRequestã‚’æŒ‡å®šã™ã‚‹
        },
      }).then(async response =&gt; {
        if (response.ok) {
          const newElement = document.createElement('div');
          newElement.innerHTML = await response.text();
          replaceCartInfo(cartInfoElement, newElement);
        } else {
          throw new Error('Failed update cart info');
        }
      });
  });
};</pre></body></html>