Compare commits
10 commits
96c37cfd6e
...
d8839ba3b1
Author | SHA1 | Date | |
---|---|---|---|
d8839ba3b1 | |||
ee03754735 | |||
828cf574d8 | |||
d0ac9b7e4a | |||
35392dda80 | |||
d8282bdcc4 | |||
af99a34045 | |||
fdd0f7cfae | |||
b6770c0d7a | |||
97fddfdf38 |
25
CHANGELOG.md
25
CHANGELOG.md
|
@ -6,6 +6,26 @@ 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
|
||||
|
@ -23,6 +43,9 @@ 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/0.1.0...HEAD
|
||||
[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
|
||||
[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
|
||||
|
|
|
@ -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
|
||||
https://addons.mozilla.org/fr/firefox/addon/web-extension-for-shaarli/
|
||||
[Aeris/shaarli](https://addons.mozilla.org/fr/firefox/addon/shaarli/) version on firefox library has been updated
|
||||
|
||||
## Features
|
||||
- Share button in toolbar
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "Web Extension for Shaarli",
|
||||
"description": "Share your link to your Shaarli on Firefox Quantum",
|
||||
"version": "0.1.0",
|
||||
"version": "2.0.0",
|
||||
"homepage_url": "https://github.com/ikipatang/shaarli-web-extension",
|
||||
"manifest_version": 2,
|
||||
"icons": {
|
||||
|
@ -25,5 +25,12 @@
|
|||
"browser_style": false,
|
||||
"default_icon": "resources/icons/icon-24.png",
|
||||
"default_title": "Share"
|
||||
},
|
||||
"commands": {
|
||||
"_execute_browser_action": {
|
||||
"suggested_key": {
|
||||
"default": "Ctrl+Shift+S"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "shaarli-web-extension",
|
||||
"version": "0.1.0",
|
||||
"version": "2.0.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": "5412352+ikipatang@users.noreply.github.com",
|
||||
"author": "ikipatang",
|
||||
"license": "GPL-3.0",
|
||||
"devDependencies": {
|
||||
"version-changelog": "^2.1.0",
|
||||
|
@ -22,6 +22,7 @@
|
|||
"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"
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
|
||||
/**
|
||||
* Store options UI using browser.storage.local.
|
||||
* @return {void} -
|
||||
* ParseInt with minimum dimension of 45px
|
||||
* @param {string} dimension -
|
||||
* @return {int} -
|
||||
*/
|
||||
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);
|
||||
function parseIntDimension(dimension){
|
||||
const minDimension = 45;
|
||||
let parsedDimension = parseInt(dimension);
|
||||
if(isNaN(parsedDimension) || parsedDimension < minDimension){
|
||||
parsedDimension = minDimension;
|
||||
}
|
||||
return parsedDimension;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,18 +23,45 @@ function updateUI(restoredSettings) {
|
|||
// console.log('restoredSettings');
|
||||
// console.dir(restoredSettings, { depth: 10, colors: true }); // DEBUG
|
||||
|
||||
// Get HTML input
|
||||
const url = document.querySelector("#url");
|
||||
url.value = restoredSettings.url;
|
||||
|
||||
const popupWidth = document.querySelector("#popupWidth");
|
||||
popupWidth.value = restoredSettings.popupWidth;
|
||||
const popupHeight = document.querySelector("#popupHeight");
|
||||
popupHeight.value = restoredSettings.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");
|
||||
const popupHeight = document.querySelector("#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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display on error
|
||||
* @param {object} error -
|
||||
|
|
|
@ -8,19 +8,23 @@ var storage = {
|
|||
popupHeight: 600,
|
||||
}
|
||||
|
||||
/*
|
||||
Generic error logger.
|
||||
/**
|
||||
* Generic error logger.
|
||||
* @param {object} e -
|
||||
* @return {void} -
|
||||
*/
|
||||
function onError(e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
/*
|
||||
On startup, check whether we have stored settings.
|
||||
If we don't, then store the default settings.
|
||||
/**
|
||||
* On startup, check whether we have stored settings.
|
||||
* If we don't, then store the default settings.
|
||||
* @param {object} storedSettings -
|
||||
* @return {void} -
|
||||
*/
|
||||
function checkStoredSettings(storedSettings) {
|
||||
if (!storedSettings.storage) {
|
||||
if (storedSettings.url === undefined) {
|
||||
browser.storage.local.set(storage);
|
||||
}
|
||||
}
|
||||
|
|
BIN
xpi-release/web_extension_for_shaarli-0.0.2-an+fx.xpi
Normal file
BIN
xpi-release/web_extension_for_shaarli-0.0.2-an+fx.xpi
Normal file
Binary file not shown.
Loading…
Reference in a new issue