Minimal working Firefox extension.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2019-05-20 19:23:16 +02:00
parent 5fc28a6104
commit 0ef7dbe253
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
5 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<form id="add_uri">
<label for="tags">Tags, comma separated:</label>
<input type="text" id="tags" autofocus>
<input type="submit" value="Add URI">
</form>
<script src="launch.js"></script>
</body>
</html>

View File

@ -0,0 +1,27 @@
var taburl;
function onResponse(response)
{
console.log(`Received ${response}`);
}
function onError(error)
{
console.log(`Error: ${error}`);
}
function set_taburl(tabs)
{
let tab = tabs[0];
taburl = tab.url;
}
function launch()
{
let tags = document.getElementById("tags").value;
var sending = browser.runtime.sendNativeMessage("remwharead", "-t " + tags + " " + taburl);
sending.then(onResponse, onError);
}
browser.tabs.query({currentWindow: true, active: true}).then(set_taburl);
add_uri.addEventListener("submit", launch);

View File

@ -0,0 +1,42 @@
{
"manifest_version": 2,
"name": "remwharead",
"version": "0.1.0",
"description": "Integrates remwharead into your Browser.",
"homepage_url": "https://schlomp.space/tastytea/remwharead",
"applications":
{
"gecko":
{
"id": "remwharead@tastytea.de",
"strict_min_version": "50.0"
}
},
"permissions":
[
"activeTab",
"nativeMessaging"
],
"browser_action":
{
"default_title": "remwharead",
"default_popup": "add_uri.html",
"browser_style": true
},
"commands":
{
"open_popup":
{
"suggested_key":
{
"default": "Ctrl+Shift+S"
},
"description": "Add URI to remwharead."
}
}
}

View File

@ -0,0 +1,7 @@
{
"name": "remwharead",
"description": "Saves URIs of things you want to remember in a database.",
"path": "/usr/lib/mozilla/native-messaging-hosts/remwharead_wrapper.sh",
"type": "stdio",
"allowed_extensions": [ "remwharead@tastytea.de" ]
}

View File

@ -0,0 +1,5 @@
#!/bin/sh
read args
args="$(echo ${args} | sed -E 's/^.+\"(.+)\"$/\1/')" # Remove length and quotes.
remwharead ${args}