From 4ca70f6855dbfc182a3d0dfc05957e0fdb61ebd9 Mon Sep 17 00:00:00 2001 From: Philippe Sabourin Date: Sun, 1 Jan 2017 20:55:33 -0500 Subject: [PATCH] Resolves #1. Made sure to use text and val jquery functions to set things to avoid problems with characters in the nicknames. --- .gitignore | 5 ++-- .idea/workspace.xml | 59 ++++++++++++++++++++-------------------- extension/manifest.json | 1 + extension/src/content.js | 3 +- extension/src/popup.js | 3 +- 5 files changed, 38 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index e5751f4..625b55c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -extension.pem -extension.crx +**/key.pem +**/extension.crx +**/extension.zip diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 05b85d1..c9623ed 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -16,11 +16,11 @@ - + - - + + @@ -29,8 +29,8 @@ - - + + @@ -38,11 +38,11 @@ - + - - + + @@ -95,8 +95,9 @@ @@ -117,9 +118,9 @@ - @@ -242,11 +243,11 @@ + - @@ -857,16 +858,16 @@ - - - + + @@ -882,7 +883,7 @@ - + @@ -931,10 +932,18 @@ + + + + + + + + - - + + @@ -943,16 +952,8 @@ - - - - - - - - - - + + diff --git a/extension/manifest.json b/extension/manifest.json index 42eb85c..6b8e7b8 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -2,6 +2,7 @@ "manifest_version": 2, "name": "Credit Card Nicknames for Amazon", + "short_name" :"CCNA", "description": "This extension allows you to assign nick names to your credit cards on Amazon.com (US Only).", "version": "1.0", "icons": { diff --git a/extension/src/content.js b/extension/src/content.js index 0d84e72..851fce3 100644 --- a/extension/src/content.js +++ b/extension/src/content.js @@ -10,7 +10,8 @@ function updateNicknames() { function appendNickname() { const ccnum = CryptoJS.SHA256($(this).text().match(regex)[1]); if(nicknames[ccnum] != undefined) { - $(this).append(" - "+nicknames[ccnum]+""); + const node = $("").text(" - "+nicknames[ccnum]); + $(this).append(node); } } diff --git a/extension/src/popup.js b/extension/src/popup.js index 96ce8d4..b41fa22 100644 --- a/extension/src/popup.js +++ b/extension/src/popup.js @@ -63,7 +63,8 @@ chrome.runtime.onMessage.addListener(function(request, sender) { request.numbers.forEach((item) => { const ccHash = CryptoJS.SHA256(item); const oldValue = (nicknames[ccHash] != undefined) ? nicknames[ccHash] : ""; - const input = $(""); + const input = $(""); + input.val(oldValue); let node = $("
"+item+"
").append(input); input.change(()=>{ nicknames[ccHash] = input.val();