-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8a63c73
Showing
10 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
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,21 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
|
||
[*] | ||
|
||
# Change these settings to your own preference | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# We recommend you to keep these unchanged | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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 @@ | ||
.idea |
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 @@ | ||
{} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,35 @@ | ||
{ | ||
"name": "amazon smile switcher", | ||
"version": "1.0.0", | ||
"manifest_version": 2, | ||
"description": "Switch from amazon.de to smile.amazon.de", | ||
"homepage_url": "https://www.amazon.de/", | ||
"icons": { | ||
"16": "icons/icon16.png", | ||
"19": "icons/icon19.png", | ||
"48": "icons/icon48.png", | ||
"128": "icons/icon128.png" | ||
}, | ||
"default_locale": "en", | ||
"background": { | ||
"scripts": [ | ||
"src/bg/background.js" | ||
], | ||
"persistent": true | ||
}, | ||
"permissions": [ | ||
"notifications", | ||
"tabs", | ||
"https://www.amazon.de/*" | ||
], | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"https://www.amazon.de/*" | ||
], | ||
"js": [ | ||
"src/inject/inject.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 @@ | ||
chrome.extension.onMessage.addListener(({ href }, sender, sendResponse) => { | ||
const switchToSmile = !/smile\.amazon\.de/.test(href); | ||
if (switchToSmile) { | ||
chrome.notifications.create('switch-to-smile-' + Date.now(), { | ||
type: 'basic', | ||
iconUrl: 'icons/icon128.png', | ||
title: 'amazon.de', | ||
message: 'Switched from amazon to smile.amazon' | ||
}, (notificationId) => {}); | ||
} | ||
sendResponse({ switchToSmile }); | ||
}); |
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,7 @@ | ||
const { href } = window.location; | ||
|
||
chrome.extension.sendMessage({ href }, ({ switchToSmile }) => { | ||
if (switchToSmile) { | ||
window.location.href = href.replace('www.amazon.de', 'smile.amazon.de'); | ||
} | ||
}); |