Compare commits

..

No commits in common. "d8839ba3b196cd33d29cc25274acc69534ef7fb5" and "96c37cfd6ef7f4d5d945617db9f516a367a71ee6" have entirely different histories.

7 changed files with 29 additions and 90 deletions

View file

@ -6,26 +6,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased] ## [Unreleased]
## [2.0.0][] - 2017-12-17
## Changed
- Changed version to match shaarli extension
## [0.2.6][] - 2017-12-07
## Changed
- Extension settings update after save
## Added
- Popup dimensions cannot be less than 45px
## Fixed
- Fixed settings lost after restart
## [0.2.2][] - 2017-11-30
## Added
- Popup dimensions can be set in extension settings
## [0.1.0][] - 2017-11-28 ## [0.1.0][] - 2017-11-28
## Changed ## Changed
@ -43,9 +23,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Create toolbar button - Create toolbar button
- Sharing a link will send user to extension settings if no Shaarli URL is set - Sharing a link will send user to extension settings if no Shaarli URL is set
[Unreleased]: https://github.com/ikipatang/shaarli-web-extension/compare/v2.0.0...HEAD [Unreleased]: https://github.com/ikipatang/shaarli-web-extension/compare/0.1.0...HEAD
[2.0.0]: https://github.com/ikipatang/shaarli-web-extension/compare/v0.2.6...v2.0.0
[0.2.6]: https://github.com/ikipatang/shaarli-web-extension/compare/v0.2.2...v0.2.6
[0.2.2]: https://github.com/ikipatang/shaarli-web-extension/compare/0.1.0...v0.2.2
[0.1.0]: https://github.com/ikipatang/shaarli-web-extension/compare/0.0.2...0.1.0 [0.1.0]: https://github.com/ikipatang/shaarli-web-extension/compare/0.0.2...0.1.0
[0.0.2]: https://github.com/ikipatang/shaarli-web-extension/tree/0.0.2 [0.0.2]: https://github.com/ikipatang/shaarli-web-extension/tree/0.0.2

View file

@ -10,7 +10,7 @@ See [shaarli](https://github.com/shaarli/Shaarli).
So here we go for a Firefox Quantum Web-Extension. So here we go for a Firefox Quantum Web-Extension.
## Where to find it ## Where to find it
[Aeris/shaarli](https://addons.mozilla.org/fr/firefox/addon/shaarli/) version on firefox library has been updated https://addons.mozilla.org/fr/firefox/addon/web-extension-for-shaarli/
## Features ## Features
- Share button in toolbar - Share button in toolbar

View file

@ -1,7 +1,7 @@
{ {
"name": "Web Extension for Shaarli", "name": "Web Extension for Shaarli",
"description": "Share your link to your Shaarli on Firefox Quantum", "description": "Share your link to your Shaarli on Firefox Quantum",
"version": "2.0.0", "version": "0.1.0",
"homepage_url": "https://github.com/ikipatang/shaarli-web-extension", "homepage_url": "https://github.com/ikipatang/shaarli-web-extension",
"manifest_version": 2, "manifest_version": 2,
"icons": { "icons": {
@ -25,12 +25,5 @@
"browser_style": false, "browser_style": false,
"default_icon": "resources/icons/icon-24.png", "default_icon": "resources/icons/icon-24.png",
"default_title": "Share" "default_title": "Share"
},
"commands": {
"_execute_browser_action": {
"suggested_key": {
"default": "Ctrl+Shift+S"
}
}
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "shaarli-web-extension", "name": "shaarli-web-extension",
"version": "2.0.0", "version": "0.1.0",
"description": "Share your link to your Shaarli on Firefox Quantum", "description": "Share your link to your Shaarli on Firefox Quantum",
"main": "src/background.js", "main": "src/background.js",
"keywords": [ "keywords": [
@ -12,7 +12,7 @@
"type": "git", "type": "git",
"url": "https://github.com/ikipatang/shaarli-web-extension.git" "url": "https://github.com/ikipatang/shaarli-web-extension.git"
}, },
"author": "ikipatang", "author": "5412352+ikipatang@users.noreply.github.com",
"license": "GPL-3.0", "license": "GPL-3.0",
"devDependencies": { "devDependencies": {
"version-changelog": "^2.1.0", "version-changelog": "^2.1.0",
@ -22,7 +22,6 @@
"slate": "rm -rf node_modules && yarn install", "slate": "rm -rf node_modules && yarn install",
"lint": "web-ext lint", "lint": "web-ext lint",
"start": "web-ext run", "start": "web-ext run",
"debug:build": "rm -rf web-ext-artifacts/*.zip && npm run build",
"build": "web-ext build", "build": "web-ext build",
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"version": "version-changelog CHANGELOG.md" "version": "version-changelog CHANGELOG.md"

View file

@ -1,16 +1,17 @@
/** /**
* ParseInt with minimum dimension of 45px * Store options UI using browser.storage.local.
* @param {string} dimension - * @return {void} -
* @return {int} -
*/ */
function parseIntDimension(dimension){ function storeSettings() {
const minDimension = 45; const settings = {
let parsedDimension = parseInt(dimension); url: document.querySelector("#url").value,
if(isNaN(parsedDimension) || parsedDimension < minDimension){ popupWidth: parseInt(document.querySelector("#popupWidth").value),
parsedDimension = minDimension; popupHeight: parseInt(document.querySelector("#popupHeight").value),
} pageAction: document.querySelector("#pageAction").checked,
return parsedDimension; };
// console.log('storeSettings settings');
// console.log(settings);
browser.storage.local.set(settings);
} }
/** /**
@ -23,43 +24,16 @@ function updateUI(restoredSettings) {
// console.log('restoredSettings'); // console.log('restoredSettings');
// console.dir(restoredSettings, { depth: 10, colors: true }); // DEBUG // console.dir(restoredSettings, { depth: 10, colors: true }); // DEBUG
// Get HTML input
const url = document.querySelector("#url"); const url = document.querySelector("#url");
const popupWidth = document.querySelector("#popupWidth");
const popupHeight = document.querySelector("#popupHeight");
const pageAction = document.querySelector("#pageAction");
// Set HTML input with stored values
url.value = restoredSettings.url; url.value = restoredSettings.url;
popupWidth.value = restoredSettings.popupWidth;
popupHeight.value = restoredSettings.popupHeight;
pageAction.checked = restoredSettings.pageAction;
}
/**
* Store options UI using browser.storage.local.
* @return {void} -
*/
function storeSettings() {
const url = document.querySelector("#url");
const popupWidth = document.querySelector("#popupWidth"); const popupWidth = document.querySelector("#popupWidth");
popupWidth.value = restoredSettings.popupWidth;
const popupHeight = document.querySelector("#popupHeight"); const popupHeight = document.querySelector("#popupHeight");
popupHeight.value = restoredSettings.popupHeight;
const pageAction = document.querySelector("#pageAction"); const pageAction = document.querySelector("#pageAction");
pageAction.checked = restoredSettings.pageAction;
const settings = {
url: url.value,
popupWidth: parseIntDimension(popupWidth.value),
popupHeight: parseIntDimension(popupHeight.value),
pageAction: pageAction.checked,
};
// console.log('storeSettings settings');
// console.log(settings);
// Store in storage
browser.storage.local.set(settings);
// Update UI
updateUI(settings);
} }
/** /**

View file

@ -8,23 +8,19 @@ var storage = {
popupHeight: 600, popupHeight: 600,
} }
/** /*
* Generic error logger. Generic error logger.
* @param {object} e -
* @return {void} -
*/ */
function onError(e) { function onError(e) {
console.error(e); console.error(e);
} }
/** /*
* On startup, check whether we have stored settings. On startup, check whether we have stored settings.
* If we don't, then store the default settings. If we don't, then store the default settings.
* @param {object} storedSettings -
* @return {void} -
*/ */
function checkStoredSettings(storedSettings) { function checkStoredSettings(storedSettings) {
if (storedSettings.url === undefined) { if (!storedSettings.storage) {
browser.storage.local.set(storage); browser.storage.local.set(storage);
} }
} }