PageSourceSearch

https://www.npmshops.com/mainssl/uploads/shop/js/us_ddMonitoring.js?jsvMsgXmlID=162316&r=035020

js npmshops.com collected 2026-09-25 19:51:35 UTC 44,128 bytes, 1,259 lines download raw bytes

1// console.log("零件在這");
2var langValue = $("html").attr("lang");
3var processedOrderCodes = [];
4var CoinType="TWD";
5    // var language = typeof lang !== "undefined" && lang !== 0 ? lang : "TW";
6    var userEmail = typeof UserData !== "undefined" && UserData.email ? UserData.email : null;
7    var userPhone = typeof UserData !== "undefined" && UserData.phone ? UserData.phone : null;
8
9// let isPurchaseInfoExecuted = false;//標記事件啟動器
10
11// if (langValue === "zh-TW") {
12//   CoinType = "TWD";
13// } else if (langValue === "en") {
14//   CoinType = "USD";
15// } else if (langValue === "jp") {
16//   CoinType = "JPY";
17// } else if (langValue === "kr") {
18//   CoinType = "KRW";
19// } else if (langValue === "fr") {
20//   CoinType = "EUR";
21// } else {
22//   CoinType = "其他值";
23// }
24var MemXmlID = "unknown";
25
26
27//心願清單 加入購物車XX尚未完成
28// let addToCartwish = (e) => {
29//   console.log("心願清單 加入購物車");
30//   e.preventDefault();
31//   var xiValue = $(e.currentTarget).attr("xi");
32//   console.log("xiValue", xiValue);
33//   // 根據 xi 值找到相對應的商品編號和商品名稱
34//   var productCode = $('.MobliePrdCode[xi="' + xiValue + '"]')
35//     .find("nobr")
36//     .text();
37//   console.log("productCode", productCode);
38
39//   // 找到心願清單元素並獲取 vdrCodeValue
40//   //  var vdrCodeValue = $(e.currentTarget).closest('tr').find('.faveaddcart').attr('data-vdrcode');
41//   //  console.log("vdrCodeValue", vdrCodeValue);
42
43//   var productNameTwish = $('.MobliePrdName a[xi="' + xiValue + '"]').text();
44//   console.log("productNameTwish", productNameTwish);
45//   var PrdPrice = $(e.currentTarget).data("price");
46
47//   console.log("PrdPrice", PrdPrice);
48
49//   window.dataLayer = window.dataLayer || [];
50//   window.dataLayer.push({
51//     event: "GaEvent",
52//     custom_label: "AddToCart",
53//     ecommerce: {
54//       contents: [
55//         {
56//           id: productCode,
57//           name: productNameTwish,
58//           quantity: 1,
59//           value: PrdPrice,
60//           category:null,
61//           category2: null,
62//           brand: null,
63//           currency: CoinType,
64//         },
65//       ],
66//     },
67//   });
68// };
69let addToCartwish = (e) => {
70  e.preventDefault(); // Prevent the default anchor tag behavior
71  
72  // Retrieve the xi value from the clicked element
73  var xiValue = $(e.currentTarget).attr("xi");
74//   console.log("xiValue", xiValue);
75
76  // Assuming the clicked element is within the same row as the product details
77  // Traverse up to the closest 'tr' (table row) and then find the specific elements within that row
78  var $row = $(e.currentTarget).closest('tr');
79
80  // Now find the product code and name within that row using your class identifiers
81  var productCode = $row.find('.MobliePrdCode nobr').text();
82//   console.log("productCode", productCode);
83
84  var productNameTwish = $row.find('.MobliePrdName a').text();
85//   console.log("productNameTwish", productNameTwish);
86
87  // Retrieve the product price from the data-price attribute of the clicked element
88  // var PrdPrice = $(e.currentTarget).data("price");
89  var PrdPrice = Number($(e.currentTarget).data("price"));
90  console.log("PrdPrice", PrdPrice);
91
92  // Push the gathered details to your dataLayer for tracking
93  window.dataLayer = window.dataLayer || [];
94  window.dataLayer.push({ ecommerce: null });
95  window.dataLayer.push({
96    event: "GaEvent",
97    custom_label: "AddToCart",
98    ecommerce: {
99          id: productCode,
100          name: productNameTwish,
101          quantity: 1,
102          value: PrdPrice,
103          category: null,
104          category2: null,
105          brand: null,
106          currency: CoinType, 
107    },
108  });
109};
110//產品頁 加入購物車 ok 監聽按鈕SaleBtn1
111let addToCartprdinfo = (e) => {
112//   console.log("產品頁 加入購物車");
113  e.preventDefault();
114  var xmlid = $(e.currentTarget).closest('.rtBuyNow').attr("xi");
115  var productinfoName = $(e.currentTarget).closest('.rtBuyNow').attr("data-name");
116  var qtyValue = $(".qty").val();
117//   console.log("qtyValue", qtyValue);
118//   console.log("xmlid", xmlid);
119//   console.log("productinfoName", productinfoName);
120  // var vdrCodeValue = $('.vdrCode').text();
121  var vdrCodeValue = $("#PrdInfo_" + xmlid).attr("prd");
122//   console.log("vdrCodeValue", vdrCodeValue);
123  var resultvdrCodeValue = vdrCodeValue.replace("$VdrCode$", "");
124//   console.log("resultvdrCodeValue", resultvdrCodeValue);
125PrdPrice = parseFloat(PrdPrice);
126
127  window.dataLayer = window.dataLayer || [];
128  window.dataLayer.push({ ecommerce: null });
129  window.dataLayer.push({
130    event: "GaEvent",
131    custom_label: "AddToCart",
132    ecommerce: {
133          id: resultvdrCodeValue,
134          name: productinfoName, //缺
135          quantity: qtyValue,
136          value: PrdPrice, //正確勿動
137          category:null,
138          category2: null,
139          brand: null,
140          currency: CoinType,
141    },
142  });
143};
144//按鈕為PrdBtn
145// let addToCartprdinfo = (e) => {
146//   console.log("產品頁 加入購物車");
147//   e.preventDefault();
148//   var xmlid = $(e.currentTarget).attr("xi");
149//   var productinfoName = $(e.currentTarget).attr("data-name");
150//   var qtyValue = $(".qty").val();
151//   console.log("qtyValue", qtyValue);
152//   console.log("xmlid", xmlid);
153//   console.log("productinfoName", productinfoName);
154//   // var vdrCodeValue = $('.vdrCode').text();
155//   var vdrCodeValue = $("#PrdInfo_" + xmlid).attr("prd");
156//   console.log("vdrCodeValue", vdrCodeValue);
157//   var resultvdrCodeValue = vdrCodeValue.replace("$VdrCode$", "");
158//   console.log("resultvdrCodeValue", resultvdrCodeValue);
159
160//   window.dataLayer = window.dataLayer || [];
161//   window.dataLayer.push({
162//     event: "GaEvent",
163//     custom_label: "AddToCart",
164//     ecommerce: {
165//           id: resultvdrCodeValue,
166//           name: productinfoName, //缺
167//           quantity: qtyValue,
168//           value: PrdPrice, //正確勿動
169//           category:null,
170//           category2: null,
171//           brand: null,
172//           currency: CoinType,
173//     },
174//   });
175// };
176//產品頁 你可能有興趣加入購物車 完成
177let addTointerestCartprdinfo = (e) => {
178  e.stopPropagation();
179//   console.log("產品頁 你可能有興趣加入購物車");
180  let $main = $(e.currentTarget).closest(".PrdCell");
181  let xiValue2 = $main.attr("xi");
182//   console.log("xiValue2", xiValue2);
183  // 使用 xi 值查找對應的元素
184  let productCode2 = $main.attr("prd");
185//   console.log("productCode", productCode2);
186
187  let productName2 = $main.find(".PrdTitle").text();
188//   console.log("productName2", productName2);
189
190  // 取得 PrdPrice 的值
191  let PrdPrice2 = $main.find(".PrdPriceAmt").text();
192  let PrdDisPrice = $main.find(".PrdDisPriceAmt").text();
193  // PrdPrice2 = PrdDisPrice.length ? PrdDisPrice : PrdPrice2;
194  // PrdPrice2 = PrdDisPrice.length ? PrdDisPrice.replace(/,/g, "") : PrdPrice2.replace(/,/g, "");
195  PrdPrice2 = PrdDisPrice.length ? parseFloat(PrdDisPrice.replace(/,/g, "")) : parseFloat(PrdPrice2.replace(/,/g, ""));
196//   console.log("興趣PrdPrice", PrdPrice2);
197
198  window.dataLayer = window.dataLayer || [];
199  window.dataLayer.push({ ecommerce: null });
200  window.dataLayer.push({
201    event: "GaEvent",
202    custom_label: "AddToCart",
203    ecommerce: {
204          id: productCode2,
205          name: productName2, //缺
206          quantity: 1,
207          value: PrdPrice2, //正確勿動
208          category:null,
209          category2: null,
210          brand: null,
211          currency: CoinType,
212
213    },
214  });
215};
216//監聽按鈕產品頁 瀏覽商品
217  // let prdinfoview = (e) => {
218  //   console.log("鈕產品頁 瀏覽商品");
219  //   var viewcode = $(".vdrCode").text();
220  //   var xiValue = $(".divPrdInfo").attr("xi");
221  //   console.log("xiValue", xiValue);
222  //   var vdrCodeValueview = $("#PrdInfo_"+ xiValue).attr("prd");
223  //   console.log("vdrCodeValueview", vdrCodeValueview);
224  //   // var resultvdrCodeview = vdrCodeValueview.replace("$VdrCode$", "");
225  //   // console.log("resultvdrCodeview",resultvdrCodeview);
226
227  //   // var priceAmtValue = $('#meMsg_41427_MsgPrdPriceAmt').text();
228  //   var PrdName = $('.rtBuyNow.PrdBtn:not([data-name="$PrdTitle$"])').attr(
229  //     "data-name"
230  //   );
231
232  //   console.log(" PrdName 的值為:", PrdName);
233  //   console.log(" PrdPrice 的值為:", PrdPrice);
234
235  //   window.dataLayer = window.dataLayer || [];
236  //   window.dataLayer.push({ ecommerce: null });
237  //   window.dataLayer.push({
238  //     event: "GaEvent",
239  //     custom_label: "ViewContent",
240  //     ecommerce: {
241  //       id: vdrCodeValueview,
242  //       name: PrdName, //缺
243  //       value: PrdPrice,
244  //       category:null,
245  //       category2: null,
246  //       category3: null,
247  //       brand: null,
248  //       currency: CoinType,
249  //     },
250  //   });
251  // };
252  let prdinfoview = () => {
253    // console.log("鈕產品頁 瀏覽商品");
254    
255    // 其他初始化代碼...
256    var xiValue = $(".divPrdInfo").attr("xi");
257    // console.log("xiValue", xiValue);
258  
259    // 使用 MutationObserver 監聽 DOM 變化
260    let observer = new MutationObserver((mutations, obs) => {
261      var vdrCodeValueview = $("#PrdInfo_" + xiValue).attr("prd");
262      if (vdrCodeValueview) {
263        // console.log("vdrCodeValueview", vdrCodeValueview);
264        let PrdName = $('.rtBuyNow.PrdBtn:not([data-name="$PrdTitle$"])').attr("data-name");
265        // console.log("PrdName 的值為:", PrdName);
266        // 確保 PrdPrice 這個變量在這裡是已定義且有值的
267        // console.log("PrdPrice 的值為:", PrdPrice);
268  
269        window.dataLayer = window.dataLayer || [];
270        window.dataLayer.push({ ecommerce: null });
271        window.dataLayer.push({
272          event: "GaEvent",
273          custom_label: "ViewContent",
274          ecommerce: {
275            id: vdrCodeValueview,
276            name: PrdName,
277            value: PrdPrice,
278            category: null,
279            category2: null,
280            category3: null,
281            brand: null,
282            currency: CoinType,
283          },
284        });
285  
286        // 停止監聽
287        obs.disconnect();
288      }
289    });
290  
291    observer.observe(document.body, {
292      childList: true,
293      subtree: true
294    });
295  };
296//監聽產品目錄頁 加入購物車 完成
297let addToCartprdlist = (e) => {
298//   console.log("目錄頁 加入購物車");
299  e.preventDefault();
300  var xmlid = $(e.currentTarget).attr("xi");
301  var productlistName = $(e.currentTarget).attr("data-name");
302  var prdValue = $("#PrdInfo_" + xmlid).attr("prd");
303  var priceAmtElement = $("#meMsg_" + xmlid + "_MsgPrdPriceAmt");
304  var priceAmtValue = priceAmtElement.attr("priceamt");
305var priceAmtNumber = parseFloat(priceAmtValue);
306  // var productId =priceAmtElement.attr('priceamt');
307
308//   console.log("priceAmtValue", priceAmtValue);
309//   console.log("xmlid", xmlid);
310//   console.log("prdValue", prdValue);
311//   console.log("productlistName", productlistName);
312
313  window.dataLayer = window.dataLayer || [];
314  window.dataLayer.push({ ecommerce: null });
315  window.dataLayer.push({
316    event: "GaEvent",
317    custom_label: "AddToCart",
318    ecommerce: {
319          id: prdValue || "anonymous",
320          name: productlistName,
321          quantity: 1,
322          value: priceAmtNumber,
323          category:null,
324          category2: null,
325          category3: null,
326          brand: null,
327          currency: CoinType,
328    },
329  });
330};
331//監聽產品目錄頁 瀏覽紀錄 加入購物車 完成
332let historyAddCartevent = (e) => {
333//   console.log("目錄頁 瀏覽紀錄 加入購物車事件");
334  e.preventDefault();
335
336  e.preventDefault();
337
338  var xiValue = $(e.currentTarget).find("img").attr("xi");
339//   console.log("xiValue", xiValue);
340
341  var prdValue = $(`#PrdInfo_${xiValue}`).attr("prd");
342//   console.log("prdValue", prdValue);
343
344  var prdTitleName = $(`#PrdInfo_${xiValue} .PrdTitle`).attr("title");
345//   console.log("prdTitleName", prdTitleName);
346
347  var prdPricehistoryValue = $(`#PrdInfo_${xiValue} .PrdPrice`).text().trim();
348//   console.log("prdPricehistoryValue", prdPricehistoryValue);
349
350  var ntAmount = prdPricehistoryValue.split("NT$")[1].split("US$")[0].trim();
351  var ntAmountNumber = parseFloat(ntAmount);
352//   console.log("ntAmount", ntAmount);
353
354  window.dataLayer = window.dataLayer || [];
355  window.dataLayer.push({ ecommerce: null });
356  window.dataLayer.push({
357    event: "GaEvent",
358    custom_label: "AddToCart",
359    ecommerce: {   
360          id: prdValue || "anonymous",
361          name: prdTitleName,
362          quantity: 1,
363          value: ntAmountNumber,
364          category:null,
365          category2: null,
366          category3: null,
367          brand: null,
368          currency: CoinType,
369    },
370  });
371};
372//產品興趣
373// let addToCartprdinterest = (e) => {
374//     console.log("成功監聽產品興趣xxx");
375//     e.preventDefault();
376//     var xmlid = $(e.currentTarget).attr("xi");
377//     var productName = $(e.currentTarget).attr("data-name");
378//     var priceAmtElement = $('#meMsg_' + xmlid + '_MsgPrdPriceAmt');
379//     var priceAmtValue = priceAmtElement.attr('priceamt');
380
381//     console.log("priceAmtValue", priceAmtValue);
382//     console.log("xmlid",xmlid);
383//     // console.log("PrdPriceElement",PrdPriceElement);
384//     console.log("productName",productName);
385
386//     window.dataLayer = window.dataLayer || [];
387//     window.dataLayer.push({
388//         'event': 'GaEvent',
389//         'custom_label': 'AddToCart',
390//         'ecommerce': {
391//             contents: [{
392//                 'id': xmlid,
393//                 'name': productName,
394//                 'quantity': 1,
395//                 'value': priceAmtValue,
396//                 'category': '類別',
397//                 'category2': '子類別',
398//                 'brand': '品牌名稱',
399//                 'currency': CoinType
400//             }]
401//         }
402//     });
403// }
404//使用者資訊
405// window.onload = function () {
406//   console.log("mem載入");
407//   var htmlElement = document.querySelector("html");
408//   var language = lang !== 0 ? lang : "TW";
409//   var userEmail = UserData.email;
410//   var userPhone = UserData.phone;
411//   var NpmUserData = {
412//     user_id: MemXmlID || "anonymous", //定義為anonymous找不到
413//     phone: userPhone || null,
414//     email: userEmail || null,
415//     language: CoinType || null,
416//   };
417
418//   window.dataLayer = window.dataLayer || [];
419//   window.dataLayer.push(NpmUserData);
420//   console.log("NpmUserData", NpmUserData);
421// };
422// var NpmUserData;
423    // window.onload = function () {
424    
425    //       NpmUserData = {
426    //           user_id: typeof MemXmlID !== "undefined" && MemXmlID ? MemXmlID : "anonymous",
427    //           phone: typeof userPhone !== "undefined" ? userPhone : null,
428    //           email: typeof userEmail !== "undefined" ? userEmail : null, 
429    //           language: typeof CoinType !== "undefined" && CoinType ? CoinType : "defaultLanguage"
430    //       };
431
432        
433    //       console.log("NpmUserData updated after 5 seconds", NpmUserData);
434      
435    // };
436//產品目錄頁-加入心願清單
437let addToWishprdlist = (e) => {
438//   console.log("產品目錄頁-加入心願清單");
439  e.preventDefault();
440
441  var xiValue = $(e.currentTarget).attr("xi");
442//   console.log("xiValue " + xiValue);
443
444  var prdValue = $(`#PrdInfo_${xiValue}`).attr("prd");
445//   console.log("prdValue", prdValue);
446
447  var prdTitleName = $(`#PrdInfo_${xiValue} .PrdTitle .PrdTitleText a`).attr(
448    "title"
449  );
450//   console.log("prdTitleName", prdTitleName);
451
452  var prdPricehistoryValue = $(`#PrdInfo_${xiValue} .PrdPrice`).text().trim();
453
454  var ntAmount = prdPricehistoryValue.split("NT$")[1].split("US$")[0].trim().replace(/[^0-9]/g, '');
455//   console.log("ntAmount", ntAmount);
456
457  window.dataLayer = window.dataLayer || [];
458  window.dataLayer.push({ ecommerce: null });
459  window.dataLayer.push({
460    event: "GaEvent",
461    custom_label: "AddToWishlist",
462    ecommerce: {
463      id: prdValue, //商品編號
464      name: prdTitleName, //商品名稱
465      value: ntAmount, //商品價格
466      category:null,
467      category2: null,
468      category3: null,
469      brand: null,
470      currency: CoinType,
471    },
472  });
473};
474//產品資訊-加入心願清單
475let addToWishprdinfo = (e) => {
476//   console.log("產品資訊頁-加入心願清單");
477  var viewToWishprdinfocode = $(".vdrCode").text();
478  let xiValue = $(".divPrdInfo").attr("xi");
479//   console.log("xiValue", xiValue);
480  var vdrCodeValueview = $("#PrdInfo_" + xiValue).attr("prd");
481   console.log("vdrCodeValueview", vdrCodeValueview);
482  var resultvdrCodeview = vdrCodeValueview.replace("$VdrCode$", "");
483//   console.log("resultvdrCodeview", resultvdrCodeview);
484
485  // var priceAmtValue = $('#meMsg_41427_MsgPrdPriceAmt').text();
486  var PrdNameToWishprdinf = $(
487    '.rtBuyNow.PrdBtn:not([data-name="$PrdTitle$"])'
488  ).attr("data-name");
489
490  window.dataLayer = window.dataLayer || [];
491  window.dataLayer.push({ ecommerce: null });
492  window.dataLayer.push({
493    event: "GaEvent",
494    custom_label: "AddToWishlist",
495    ecommerce: {
496      id: resultvdrCodeview, //商品編號
497      name: PrdNameToWishprdinf, //商品名稱
498      value: PrdPrice, //商品價格
499      category:null,
500      category2: null,
501      category3: null,
502      brand: null,
503      currency: CoinType,
504    },
505  });
506};
507
508//InitiateCheckout(開始結帳畫面)
509let InitiateCheckout = (e) => {
510//   console.log("開始結帳畫面");
511  if (e) {
512    e.preventDefault();
513  }
514  var ordertotalamtValue;
515  var ordertotalamtValue2;//電子書總金額
516  $("#cenShowList1").each(function() {
517   
518   ordertotalamtValue = $(this).find(".spanOrderTotalAmt").text().replace(/,/g, '');
519    // console.log("ordertotalamtValue", ordertotalamtValue);
520
521});
522$("#cenShowList2").each(function() {
523   
524  ordertotalamtValue2 = $(this).find(".spanOrderTotalAmt").text().replace(/,/g, '');
525//    console.log("ordertotalamtValue2", ordertotalamtValue2);
526
527});
528  // console.log("prdTotalAmtElement",prdTotalAmtElement);
529  // console.log("langValue",langValue);
530  // console.log("ordercode",orderCode);
531
532  // 創建一個數組來存儲商品詳細信息
533  var products = [];
534  var products2 = [];
535  // 遍歷具有“ShopListName”類的產品元素
536  $("#cenShowList1 .ShopListName").each(function (index) {
537    var prdcode = $(this).closest("tr").find(".ShopListPrdCode").text(); // 生成唯一的產品ID
538    var productName = $(this).text(); // 獲取產品名稱
539    var productQuantity =
540      parseInt($(this).closest("tr").find(".qty").attr("qty")) || 1; // 您可以根據需要修改這個值
541    var productValue =
542    parseFloat($(this).closest("tr").find(".ShopListPrice").text().replace(/,/g, '')) || 0;
543    // console.log("productValue",productValue);
544
545    // 將產品詳細信息添加到數組中
546    products.push({
547      id: prdcode,
548      name: productName,
549      quantity: productQuantity,
550      value: productValue,
551      category:null,
552      category2: null,
553      category3: null,
554      brand: null,
555    });
556  });
557  $("#cenShowList2 .ShopListName").each(function (index) {
558    var prdcode2 = $(this).closest("tr").find(".ShopListPrdCode").text(); // 生成唯一的產品ID
559    var productName2 = $(this).text(); // 獲取產品名稱
560    var productQuantity2 =
561      parseInt($(this).closest("tr").find(".qty").attr("qty")) || 1; // 您可以根據需要修改這個值
562    var productValue2 =
563    parseFloat($(this).closest("tr").find(".ShopListPrice").text().replace(/,/g, '')) || 0;
564    // console.log("productValue2",productValue2);
565
566    // 將產品詳細信息添加到數組中
567    products2.push({
568      id: prdcode2,
569      name: productName2,
570      quantity: productQuantity2,
571      value: productValue2,
572      category:null,
573      category2: null,
574      category3: null,
575      brand: null,
576    });
577  });
578  // 將包含商品詳細信息的數組推送到dataLayer中
579  window.dataLayer = window.dataLayer || [];
580  window.dataLayer.push({ ecommerce: null });
581  window.dataLayer.push({
582    event: "GaEvent",
583    custom_label: "InitiateCheckout",
584    ecommerce: {
585      amount: ordertotalamtValue, //結帳總金額
586      value: ordertotalamtValue, //結帳總金額
587      currency: CoinType, //幣別(ex:TWD)
588      contents: products,
589    },
590  });
591  //電子書區塊
592  window.dataLayer = window.dataLayer || [];
593  window.dataLayer.push({ ecommerce: null });
594  window.dataLayer.push({
595    event: "GaEvent",
596    custom_label: "InitiateCheckout",
597    ecommerce: {
598      amount: ordertotalamtValue2, //結帳總金額
599      value: ordertotalamtValue2, //結帳總金額
600      currency: CoinType, //幣別(ex:TWD)
601      contents: products2,
602    },
603  });
604};
605
606
607
608//AddPaymentInfo(填寫付款資訊)
609let AddPaymentInfo = (e) => {
610//   console.log("開始填寫付款資訊");
611  if (e) {
612    e.preventDefault();
613  }
614  var AddPaymentamt = $(".spanOrderTotalAmt").text().replace(/,/g,'');
615//   console.log("AddPaymentamt", AddPaymentamt);
616
617  var langValue = $("html").attr("lang");
618  // console.log("prdTotalAmtElement",prdTotalAmtElement);
619  // console.log("langValue",langValue);
620  // console.log("ordercode",orderCode);
621
622  var products = [];
623
624  // 遍歷具有“ShopListName”類的產品元素
625  $(".ShopListName").each(function (index) {
626    var prdcode = $(this).closest("tr").find(".ShopListPrdCode").text();
627    var productName = $(this).text(); // 獲取產品名稱
628    var productQuantity =
629      parseInt($(this).closest("tr").find(".qty").attr("qty")) || 1; // 您可以根據需要修改這個值
630    var productValue =
631      parseFloat($(this).closest("tr").find(".ShopListPrice").text().replace(/,/g, '')) || 0;
632    // var productCategory = '';
633    // var productCategory2 = '';
634    // var productCategory3 = '';
635    // var productBrand = '';
636
637    // 將產品詳細信息添加到數組中
638    products.push({
639      id: prdcode,
640      name: productName,
641      quantity: productQuantity,
642      value: productValue,
643      category:null,
644      category2: null,
645      category3: null,
646      brand: null,
647    });
648  });
649
650  window.dataLayer = window.dataLayer || [];
651  window.dataLayer.push({ ecommerce: null });
652  window.dataLayer.push({
653    event: "GaEvent",
654    custom_label: "AddPaymentInfo",
655    ecommerce: {
656      amount: AddPaymentamt, //結帳總金額
657      value: AddPaymentamt, //結帳總金額
658      currency: CoinType, //幣別(ex:TWD)
659      contents: products,
660    },
661  });
662};
663
664//Purchase(購買完成)
665let Purchaseinfo = (e) => {
666  var orderCodeValue = $("#ordercode").text();
667  // 讀取已處理的訂單編號列表
668  var processedOrderCodes =
669    JSON.parse(localStorage.getItem("processedOrderCodes")) || [];
670
671  // 檢查是否已經處理過這個訂單編號
672  if (processedOrderCodes.includes(orderCodeValue)) {
673    // console.log("Order Code already processed: ", orderCodeValue);
674    return;
675  }
676
677  processedOrderCodes.push(orderCodeValue); // 將當前訂單編號加入已處理清單
678
679  // 寫入 localStorage
680  localStorage.setItem(
681    "processedOrderCodes",
682    JSON.stringify(processedOrderCodes)
683  );
684
685//   console.log("當前訂單編號 ", processedOrderCodes);
686//   console.log("Order Code: ", orderCodeValue);
687
688  if (e) {
689    e.preventDefault();
690  }
691
692//   console.log("購買完成頁面");
693  var prdTotalAmtElement = $("#ordertotalamt").text();
694  var orderCode = $("#ordercode").text();
695  // var langValue = $("html").attr("lang");
696
697  // 創建一個數組來存儲商品詳細信息
698  var products = [];
699
700  // console.log("prdTotalAmtElement",prdTotalAmtElement);
701  // console.log("langValue",langValue);
702  // console.log("ordercode",orderCode);
703
704  // 遍歷具有“ShopListName”類的產品元素
705  $(".ShopListName").each(function (index) {
706    var prdcode = $(this).closest("tr").find(".ShopListPrdCode").text();
707
708    // 加入判斷式排除以 "ZC" 開頭的
709    if (!prdcode.startsWith("ZC") && $(this).text().indexOf("優惠折扣") === -1) {
710      var productName = $(this).text(); // 獲取產品名稱
711      var productQuantity =
712        parseInt($(this).closest("tr").find(".qty").attr("qty")) || 1; // 您可以根據需要修改這個值
713      // var productValue =
714      //   parseFloat($(this).closest("tr").find(".ShopListPrice").text()) || 0;
715      var productValue = parseFloat(
716        $(this).closest("tr").find(".ShopListPrice").text().replace(/,/g, '')
717    ) || 0;
718        console.log("productQuantity:", productQuantity);
719console.log("productValue:", productValue);
720      // 將產品詳細信息添加到數組中
721      products.push({
722        id: prdcode,
723        name: productName,
724        quantity: productQuantity,
725        value: productValue,
726        category:null,
727      category2: null,
728      category3: null,
729      brand: null,
730      });
731    }
732  });
733
734  // 將包含商品詳細信息的數組推送到dataLayer中
735  window.dataLayer = window.dataLayer || [];
736  window.dataLayer.push({ ecommerce: null });
737  window.dataLayer.push({
738    event: "GaEvent",
739    custom_label: "Purchase",
740    ecommerce: {
741      order_id: orderCode,
742      transaction_id: orderCode,
743      amount: prdTotalAmtElement,
744      value: prdTotalAmtElement,
745      currency: "TWD",
746      contents: products,
747  
748    },
749  });
750};
751//補貨頁面
752let Leadinfo = (e) => {
753//   console.log("捕貨按鈕");
754  if (e) {
755    e.preventDefault();
756  }
757  var xiValue = $(".rtBuyNow.PrdBtn").not('[xi="$XmlID$"]').attr("xi");
758//   console.log("xiValue",xiValue);
759 
760  var vdrCodeValue = $("#PrdInfo_" + xiValue).attr("prd");
761  // console.log("vdrCodeValue", vdrCodeValue);
762  var resultvdrCodeValue = vdrCodeValue.replace("$VdrCode$", "");
763//   console.log("resultvdrCodeValue", resultvdrCodeValue);
764
765// console.log("Product Code: " + productCode);
766var targetElement = $(".rtBuyNow.PrdBtn[xi='" + xiValue + "']");
767var dataNameValue = targetElement.attr("data-name");
768// console.log("產品名稱", dataNameValue);
769
770// Find the product price in NT$
771var productPrice = $(".rtPrdPrice .PrdPriceAmt").text();
772// console.log("Product Price in NT$: " + productPrice);
773var productPriceWithoutCommas = productPrice.replace(/,/g, '');
774var productPriceAsInteger = parseInt(productPriceWithoutCommas, 10);
775
776// console.log("Product Price as Integer: " + productPriceAsInteger);
777// Find the product price in USD (if available)
778
779  // console.log("xiValue",xiValue);
780  // console.log("dataNameValue",dataNameValue);
781  // console.log("LeadpriceAmtValue",LeadpriceAmtValue);
782
783  window.dataLayer = window.dataLayer || [];
784  window.dataLayer.push({ ecommerce: null });
785  window.dataLayer.push({
786    event: "GaEvent",
787    custom_label: "Lead",
788    ecommerce: {
789      id: resultvdrCodeValue, //商品編號
790      name: dataNameValue, //商品名稱
791      value: productPriceAsInteger, //商品單價
792      category:null,
793      category2: null,
794      category3: null,
795      brand: null,
796      currency: CoinType, //幣別(ex:TWD)
797    },
798  });
799};
800//潛力客服中心
801//  let customerService = (e) => {
802//   console.log("客服按鈕");
803//   // if (e) {
804//   //   e.preventDefault();
805//   // }
806//   // 使用正則表達式來提取引號內的文字
807
808//   var cmTitleValue = $("#cmTitle").val();  
809// // var matchResult = cmTitleValue.match(/「([^」]+)」/);
810// // console.log("cmTitleValue",cmTitleValue);
811// // console.log("matchResult",matchResult);
812// // 如果有找到匹配的結果,取得第一個捕獲群組的內容
813// // if (matchResult && matchResult.length > 1) {
814// //     var innerText = matchResult[1];
815// //     console.log("引號內的文字:", innerText);
816// // } else {
817// //     console.log("找不到引號內的文字");
818// // }
819 
820  
821
822
823//   window.dataLayer = window.dataLayer || [];
824//   window.dataLayer.push({ ecommerce: null });
825//   window.dataLayer.push({
826//     event: "GaEvent",
827//     custom_label: "Lead",
828//     ecommerce: {
829//       id: 'null', //商品編號
830//       name: cmTitleValue, //商品名稱
831//       value:'null', //商品單價
832//       'category': 'null', //商品大分類,ex:圖書影音
833//         'category2': 'null', //商品中分類,ex:佛教經書
834//         'category3': 'null', //商品小分類(若沒有,值帶入null)
835//         'brand': 'null',//品牌名稱,ex:故宮 or 聯名的品牌
836//         'currency': 'null'//幣別(ex:TWD)
837//     },
838//   });
839// };
840let customerService = (e) => {
841//   console.log("客服按鈕");
842
843  var cmTitleValue = $("#cmTitle").val();
844
845  // 存儲到本地端
846  window.localStorage.setItem('cmTitle', cmTitleValue);
847
848  // 延遲5秒後執行
849  setTimeout(() => {
850    // console.log("執行 dataLayer.push");
851    var storedTitle = window.localStorage.getItem('cmTitle');
852
853    // 檢查是否有 #divForm_contactUs 元素以及其子元素 .ReturnDesc
854    var divForm_contactUs = $("#divForm_contactUs");
855    var returnDesc = divForm_contactUs.find('.ReturnDesc').text().trim();
856    // console.log("returnDesc",returnDesc);
857    if (returnDesc === "感謝您的回應!") {
858      if (storedTitle) {
859        window.dataLayer = window.dataLayer || [];
860        window.dataLayer.push({ ecommerce: null });
861        window.dataLayer.push({ 
862          ecommerce: null 
863        });
864        window.dataLayer.push({
865          event: "GaEvent",
866          custom_label: "Lead",
867          ecommerce: {
868            id: 'null', 
869            name: storedTitle, 
870            value: 'null', 
871            'category': 'null', 
872            'category2': 'null', 
873            'category3': 'null', 
874            'brand': 'null',
875            'currency': 'null'
876          },
877        });
878
879        // 清除已儲存的資料
880        window.localStorage.removeItem('cmTitle');
881      }
882    } else {
883      console.log("未找到符合條件的文字");
884    }
885  }, 5000); // 延遲5秒(5000毫秒)
886};
887//Search(搜尋關鍵字) 直接輸入板本
888// let Searchevent = (e) => {
889//   console.log("搜尋事件啟動");
890//   // 获取搜尋框中的搜尋關鍵字
891//   var searchKeyword = $(".searchInput").val();
892//   console.log("searchKeyword", searchKeyword);
893
894
895//   // 检查搜尋關鍵字是否存在
896//   if (searchKeyword.trim() !== "" && searchKeyword.length >= 3) {
897//     // 在搜尋成功後觸發條件
898//     console.log("成功抓取成功");
899//     window.dataLayer = window.dataLayer || [];
900//     window.dataLayer.push({ ecommerce: null });
901//     window.dataLayer.push({
902//       event: "GaEvent",
903//       custom_label: "Search",
904//       ecommerce: {
905//         keyword: searchKeyword,
906//       },
907//     });
908//   }
909// };
910//Search(搜尋關鍵字)到達頁面版本
911let Searchevent = (e) => {
912//   console.log("搜尋事件啟動");
913
914 
915  var searchParams = new URLSearchParams(window.location.search);
916  var ssValue = searchParams.get("ss");
917
918  
919  function decodeCustom(encodedStr) {
920    return encodedStr.replace(/%u([\dA-F]{4})/gi, function (match, grp) {
921      return String.fromCharCode(parseInt(grp, 16));
922    });
923  }
924
925
926  var searchKeyword = ssValue ? decodeCustom(ssValue) : '';
927
928//   console.log("searchKeyword:", searchKeyword);
929//     console.log("成功抓取成功");
930    if (searchKeyword.trim() !== '') {
931      window.dataLayer = window.dataLayer || [];
932      window.dataLayer.push({ ecommerce: null });
933      window.dataLayer.push({
934          event: "GaEvent",
935          custom_label: "Search",
936          ecommerce: {
937              keyword: searchKeyword,
938          },
939      });
940  }
941  
942};
943//Login(登入會員)
944let Loginevent = (e) => {
945//   console.log("登入事件啟動");
946  
947
948  var userEmail = UserData.email;
949  var userPhone = UserData.phone;
950  window.dataLayer = window.dataLayer || [];
951  window.dataLayer.push({ ecommerce: null });
952  window.dataLayer.push({
953    event: "GaEvent",
954    custom_label: "Login",
955    ecommerce: {
956      user_id: MemXmlID || "anonymous", //使用者編號
957      email: userEmail || null, //sha 256 加密信箱
958      phone: userPhone || null, //sha 256 加密行動電話
959    },
960  });
961};
962//CompleteRegistration (註冊成功)
963let CompleteRegistration = (e) => {
964//   console.log("註冊事件啟動");
965  
966//   if (userEmail === "c9500d049d3fea8011f17920625078611b7d86d652cad53a5cfb218148c02d1d") {
967//     userEmail = "";
968// }
969let emptyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
970if (userPhone === emptyHash) {
971  userPhone = "";
972}
973// console.log("userPhone",userPhone);
974  window.dataLayer = window.dataLayer || [];
975  window.dataLayer.push({ ecommerce: null });
976  window.dataLayer.push({
977    event: "GaEvent",
978    custom_label: "CompleteRegistration",
979    ecommerce: {
980      // user_id: MemXmlID || "anonymous", //使用者編號
981      email: userEmail || null, //sha 256 加密信箱
982      // phone: userPhone || '', //sha 256 加密行動電話
983    },
984  });
985};
986//ScrollDepth(瀏覽深度)觸發條件:在任ㄧ頁面,瀏覽深度百分之 25,50,75,95 時,分別觸發
987// let ScrollDepthEvent = (e) => {
988//   let pushCount = 0;
989//   let ScrollDepthEvent = (depth) => {
990//     console.log("瀏覽深度");
991//     window.dataLayer = window.dataLayer || [];
992//     window.dataLayer.push({ ecommerce: null });
993//     window.dataLayer.push({
994//       event: "GaEvent",
995//       custom_label: "ScrollDepth",
996//       ecommerce: {
997//         depth: depth.toString(),
998//       },
999//     });
1000//   };
1001
1002//   // 添加滾動事件監聽器
1003//   window.addEventListener("scroll", () => {
1004//     const scrollPercentage =
1005//       ((document.documentElement.scrollTop + window.innerHeight) /
1006//         document.documentElement.scrollHeight) *
1007//       100;
1008
1009    
1010//     if (scrollPercentage >= 95 && pushCount < 1) {
1011//       ScrollDepthEvent(95);
1012//       pushCount++;
1013//     } else if (scrollPercentage >= 75 && pushCount < 1) {
1014//       ScrollDepthEvent(75);
1015//       pushCount++;
1016//     } else if (scrollPercentage >= 50 && pushCount < 1) {
1017//       ScrollDepthEvent(50);
1018//       pushCount++;
1019//     } else if (scrollPercentage >= 25 && pushCount < 1) {
1020//       ScrollDepthEvent(25);
1021//       pushCount++;
1022//     }
1023//   });
1024// };
1025let ScrollDepthEvent = () => {
1026  let depthsTriggered = { 25: false, 50: false, 75: false, 95: false };
1027  let ScrollDepthEvent = (depth) => {
1028    // console.log("瀏覽深度: " + depth);
1029    window.dataLayer = window.dataLayer || [];
1030    window.dataLayer.push({ ecommerce: null });
1031    window.dataLayer.push({
1032      event: "GaEvent",
1033      custom_label: "ScrollDepth",
1034      ecommerce: {
1035        depth: depth.toString(),
1036      },
1037    });
1038  };
1039
1040  // 添加滾動事件監聽器
1041  window.addEventListener("scroll", () => {
1042    const scrollPercentage =
1043      ((document.documentElement.scrollTop + window.innerHeight) /
1044        document.documentElement.scrollHeight) *
1045      100;
1046
1047    if (scrollPercentage >= 95 && !depthsTriggered[95]) {
1048      ScrollDepthEvent(95);
1049      depthsTriggered[95] = true;
1050    } else if (scrollPercentage >= 75 && !depthsTriggered[75]) {
1051      ScrollDepthEvent(75);
1052      depthsTriggered[75] = true;
1053    } else if (scrollPercentage >= 50 && !depthsTriggered[50]) {
1054      ScrollDepthEvent(50);
1055      depthsTriggered[50] = true;
1056    } else if (scrollPercentage >= 25 && !depthsTriggered[25]) {
1057      ScrollDepthEvent(25);
1058      depthsTriggered[25] = true;
1059    }
1060  });
1061};
1062//進入條件狀態
1063var pageActions = {
1064  prdinfoview: prdinfoview, //監聽按鈕產品頁 觀看者資訊
1065  Purchaseinfo: Purchaseinfo, //結帳完成
1066  InitiateCheckout: InitiateCheckout, //開始結帳
1067  AddPaymentInfo: AddPaymentInfo, //填寫付款資訊
1068  Loginevent: Loginevent, //登入事件
1069  CompleteRegistration: CompleteRegistration, //註冊事件
1070  ScrollDepth: ScrollDepthEvent,
1071  customerService:customerService,//客服中心
1072
1073  // "Searchevent": Searchevent,//填寫付款資訊
1074  // "Leadinfo": Leadinfo //補貨頁面
1075};
1076
1077// $(document).ready(function() {
1078//     // 获取当前页面并执行相应操作
1079//     console.log("成功執行判斷getCurrentPage前導是");
1080//     var currentPage = getCurrentPage();
1081//     if (pageActions[currentPage]) {
1082//         pageActions[currentPage]();
1083//     }
1084// });
1085
1086var us_ddMonitoring_ = () => {
1087  $(document).on("click", ".faveaddcart", addToCartwish); //心願清單
1088  // $(document).on("click", ".AddBtn", addToCart);
1089  // $(document).on("click", ".PrdBtn", addToCartprdinfo); //監聽按鈕產品頁 加入購物車
1090  $(document).on("click", ".SaleBtn1, .SaleBtn2, .SaleBtn2", addToCartprdinfo); //監聽按鈕產品頁 加入購物車修改版
1091  
1092  $(document).on("click", ".addCartBtn", addToCartprdlist); //監聽產品目錄頁 加入購物車
1093  // $(document).on("click", ".addCartBtn", addToCartprdinterest);//產品興趣
1094  $(document).on("click", ".FaveBtn .cssPrdInfoFave", addToWishprdlist); //產品目錄頁加興趣
1095  $(document).on("click", ".c5PrdInfoFave .cssPrdInfoFave", addToWishprdinfo); //產品資訊頁加興趣
1096  $(document).on("click", ".stockBtn", Leadinfo);//產品頁補貨
1097  $(document).on("click", ".slAddCart", addTointerestCartprdinfo); //產品頁你可能有興趣加入購物車
1098  $(document).on("click", ".historyAddCart", historyAddCartevent); //產品頁瀏覽紀錄加入購物車
1099  $(document).on("click", ".customerInfo", customerService); //客服中心
1100//   $(".searchInputBox").on('input', function() {
1101//     Searchevent(); // 每當輸入框的內容變化時,就調用 Searchevent 函數
1102// });
1103  // $(document).on("click", ".search-input",  Searchevent); //收尋頁面
1104  $(document).trigger("Searchevent");
1105  Searchevent();
1106  ScrollDepthEvent();
1107  // 根據當前頁面動態調用相應的函數
1108  var currentPage = getCurrentPage(); // 此處假設有一個函數可以獲取當前頁面的名稱
1109  if (pageActions[currentPage]) {
1110    pageActions[currentPage]();
1111  }
1112};
1113//頁面判斷邏輯
1114
1115// function getCurrentPage() {
1116//   console.log("成功執行頁面判斷");
1117//   var currentUrl = window.location.href;
1118
1119//   // 檢查是否為 prdinfoview 頁面
1120//   var prdInfoMatch = currentUrl.match(
1121//     /https:\/\/www\.npmshops\.com\/mainssl\/modules\/MySpace\/PrdInfo\.php\?sn=shop&prd=(\d+)/
1122//   );
1123
1124//   if (prdInfoMatch) {
1125//     console.log("成功觸發prdInfoMatch");
1126//     return "prdinfoview";
1127//   }
1128
1129//   // 檢查是否為 Purchaseinfo 頁面
1130//   if (currentUrl.indexOf("ShopFinish") !== -1) {
1131//     console.log("成功觸發Purchaseinfo");
1132//     return "Purchaseinfo";
1133//   }
1134//   // 檢查是否為 InitiateCheckout 開始結帳頁面
1135//   if (
1136//     currentUrl.indexOf(
1137//       "https://www.npmshops.com/mainssl/modules/MeOrderInfo/index.php?sn=shop"
1138//     ) !== -1
1139//   ) {
1140//     console.log("成功觸發 InitiateCheckout");
1141//     return "InitiateCheckout";
1142//   }
1143//   // 檢查是否為 Loginevent 登入頁面
1144//   if (
1145//     currentUrl.includes(
1146//       "https://www.npmshops.com/mainssl/modules/MeMemberInfo/index.php?sn=shop&content=LoginWelcome"
1147//     ) ||
1148//     currentUrl.includes(
1149//       "https://www.npmshops.com/mainssl/modules/MeMemberInfo/index.php?sn=shop&content=RegForm"
1150//     ) ||
1151//     currentUrl.includes(
1152//       "https://www.npmshops.com/mainssl/modules/MeOrderInfo/index.php?sn=shop&content=ShopOrder"
1153//     )
1154//   ) {
1155//     console.log("成功觸發 Loginevent");
1156//     return "Loginevent";
1157//   }
1158//   // 檢查是否為 AddPaymentInfo 頁面
1159//   if (
1160//     currentUrl.indexOf(
1161//       "https://www.npmshops.com/mainssl/modules/MeOrderInfo/index.php?sn=shop&content=ShopOrder"
1162//     ) !== -1
1163//   ) {
1164//     console.log("成功觸發 AddPaymentInfo ");
1165
1166//     return ["AddPaymentInfo", "Loginevent"];
1167//   }
1168//   //檢查CompleteRegistration 頁面
1169  // if (
1170  //   currentUrl.indexOf(
1171  //     "https://www.npmshops.com/mainssl/modules/MeMemberInfo/index.php?sn=shop&content=CfmEmail"
1172  //   ) !== -1
1173  // ) {
1174  //   console.log("成功觸發 CompleteRegistration頁面 ");
1175
1176  //   return "CompleteRegistration";
1177  // }
1178
1179//   return "";
1180// }
1181function getCurrentPage() {
1182
1183//   console.log("成功執行頁面判斷");
1184  var currentUrl = window.location.href;
1185   var userEmail = UserData.email;
1186//    console.log("使用者mail",userEmail);
1187  // 檢查是否為 prdinfoview 頁面
1188  var prdInfoMatch = currentUrl.match(
1189    /https:\/\/www\.npmshops\.com\/mainssl\/modules\/MySpace\/PrdInfo\.php\?sn=shop&(prd|pc)=(\w+)/
1190  );
1191  if (prdInfoMatch) {
1192    // console.log("成功觸發prdInfoMatch");
1193    return "prdinfoview";
1194  }
1195//檢查CompleteRegistration 註冊事件改為在二步驟mail頁面進行
1196if (currentUrl.match(/MeMemberInfo\/index\.php\?sn=shop&content=CfmEmail(?!ChkCode)/)) {
1197//   console.log("成功觸發 CompleteRegistration");
1198  return "CompleteRegistration";
1199}
1200// if (currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=RegForm") && userEmail == "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855") {
1201//   console.log("成功觸發 CompleteRegistration");
1202//   return "CompleteRegistration";
1203// }
1204  // 檢查是否為 Purchaseinfo 頁面
1205  if (currentUrl.indexOf("ShopFinish") !== -1) {
1206    // console.log("成功觸發Purchaseinfo");
1207    return "Purchaseinfo";
1208  }
1209
1210  // 先檢查是否為 AddPaymentInfo 頁面,因為它的URL結構更具體
1211  if (currentUrl.includes("MeOrderInfo/index.php?sn=shop&content=ShopOrder")) {
1212    // console.log("成功觸發 AddPaymentInfo");
1213    return "AddPaymentInfo";
1214  }
1215
1216  // 檢查是否為 InitiateCheckout 開始結帳頁面,此處已經排除了 AddPaymentInfo 的情況
1217  if (currentUrl.includes("MeOrderInfo/index.php?sn=shop")) {
1218    // console.log("成功觸發 InitiateCheckout");
1219    return "InitiateCheckout";
1220  }
1221 
1222  // 檢查是否為 Loginevent 登入頁面
1223  if (currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=LoginWelcome") ||
1224  currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=RegForm") ||
1225  currentUrl.includes("MeOrderInfo/index.php?sn=shop&content=ShopOrder")
1226  ) {
1227//   console.log("成功觸發 Loginevent");
1228  return "Loginevent";
1229}
1230
1231  
1232 //檢查customerService 頁面
1233//  if (currentUrl.includes("modules/MySpace/index.php?sn=shop&pg=ZC704")) {
1234//   console.log("成功觸發 customerService");
1235//   return "customerService";
1236// }
1237
1238  return "";
1239}
1240// document.addEventListener("DOMContentLoaded", function() {
1241//   var currentUrl = window.location.href;
1242//   if (currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=LoginWelcome") ||
1243//       currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=RegForm") ||
1244//       currentUrl.includes("MeOrderInfo/index.php?sn=shop&content=ShopOrder")) {
1245
1246//       console.log("成功觸發 Loginevent直接監聽");
1247//       return "Loginevent";
1248//   }
1249// });
1250document.addEventListener("DOMContentLoaded", function() {
1251  var currentUrl = window.location.href;
1252  if (currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=LoginWelcome") ||
1253      currentUrl.includes("MeMemberInfo/index.php?sn=shop&content=RegForm") ||
1254      currentUrl.includes("MeOrderInfo/index.php?sn=shop&content=ShopOrder") ) { 
1255    //   console.log("成功觸發 Loginevent直接監聽");
1256      return "Loginevent";
1257  }
1258});
1259

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.