1const replaceCartInfo = (oldCartInfo, newCartInfo) => { 2 if (location.href.indexOf("https://") == -1) { 3 const url_arr = location.href.replace("http://", "").split("/")[0].split("."); 4 // ä»ã¯imgã®ã¿ã®ï¼ã¶æãªã®ã§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.