Added a "My (Semantic)Scuttle" context menu. Requires an additional username setting.

This commit is contained in:
Laurent Espitallier 2017-10-21 10:36:57 +02:00
parent af507b10b4
commit 3a35cbfda4
4 changed files with 17 additions and 2 deletions

View File

@ -77,6 +77,18 @@ browser.contextMenus.create({
contexts: ["all"]
});
browser.contextMenus.create({
id: "my-scuttle",
title: "My (Semantic)Scuttle",
onclick: function(){
browser.storage.local.get(["instance_url","username"],function(item){
myurl = item["instance_url"] + "/bookmarks.php/" + item["username"];
var creating = browser.tabs.create({url: myurl});
})
},
contexts: ["all"]
});
browser.browserAction.onClicked.addListener((tab) => {
if((tab.url.includes("about:reader?url=") == true) || (tab.url.includes("https://addons.mozilla.org/") == true)){
shareURL("",tab);

View File

@ -1,7 +1,7 @@
{
"manifest_version" : 2,
"name": "Add to (Semantic)Scuttle",
"version" : "0.8",
"version" : "0.9",
"description" : "Add bookmarks to a (Semantic)Scuttle instance, a social bookmarking tool experimenting with tags and collaborative tag descriptions.",
"homepage_url" : "https://addons.mozilla.org/fr/firefox/addon/add-to-semantic-scuttle/",
"icons" : {

View File

@ -9,6 +9,7 @@
<form>
<label>(Semantic)Scuttle instance URL <input type="text" id="instance_url" ></label><br />
<label>(Semantic)Scuttle username <input type="text" id="username" ></label><br />
<label>Window Width <input type="text" id="window_width" ></label><br />
<label>Window Height <input type="text" id="window_height" ></label><br />
<label>Remove querystrings from URL <input type="checkbox" id="remove_querystrings" ></label><label> Except for (separated by commas) <input type="text" id="exceptUrlList"></label><br />

View File

@ -2,6 +2,7 @@ function saveOptions(e) {
e.preventDefault();
browser.storage.local.set({
instance_url: document.querySelector("#instance_url").value ,
username: document.querySelector("#username").value ,
window_width: document.querySelector("#window_width").value ,
window_height: document.querySelector("#window_height").value,
remove_querystrings: document.querySelector("#remove_querystrings").checked,
@ -13,6 +14,7 @@ function restoreOptions() {
function setCurrentChoices(result) {
document.querySelector("#instance_url").value = result["instance_url"] || "http://semanticscuttle.sourceforge.net/";
document.querySelector("#username").value = result["username"] || "Me";
document.querySelector("#window_width").value = result["window_width"] || "640";
document.querySelector("#window_height").value = result["window_height"] || "480";
document.querySelector("#remove_querystrings").checked = result["remove_querystrings"] || false;
@ -23,7 +25,7 @@ function restoreOptions() {
console.log(`Error: ${error}`);
}
var getting = browser.storage.local.get(["instance_url","window_width","window_height","remove_querystrings","exceptUrlList"]);
var getting = browser.storage.local.get(["instance_url","username","window_width","window_height","remove_querystrings","exceptUrlList"]);
getting.then(setCurrentChoices, onError);
}