Skip to content

Commit

Permalink
A few bits copied from beastify example. Does not work.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyestein committed Dec 26, 2023
0 parents commit 6708187
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
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>

Binary file added icons/wine32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/wine512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/wine64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions main.js
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"});
});
24 changes: 24 additions & 0 deletions manifest.json
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"
}

}


25 changes: 25 additions & 0 deletions menu/actions.html
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>

23 changes: 23 additions & 0 deletions menu/links.js
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);
});

0 comments on commit 6708187

Please sign in to comment.