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]
## [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
## Changed
@ -43,9 +23,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Create toolbar button
- 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
[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
[Unreleased]: https://github.com/ikipatang/shaarli-web-extension/compare/0.1.0...HEAD
[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

View file

@ -10,7 +10,7 @@ See [shaarli](https://github.com/shaarli/Shaarli).
So here we go for a Firefox Quantum Web-Extension.
## 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
- Share button in toolbar

View file

@ -1,7 +1,7 @@
{
"name": "Web Extension for Shaarli",
"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",
"manifest_version": 2,
"icons": {
@ -25,12 +25,5 @@
"browser_style": false,
"default_icon": "resources/icons/icon-24.png",
"default_title": "Share"
},
"commands": {
"_execute_browser_action": {
"suggested_key": {
"default": "Ctrl+Shift+S"
}
}
}
}

View file

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

View file

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

View file

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