Last active
March 30, 2023 15:25
-
-
Save fergusKe/e923027c2973963919d32b08d6780ac3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 至少有一個字元 | |
.+ | |
// 判斷首頁 | |
\/(index\.html)?$ | |
// 符合 /a_myday/ 或 /a_myday/index.php | |
^\/a_myday/(index.php)?$ | |
// 符合 / 或 /ecshop/ | |
^\/(ecshop\/?)?$ | |
// 在下面兩個網址都會觸發 | |
// https://www.myday.com.tw/a_myday/news_content.php?id=1725 | |
// http://tw.myday.com.tw/a_myday/news_content.php?id=1725 | |
https?://(www|tw)\.myday\.com\.tw/a_myday/news_content.php\?id=1725 | |
// 數字結尾 | |
// https://studiodoe.com/account/orders/199405 | |
\/products\/[0-9]*$ | |
// 修改 dataLayer 產品的分類名稱 | |
// 空格的部分改成 / | |
ecommerce.checkout.products.forEach(function(item){ | |
item.category = item.category.replace(/\s+/g, '/'); | |
}); | |
purchase.products.forEach(function(item){ | |
item.category = item.category.replace(/\s+/g, '/'); | |
}); | |
// 合計: NT$259 | |
// 取得數字部分, 256 | |
var revenue = parseInt($('h3.summary-header').text().replace(/\D/g, '')); | |
// 訂單號碼 2018112306490583 | |
// 取得訂單編號後面的號碼, 2018112306490583 | |
var id = $('.confirm-message').text().match(/訂單號碼 (\d+)/)[1]; | |
// 匹配 /orders/ 後面有 confirm | |
// https://www.jtlegend.com.tw/orders/5bf7a2e2d8af7d00121475a6/confirm?authorization_token=CyGF-o1-qup3XpRZ9zuEmA | |
\/orders\/.+confirm | |
// 找出不包含 / 的項目 (category 後面可以接?或什麼都不接) | |
// /category?sortby=new&brandselect= | |
// /category | |
// /category/1_3/月拋 | |
// --------------- | |
// \/category[^/] | |
// 'category?ver'.match(/category([^\/]+|$)/) | |
// /category([^\/]+|$)/ | |
// /category([^\/]?\?|$)/ | |
// /category(\??|$)/ | |
// /category(\?|$)/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment