Added a "My (Semantic)Scuttle" context menu. Requires an additional username setting.
This commit is contained in:
parent
af507b10b4
commit
3a35cbfda4
@ -77,6 +77,18 @@ browser.contextMenus.create({
|
|||||||
contexts: ["all"]
|
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) => {
|
browser.browserAction.onClicked.addListener((tab) => {
|
||||||
if((tab.url.includes("about:reader?url=") == true) || (tab.url.includes("https://addons.mozilla.org/") == true)){
|
if((tab.url.includes("about:reader?url=") == true) || (tab.url.includes("https://addons.mozilla.org/") == true)){
|
||||||
shareURL("",tab);
|
shareURL("",tab);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version" : 2,
|
"manifest_version" : 2,
|
||||||
"name": "Add to (Semantic)Scuttle",
|
"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.",
|
"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/",
|
"homepage_url" : "https://addons.mozilla.org/fr/firefox/addon/add-to-semantic-scuttle/",
|
||||||
"icons" : {
|
"icons" : {
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
<form>
|
<form>
|
||||||
<label>(Semantic)Scuttle instance URL <input type="text" id="instance_url" ></label><br />
|
<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 Width <input type="text" id="window_width" ></label><br />
|
||||||
<label>Window Height <input type="text" id="window_height" ></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 />
|
<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 />
|
||||||
|
@ -2,6 +2,7 @@ function saveOptions(e) {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
browser.storage.local.set({
|
browser.storage.local.set({
|
||||||
instance_url: document.querySelector("#instance_url").value ,
|
instance_url: document.querySelector("#instance_url").value ,
|
||||||
|
username: document.querySelector("#username").value ,
|
||||||
window_width: document.querySelector("#window_width").value ,
|
window_width: document.querySelector("#window_width").value ,
|
||||||
window_height: document.querySelector("#window_height").value,
|
window_height: document.querySelector("#window_height").value,
|
||||||
remove_querystrings: document.querySelector("#remove_querystrings").checked,
|
remove_querystrings: document.querySelector("#remove_querystrings").checked,
|
||||||
@ -13,6 +14,7 @@ function restoreOptions() {
|
|||||||
|
|
||||||
function setCurrentChoices(result) {
|
function setCurrentChoices(result) {
|
||||||
document.querySelector("#instance_url").value = result["instance_url"] || "http://semanticscuttle.sourceforge.net/";
|
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_width").value = result["window_width"] || "640";
|
||||||
document.querySelector("#window_height").value = result["window_height"] || "480";
|
document.querySelector("#window_height").value = result["window_height"] || "480";
|
||||||
document.querySelector("#remove_querystrings").checked = result["remove_querystrings"] || false;
|
document.querySelector("#remove_querystrings").checked = result["remove_querystrings"] || false;
|
||||||
@ -23,7 +25,7 @@ function restoreOptions() {
|
|||||||
console.log(`Error: ${error}`);
|
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);
|
getting.then(setCurrentChoices, onError);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user