-
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.
A few bits copied from beastify example. Does not work.
- Loading branch information
0 parents
commit 6708187
Showing
8 changed files
with
90 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,6 @@ | ||
# Attributions | ||
|
||
For https://www.flaticon.com/free-icon/wine_4698198?term=wine&related_id=4698198 | ||
|
||
<a href="https://www.flaticon.com/free-icons/wine" title="wine icons">Wine icons created by iconixar - Flaticon</a> | ||
|
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,12 @@ | ||
"use strict"; | ||
document.body.style.border = "5px solid #ff0080"; | ||
//alert("The test extension is up and running"); | ||
console.log('main.js says hello'); | ||
|
||
|
||
browser.runtime.onMessage.addListener(request => { | ||
document.body.style.border = "15px solid #ff0080"; | ||
console.log("Message from the background script:"); | ||
console.log(request.greeting); | ||
return Promise.resolve({response: "Hi from content script"}); | ||
}); |
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,24 @@ | ||
{ | ||
"manifest_version":2, | ||
"version":"1.0", | ||
"name":"Wine Society link extractor", | ||
"description": "Extracts tabular data from shopping basket, wishlist, etc", | ||
"icons": { | ||
"64": "icons/wine64.png", | ||
"32": "icons/wine32.png" | ||
}, | ||
"content_scripts":[ | ||
{ | ||
"matches":["https://*.thewinesociety.com/*"], | ||
"js":["main.js"] | ||
} | ||
], | ||
"browser_action": { | ||
"default_icon": "icons/wine32.png", | ||
"default_title": "Beastify", | ||
"default_popup": "menu/actions.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,25 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
</head> | ||
|
||
<body> | ||
<div id="popup-content"> | ||
<button>Frog</button> | ||
<button>Turtle</button> | ||
<button>Snake</button> | ||
<button type="reset">Reset</button> | ||
</div> | ||
<div id="error-content" class="hidden"> | ||
<p>Can't beastify this web page.</p><p>Try a different page.</p> | ||
</div> | ||
<div id="link-list"> | ||
<p>default content</p> | ||
</div> | ||
<script src="links.js"></script> | ||
</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,23 @@ | ||
"use strict"; | ||
console.log('links.js says hello'); | ||
function onError(error) { | ||
console.error(`Error: ${error}`); | ||
} | ||
function sendMessageToTabs(tabs) { | ||
for (let tab of tabs) { | ||
browser.tabs.sendMessage( | ||
tab.id, | ||
{greeting: "Hi from background script"} | ||
).then(response => { | ||
console.log("Message from the content script:"); | ||
console.log(response.response); | ||
}).catch(onError); | ||
} | ||
} | ||
browser.browserAction.onClicked.addListener(() => { | ||
browser.tabs.query({ | ||
currentWindow: true, | ||
active: true | ||
}).then(sendMessageToTabs).catch(onError); | ||
}); | ||
|