Initial Commit
10
Shared (Extension)/Resources/_locales/en/messages.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extension_name": {
|
||||
"message": "nostore",
|
||||
"description": "The display name for the extension."
|
||||
},
|
||||
"extension_description": {
|
||||
"message": "This is nostore. You should tell us what your extension does here.",
|
||||
"description": "Description of what the extension does."
|
||||
}
|
||||
}
|
||||
6
Shared (Extension)/Resources/background.js
Normal file
@@ -0,0 +1,6 @@
|
||||
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
console.log("Received request: ", request);
|
||||
|
||||
if (request.greeting === "hello")
|
||||
sendResponse({ farewell: "goodbye" });
|
||||
});
|
||||
7
Shared (Extension)/Resources/content.js
Normal file
@@ -0,0 +1,7 @@
|
||||
browser.runtime.sendMessage({ greeting: "hello" }).then((response) => {
|
||||
console.log("Received response: ", response);
|
||||
});
|
||||
|
||||
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
console.log("Received request: ", request);
|
||||
});
|
||||
BIN
Shared (Extension)/Resources/images/icon-128.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
Shared (Extension)/Resources/images/icon-256.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
Shared (Extension)/Resources/images/icon-48.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
Shared (Extension)/Resources/images/icon-512.png
Normal file
|
After Width: | Height: | Size: 128 KiB |
BIN
Shared (Extension)/Resources/images/icon-64.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
Shared (Extension)/Resources/images/icon-96.png
Normal file
|
After Width: | Height: | Size: 9.5 KiB |
BIN
Shared (Extension)/Resources/images/toolbar-icon-16.png
Normal file
|
After Width: | Height: | Size: 454 B |
BIN
Shared (Extension)/Resources/images/toolbar-icon-19.png
Normal file
|
After Width: | Height: | Size: 569 B |
BIN
Shared (Extension)/Resources/images/toolbar-icon-32.png
Normal file
|
After Width: | Height: | Size: 919 B |
BIN
Shared (Extension)/Resources/images/toolbar-icon-38.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
Shared (Extension)/Resources/images/toolbar-icon-48.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Shared (Extension)/Resources/images/toolbar-icon-72.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
39
Shared (Extension)/Resources/manifest.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"default_locale": "en",
|
||||
|
||||
"name": "__MSG_extension_name__",
|
||||
"description": "__MSG_extension_description__",
|
||||
"version": "1.0",
|
||||
|
||||
"icons": {
|
||||
"48": "images/icon-48.png",
|
||||
"96": "images/icon-96.png",
|
||||
"128": "images/icon-128.png",
|
||||
"256": "images/icon-256.png",
|
||||
"512": "images/icon-512.png"
|
||||
},
|
||||
|
||||
"background": {
|
||||
"service_worker": "background.js"
|
||||
},
|
||||
|
||||
"content_scripts": [{
|
||||
"js": [ "content.js" ],
|
||||
"matches": [ "*://example.com/*" ]
|
||||
}],
|
||||
|
||||
"action": {
|
||||
"default_popup": "popup.html",
|
||||
"default_icon": {
|
||||
"16": "images/toolbar-icon-16.png",
|
||||
"19": "images/toolbar-icon-19.png",
|
||||
"32": "images/toolbar-icon-32.png",
|
||||
"38": "images/toolbar-icon-38.png",
|
||||
"48": "images/toolbar-icon-48.png",
|
||||
"72": "images/toolbar-icon-72.png"
|
||||
}
|
||||
},
|
||||
|
||||
"permissions": [ ]
|
||||
}
|
||||
15
Shared (Extension)/Resources/popup.css
Normal file
@@ -0,0 +1,15 @@
|
||||
:root {
|
||||
color-scheme: light dark;
|
||||
}
|
||||
|
||||
body {
|
||||
width: 100px;
|
||||
padding: 10px;
|
||||
|
||||
font-family: system-ui;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
/* Dark Mode styles go here. */
|
||||
}
|
||||
11
Shared (Extension)/Resources/popup.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="popup.css">
|
||||
<script type="module" src="popup.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<strong>Hello World!</strong>
|
||||
</body>
|
||||
</html>
|
||||
1
Shared (Extension)/Resources/popup.js
Normal file
@@ -0,0 +1 @@
|
||||
console.log("Hello World!", browser);
|
||||
26
Shared (Extension)/SafariWebExtensionHandler.swift
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// SafariWebExtensionHandler.swift
|
||||
// Shared (Extension)
|
||||
//
|
||||
// Created by Ryan Breen on 1/11/23.
|
||||
//
|
||||
|
||||
import SafariServices
|
||||
import os.log
|
||||
|
||||
let SFExtensionMessageKey = "message"
|
||||
|
||||
class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling {
|
||||
|
||||
func beginRequest(with context: NSExtensionContext) {
|
||||
let item = context.inputItems[0] as! NSExtensionItem
|
||||
let message = item.userInfo?[SFExtensionMessageKey]
|
||||
os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@", message as! CVarArg)
|
||||
|
||||
let response = NSExtensionItem()
|
||||
response.userInfo = [ SFExtensionMessageKey: [ "Response to": message ] ]
|
||||
|
||||
context.completeRequest(returningItems: [response], completionHandler: nil)
|
||||
}
|
||||
|
||||
}
|
||||