diff --git a/TODO b/TODO index 2882fe5..1f3459c 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,2 @@ --Option to clean URLs (after the ?) -Add keyboard shortcut if possible -Bug corrections & optimizations diff --git a/background.js b/background.js index a0d81f7..992bf0a 100644 --- a/background.js +++ b/background.js @@ -1,16 +1,17 @@ var instance var windowWidth var windowHeight +var noQueryStrings // prefs are not loaded once before shareURL it won't work on first click. -var gettingPrefs = browser.storage.local.get(["instance_url","window_width","window_height"]); +var gettingPrefs = browser.storage.local.get(["instance_url","window_width","window_height","remove_querystrings"]); gettingPrefs.then(onGot,onError); function shareURL(){ browser.tabs.query({active: true},function(tabs){ // prefs are loaded again when the function is called to manage changes in the options page. - let gettingPrefs = browser.storage.local.get(["instance_url","window_width","window_height"]); + let gettingPrefs = browser.storage.local.get(["instance_url","window_width","window_height","remove_querystrings"]); gettingPrefs.then(onGot,onError); var tab = tabs[0]; @@ -23,6 +24,11 @@ function shareURL(){ rawUrl = decodeURIComponent(rawUrl); } + // manages URL query strings + if (noQueryStrings == true) { + rawUrl = rawUrl.split("?")[0]; + } + var url = instance + "/bookmarks.php?action=add&address=" + encodeURIComponent(rawUrl) + "&title=" + encodeURIComponent(tabs[0].title); widthInt = Number(windowWidth); heightInt = Number(windowHeight); @@ -56,6 +62,7 @@ function onGot(item) { instance = item["instance_url"]; windowWidth = item["window_width"]; windowHeight = item["window_height"]; + noQueryStrings = item["remove_querystrings"]; } browser.contextMenus.create({ diff --git a/manifest.json b/manifest.json index f08e01d..24f1b87 100644 --- a/manifest.json +++ b/manifest.json @@ -1,9 +1,9 @@ { "manifest_version" : 2, "name": "Add to (Semantic)Scuttle", - "version" : "0.5", + "version" : "0.6", "description" : "Add bookmarks to a (Semantic)Scuttle instance, a social bookmarking tool experimenting with tags and collaborative tag descriptions.", - "homepage_url" : "https://github.com/FrenchHope/Add-to-Semantic-Scuttle-WebExt", + "homepage_url" : "https://addons.mozilla.org/fr/firefox/addon/add-to-semantic-scuttle/", "icons" : { "48" : "data/icon48.png" }, diff --git a/options.html b/options.html index b166a39..3cde084 100644 --- a/options.html +++ b/options.html @@ -11,6 +11,7 @@


+
diff --git a/options.js b/options.js index bd325fb..31f71a2 100644 --- a/options.js +++ b/options.js @@ -3,7 +3,8 @@ function saveOptions(e) { browser.storage.local.set({ instance_url: document.querySelector("#instance_url").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 }); } @@ -13,13 +14,14 @@ function restoreOptions() { document.querySelector("#instance_url").value = result["instance_url"] || "http://semanticscuttle.sourceforge.net/"; 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; } function onError(error) { console.log(`Error: ${error}`); } - var getting = browser.storage.local.get(["instance_url","window_width","window_height"]); + var getting = browser.storage.local.get(["instance_url","window_width","window_height","remove_querystrings"]); getting.then(setCurrentChoices, onError); }