Finalize the version 0.1.1
This commit is contained in:
parent
1237c7741c
commit
c36dc9c164
|
@ -1,2 +1,3 @@
|
|||
*~
|
||||
node_modules/
|
||||
node_modules/
|
||||
web-ext-artifacts/
|
|
@ -0,0 +1,3 @@
|
|||
pack:
|
||||
rm ./*~ -rf
|
||||
zip -r -FS ../Daru.zip * --exclude '*.git*' --exclude 'Makefile' --exclude 'daru.zip'
|
|
@ -0,0 +1,25 @@
|
|||
"use strict";
|
||||
|
||||
function onError(error) {
|
||||
console.error(`Error: ${error}`);
|
||||
}
|
||||
|
||||
function sendMessageToTabs(tabs) {
|
||||
for (let tab of tabs) {
|
||||
browser.tabs.sendMessage(
|
||||
tab.id,
|
||||
{command: "bookmark"}
|
||||
).catch(onError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
browser.commands.onCommand.addListener(function (command) {
|
||||
if (command === "bookmark") {
|
||||
browser.tabs.query({
|
||||
currentWindow: true,
|
||||
active: true
|
||||
}).then(sendMessageToTabs).catch(onError);
|
||||
}
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
"use strict";
|
||||
|
||||
browser.runtime.onMessage.addListener(request => {
|
||||
if (request.command == "bookmark") {
|
||||
//const url = 'org-protocol://msg/?URL='+ encodeURIComponent(location.href)+'&TITLE='+ encodeURIComponent(document.title)+'&SELECTED='+ encodeURIComponent(window.getSelection());
|
||||
const url = `org-protocol://capture/?template=l&url=${encodeURIComponent(location.href)}&title=${encodeURIComponent(document.title)}&body=${encodeURIComponent(window.getSelection())}`;
|
||||
console.log("Sending to FG42. URL:", url);
|
||||
location.href = url;
|
||||
}
|
||||
return Promise.resolve({response: "done"});
|
||||
});
|
|
@ -2,15 +2,34 @@
|
|||
|
||||
"manifest_version": 2,
|
||||
"name": "Daru",
|
||||
"version": "0.1.0",
|
||||
|
||||
"version": "0.1.1",
|
||||
"description": "An extension to integrate FG42 with Firefox (Possibly, it can be used with any org-mode setup).",
|
||||
|
||||
|
||||
"background": {
|
||||
"scripts": ["background.js"]
|
||||
},
|
||||
|
||||
"icons": {
|
||||
"48": "icons/48.png",
|
||||
"96": "icons/96.png"
|
||||
},
|
||||
"permissions": ["tabs"],
|
||||
"commands": {
|
||||
"bookmark": {
|
||||
"suggested_key": {
|
||||
"default": "Ctrl+Shift+0",
|
||||
"linux": "Ctrl+Shift+0"
|
||||
},
|
||||
"description": "Bookmark the page in org mode"
|
||||
}
|
||||
},
|
||||
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "{fbc15118-c371-4ffd-b686-209a13ff6a5e}"
|
||||
}
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["<all_urls>"],
|
||||
|
|
Loading…
Reference in New Issue