majro update

This commit is contained in:
Fabian Freund
2025-02-28 14:30:49 +01:00
parent a8957f6cf8
commit 3c4d479bd9
181 changed files with 7090 additions and 5299 deletions
@@ -9,7 +9,9 @@
"version": "1.0",
"content_scripts": [
{
"matches": ["<all_urls>"],
"matches": [
"<all_urls>"
],
"js": [
"readability.min.js",
"content.js"
@@ -26,4 +28,4 @@
"webNavigation",
"<all_urls>"
]
}
}
@@ -0,0 +1,32 @@
const port = browser.runtime.connectNative("mozacTurndownHtml");
const parser = new DOMParser();
port.onMessage.addListener(message => {
let requestId = message["id"];
switch (message["action"]) {
case "turndown":
console.log(message.args)
// Handle array of HTML strings
if (Array.isArray(message.args)) {
const results = message.args.map(htmlString => {
const document = parser.parseFromString(htmlString, 'text/html');
return parseFullMarkdown(document);
});
port.postMessage({
"id": requestId,
"status": "success",
"result": results
});
} else {
// Handle error case for invalid input
port.postMessage({
"id": requestId,
"status": "error",
"error": "Expected args to be an array of HTML strings"
});
}
break;
}
});
@@ -0,0 +1,21 @@
{
"manifest_version": 2,
"browser_specific_settings": {
"gecko": {
"id": "turndown@movenext.me"
}
},
"name": "Converts html to markdown",
"version": "1.0",
"background": {
"scripts": [
"readability.min.js",
"background.js"
]
},
"permissions": [
"geckoViewAddons",
"nativeMessaging",
"<all_urls>"
]
}
@@ -0,0 +1 @@
../../../../../../javascript/readability/dist/readability.min.js