Skip to content

Commit

Permalink
Fixing some URL matching issues on non .com sites. Updated some jQuer…
Browse files Browse the repository at this point in the history
…y selectors to match new CSS from Amazon.
  • Loading branch information
pip8786 committed Apr 23, 2020
1 parent eeb4e86 commit 89aaa0f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ The extension can be found here: [Chrome Webstore](https://chrome.google.com/web
The extension does not store the 4 digit numbers of the credit card, instead using a hash to associate the nickname with the card number.

# Releases

## 1.0.6 (Apr 23rd, 2020)
- Fixed some issues with the URLs on non .com sites.
- Updated some jQuery selectors to match the new CSS from Amazon.

## 1.0.5 (Jan 20th, 2019)
- Fixed an issue with finding CCs on non english sites.

Expand Down
17 changes: 16 additions & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Credit Card Nicknames for Amazon",
"short_name" :"CCNA",
"description": "This extension allows you to assign nick names to your credit cards on Amazon - Now for any country - And includes Smile!",
"version": "1.0.5",
"version": "1.0.6",
"icons": {
"128": "images/ccna_icon128.png" },
"browser_action": {
Expand All @@ -15,90 +15,105 @@
"matches":[
"https://*.amazon.com/gp/wallet*",
"https://*.amazon.com/gp/buy/*",
"https://*.amazon.com/cpe/yourpayments/wallet*",
"https://*.amazon.com/cpe/managepaymentmethods*",
"https://*.amazon.com/asv/reload*",
"https://*.amazon.com/asv/autoreload*",

"https://*.amazon.co.uk/gp/wallet*",
"https://*.amazon.co.uk/gp/buy/*",
"https://*.amazon.co.uk/cpe/yourpayments/wallet*",
"https://*.amazon.co.uk/cpe/managepaymentmethods*",
"https://*.amazon.co.uk/asv/reload*",
"https://*.amazon.co.uk/asv/autoreload*",

"https://*.amazon.fr/gp/wallet*",
"https://*.amazon.fr/gp/buy/*",
"https://*.amazon.fr/cpe/yourpayments/wallet*",
"https://*.amazon.fr/cpe/managepaymentmethods*",
"https://*.amazon.fr/asv/reload*",
"https://*.amazon.fr/asv/autoreload*",

"https://*.amazon.cn/gp/wallet*",
"https://*.amazon.cn/gp/buy/*",
"https://*.amazon.cn/cpe/yourpayments/wallet*",
"https://*.amazon.cn/cpe/managepaymentmethods*",
"https://*.amazon.cn/asv/reload*",
"https://*.amazon.cn/asv/autoreload*",

"https://*.amazon.in/gp/wallet*",
"https://*.amazon.in/gp/buy/*",
"https://*.amazon.in/cpe/yourpayments/wallet*",
"https://*.amazon.in/cpe/managepaymentmethods*",
"https://*.amazon.in/asv/reload*",
"https://*.amazon.in/asv/autoreload*",

"https://*.amazon.co.jp/gp/wallet*",
"https://*.amazon.co.jp/gp/buy/*",
"https://*.amazon.co.jp/cpe/yourpayments/wallet*",
"https://*.amazon.co.jp/cpe/managepaymentmethods*",
"https://*.amazon.co.jp/asv/reload*",
"https://*.amazon.co.jp/asv/autoreload*",

"https://*.amazon.com.sg/gp/wallet*",
"https://*.amazon.com.sg/gp/buy/*",
"https://*.amazon.com.sg/cpe/yourpayments/wallet*",
"https://*.amazon.com.sg/cpe/managepaymentmethods*",
"https://*.amazon.com.sg/asv/reload*",
"https://*.amazon.com.sg/asv/autoreload*",

"https://*.amazon.de/gp/wallet*",
"https://*.amazon.de/gp/buy/*",
"https://*.amazon.de/cpe/yourpayments/wallet*",
"https://*.amazon.de/cpe/managepaymentmethods*",
"https://*.amazon.de/asv/reload*",
"https://*.amazon.de/asv/autoreload*",

"https://*.amazon.it/gp/wallet*",
"https://*.amazon.it/gp/buy/*",
"https://*.amazon.it/cpe/yourpayments/wallet*",
"https://*.amazon.it/cpe/managepaymentmethods*",
"https://*.amazon.it/asv/reload*",
"https://*.amazon.it/asv/autoreload*",

"https://*.amazon.nl/gp/wallet*",
"https://*.amazon.nl/gp/buy/*",
"https://*.amazon.nl/cpe/yourpayments/wallet*",
"https://*.amazon.nl/cpe/managepaymentmethods*",
"https://*.amazon.nl/asv/reload*",
"https://*.amazon.nl/asv/autoreload*",

"https://*.amazon.es/gp/wallet*",
"https://*.amazon.es/gp/buy/*",
"https://*.amazon.es/cpe/yourpayments/wallet*",
"https://*.amazon.es/cpe/managepaymentmethods*",
"https://*.amazon.es/asv/reload*",
"https://*.amazon.es/asv/autoreload*",

"https://*.amazon.ca/gp/wallet*",
"https://*.amazon.ca/gp/buy/*",
"https://*.amazon.ca/cpe/yourpayments/wallet*",
"https://*.amazon.ca/cpe/managepaymentmethods*",
"https://*.amazon.ca/asv/reload*",
"https://*.amazon.ca/asv/autoreload*",

"https://*.amazon.com.mx/gp/wallet*",
"https://*.amazon.com.mx/gp/buy/*",
"https://*.amazon.com.mx/cpe/yourpayments/wallet*",
"https://*.amazon.com.mx/cpe/managepaymentmethods*",
"https://*.amazon.com.mx/asv/reload*",
"https://*.amazon.com.mx/asv/autoreload*",

"https://*.amazon.au/gp/wallet*",
"https://*.amazon.au/gp/buy/*",
"https://*.amazon.au/cpe/yourpayments/wallet*",
"https://*.amazon.au/cpe/managepaymentmethods*",
"https://*.amazon.au/asv/reload*",
"https://*.amazon.au/asv/autoreload*",

"https://*.amazon.br/gp/wallet*",
"https://*.amazon.br/gp/buy/*",
"https://*.amazon.br/cpe/yourpayments/wallet*",
"https://*.amazon.br/cpe/managepaymentmethods*",
"https://*.amazon.br/asv/reload*",
"https://*.amazon.br/asv/autoreload*"
Expand Down
3 changes: 2 additions & 1 deletion extension/src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function updateNicknames() {
msobservers.initialize("#payment-information span.a-color-secondary", appendNickname);
msobservers.initialize(".pmts-instrument-box span.a-color-secondary", appendNickname);
msobservers.initialize(".pmts-inst-tail", appendNickname);
msobservers.initialize(".pmts-cc-number", appendNickname);
});
}

Expand All @@ -81,7 +82,7 @@ function getCardNumbers(type) {
if (type === 1) {
selector = $(".pmts-instrument-number-tail");
} else if (type === 2) {
selector = $(".payment-row span.a-color-secondary");
selector = $(".pmts-cc-number");
} else if (type === 3) {
selector = $(".pmts-instrument-box span.a-color-secondary");
} else if (type === 4) {
Expand Down
3 changes: 2 additions & 1 deletion extension/src/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ chrome.runtime.onMessage.addListener(function(request, sender) {

const DOMAIN_REGEX = /^https:\/\/(smile|www)\.amazon\.[a-zA-Z.]{2,6}/;
const WALLET_REGEX = new RegExp(`${ DOMAIN_REGEX.source }/gp/wallet`);
const CPE_WALLET_REGEX = new RegExp(`${ DOMAIN_REGEX.source }/cpe/yourpayments/wallet`);
const BUY_REGEX = new RegExp(`${ DOMAIN_REGEX.source }/gp/buy`);
const PAYMENT_REGEX = new RegExp(`${ DOMAIN_REGEX.source }/cpe/managepaymentmethods`);
const ASV_AUTO_REGEX = new RegExp(`${ DOMAIN_REGEX.source }/asv/autoreload/`);
Expand All @@ -102,7 +103,7 @@ document.addEventListener('DOMContentLoaded', function () {
getCurrentTabUrl(function (url) {
let type = 0;

if (WALLET_REGEX.test(url) || PAYMENT_REGEX.test(url)) {
if (WALLET_REGEX.test(url) || PAYMENT_REGEX.test(url) || CPE_WALLET_REGEX.test(url)) {
type = 1;
} else if (BUY_REGEX.test(url)) {
type = 2;
Expand Down

0 comments on commit 89aaa0f

Please sign in to comment.