majro update
This commit is contained in:
+4
-2
@@ -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>"
|
||||
]
|
||||
}
|
||||
}
|
||||
+32
@@ -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;
|
||||
}
|
||||
});
|
||||
+21
@@ -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>"
|
||||
]
|
||||
}
|
||||
Vendored
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../../../../../javascript/readability/dist/readability.min.js
|
||||
Reference in New Issue
Block a user