Compare commits

...

10 commits

Author SHA1 Message Date
Anish Lakhwara d8839ba3b1 Initial Commit 2023-06-03 15:06:10 +10:00
ikipatang ee03754735 Update Readme 2017-12-17 23:47:52 +01:00
ikipatang 828cf574d8 Release version 2.0.0 for Aeris AMO 2017-12-17 23:17:49 +01:00
ikipatang d0ac9b7e4a Release v0.2.6 2017-12-07 20:25:41 +01:00
ikipatang 35392dda80 Update changelog 2017-12-07 20:16:57 +01:00
ikipatang d8282bdcc4 Options: minimum dimension is 45px + UI is updated after save 2017-12-07 20:15:07 +01:00
ikipatang af99a34045 Storage: add jsdoc 2017-12-07 19:56:21 +01:00
ikipatang fdd0f7cfae Storage: fix unsaved settings after restart 2017-12-07 19:55:55 +01:00
ikipatang b6770c0d7a Package.json: add script debug build that rm web-ext-build 2017-12-07 19:29:03 +01:00
ikipatang 97fddfdf38 Release v0.2.2 2017-12-06 22:51:46 +01:00
7 changed files with 91 additions and 30 deletions

View file

@ -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

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
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

View file

@ -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"
}
}
}
}

View file

@ -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"

View file

@ -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 -

View file

@ -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);
}
}

Binary file not shown.