PageSourceSearch

https://i-maker.jp/base/js/cartInfoUpdate.js?cacheKey=202609b

js i-maker.jp collected 2026-09-24 19:31:20 UTC 1,702 bytes, 49 lines download raw bytes

1const replaceCartInfo = (oldCartInfo, newCartInfo) => {
2  if (location.href.indexOf("https://") == -1) {
3    const url_arr = location.href.replace("http://", "").split("/")[0].split(".");
4    // 今はimgのみの1ヶ所なのでOK。今後srcを増やす場合は注意。
5    while (newCartInfo.indexOf("src=\"/" + url_arr[0], 0) != -1) {
6      newCartInfo = newCartInfo.replace("src=\"/" + url_arr[0], "src=\"");
7    }
8  }
9  const selectors = [
10    '.sysCartInfoItemCount',
11    '.sysCartInfoTotalPrice',
12    '.sysCartInfoRemainFreeShipping',
13    '.sysCartInfoItemList',
14    '.sysCartInfoItemListWithImage',
15  ];
16
17  for (const selectorIndex in selectors) {
18    const target = oldCartInfo.querySelector(selectors[selectorIndex]);
19    const newTarget = newCartInfo.querySelector(selectors[selectorIndex]);
20    if (target !== null && newTarget !== null) {
21      target.innerHTML = newTarget.innerHTML;
22    }
23  }
24};
25
26var cartInfoCount = 0;
27const registerCartInfoUpdateListener = (uri) => {
28  const cartInfoElement = document.querySelectorAll('.sysFuncCartInfo')[cartInfoCount];
29  cartInfoCount++;
30
31  addEventListener('cartupdated', function () {
32    fetch(
33      uri,
34      {
35        method: 'GET',
36        headers: {
37          'X-Requested-With': 'XMLHttpRequest' // _previous.urlセッションにセットされないようにXMLHttpRequestを指定する
38        },
39      }).then(async response => {
40        if (response.ok) {
41          const newElement = document.createElement('div');
42          newElement.innerHTML = await response.text();
43          replaceCartInfo(cartInfoElement, newElement);
44        } else {
45          throw new Error('Failed update cart info');
46        }
47      });
48  });
49};

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.