Skip to content

Commit

Permalink
Resolves #1. Made sure to use text and val jquery functions to set th…
Browse files Browse the repository at this point in the history
…ings to avoid problems with characters in the nicknames.
  • Loading branch information
pip8786 committed Jan 2, 2017
1 parent a4a3207 commit 4ca70f6
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 33 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
extension.pem
extension.crx
**/key.pem
**/extension.crx
**/extension.zip
59 changes: 30 additions & 29 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion extension/src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ function updateNicknames() {
function appendNickname() {
const ccnum = CryptoJS.SHA256($(this).text().match(regex)[1]);
if(nicknames[ccnum] != undefined) {
$(this).append("<span class='cc_nickname'> - "+nicknames[ccnum]+"</span>");
const node = $("<span class='cc_nickname'></span>").text(" - "+nicknames[ccnum]);
$(this).append(node);
}
}

Expand Down
3 changes: 2 additions & 1 deletion extension/src/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = $("<input type='text' id='card"+ccHash+"' value='"+oldValue+"' placeholder='Nickname'/>");
const input = $("<input type='text' id='card"+ccHash+"' placeholder='Nickname'/>");
input.val(oldValue);
let node = $("<div><span>"+item+"</span> </div>").append(input);
input.change(()=>{
nicknames[ccHash] = input.val();
Expand Down

0 comments on commit 4ca70f6

Please sign in to comment.