-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes: - Created a folder named Firefox (for the Firefox version) - Modified progressbar.js (added polyfill for window.requestAnimationFrame because the API is unavailable in Firefox) - Modified manifest.json (rolled back to Manifest version 2 because of CORS issues and explicit permission issues, this is not an issue in Firefox as it is still properly supported, changed back from "host_permissions" to "permissions", added background page) - Created background.html to include all the Javascript files that will run in the background (order of the import matters) - Modified background.js to remove importScripts() (this is not supported in background pages in Firefox)
- Loading branch information
Showing
17 changed files
with
2,848 additions
and
2,387 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../AmznHistoricChart/AmazonIcon128.png |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../AmznHistoricChart/AmazonIcon32.png |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../AmznHistoricChart/AmazonIcon48.png |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../AmznHistoricChart/AmazonIcon64.png |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../AmznHistoricChart/AmazonIcon96.png |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../AmznHistoricChart/LICENSE_lrumap.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../AmznHistoricChart/LICENSE_progressbar.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../AmznHistoricChart/amazon.user.js |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../AmznHistoricChart/amazonccc.js |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../AmznHistoricChart/amazonfs.js |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<script src="lru.js"></script> | ||
<script src="amazonccc.js"></script> | ||
<script src="amazonfs.js"></script> | ||
<script src="background.js"></script> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* Possible parameters for request: | ||
* action: "xhttp" for a cross-origin HTTP request | ||
* method: Default "GET" | ||
* url : required, but not validated | ||
* data : data to send in a POST request | ||
* From http://stackoverflow.com/a/7699773/277601 | ||
* The callback function is called upon completion of the request | ||
* NOTE: If you want to have some back-and-forths between the content script and background page, | ||
* use chrome.runtime.connect and chrome.runtime.onConnect instead of sendMessage/onMessage | ||
* */ | ||
chrome.runtime.onMessage.addListener(function (request, sender, callback) { | ||
// console.log("Starting Step 0: " + request.action); | ||
if (request.action == "fakespot_xhttp") { | ||
amazonfs.triage(request.url, callback); | ||
return true; // prevents the callback from being called too early on return | ||
} else if (request.action == "fakespot_clearcache") { | ||
amazonfs.clearCache(request.url); | ||
return true; // prevents the callback from being called too early on return | ||
} else if (request.action == "amazonccc_xhttp") { | ||
amazonccc.triage(request.asin, callback); | ||
return true; // prevents the callback from being called too early on return | ||
} else if (request.action == "camelimage_xhttp") { | ||
amazoncamel.loadImageData(request, callback); | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
}); | ||
|
||
const amazoncamel = (() => { | ||
// Refactored loadImageData without DOM | ||
loadImageData = async (request, callback) => { | ||
try { | ||
const response = await fetch(request.url); | ||
const blob = await response.blob(); | ||
const reader = new FileReader(); | ||
reader.readAsDataURL(blob); | ||
reader.onloadend = () => { | ||
const dataURL = reader.result; | ||
callback(dataURL); | ||
}; | ||
} catch (err) { | ||
console.error("Error fetching image:", error); | ||
callback( | ||
"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==" | ||
); | ||
// Handle errors appropriately, e.g., call the callback with an error message | ||
} | ||
}; | ||
return { | ||
loadImageData, | ||
}; | ||
})(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../AmznHistoricChart/jquery-2.1.4.min.js |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../AmznHistoricChart/lru.js |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"name": "Historic Price Shopper: Amazon Price Tracking", | ||
"version": "0.51", | ||
"manifest_version": 2, | ||
"description": "Adds Amazon.com historical price graph above the 'Add To Cart' button so you can monitor if it's a good time to buy.", | ||
"icons": { | ||
"128": "AmazonIcon128.png", | ||
"96": "AmazonIcon96.png", | ||
"64": "AmazonIcon64.png", | ||
"48": "AmazonIcon48.png", | ||
"32": "AmazonIcon32.png" | ||
}, | ||
"background": { | ||
"page": "background.html" | ||
}, | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"https://www.amazon.com/*", | ||
"https://smile.amazon.com/*", | ||
"https://amazon.com/*", | ||
"https://www.amazon.ca/*", | ||
"https://amazon.ca/*", | ||
"https://www.amazon.co.uk/*", | ||
"https://amazon.co.uk/*" | ||
], | ||
"js": [ | ||
"jquery-2.1.4.min.js", | ||
"lru.js", | ||
"amazonfs.js", | ||
"progressbar.js", | ||
"amazon.user.js", | ||
"amazonccc.js" | ||
] | ||
} | ||
], | ||
"permissions": [ | ||
"webRequest", | ||
"webRequestBlocking", | ||
"http://fakespot.com/", | ||
"http://*.fakespot.com/", | ||
"https://fakespot.com/", | ||
"https://*.fakespot.com/", | ||
"http://camelcamelcamel.com/", | ||
"http://*.camelcamelcamel.com/", | ||
"https://camelcamelcamel.com/", | ||
"https://*.camelcamelcamel.com/" | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../AmznHistoricChart/progressbar.js |