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] ## [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
@ -23,6 +43,9 @@ 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/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.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
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 ## 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": "0.1.0", "version": "2.0.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,5 +25,12 @@
"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": "0.1.0", "version": "2.0.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": "5412352+ikipatang@users.noreply.github.com", "author": "ikipatang",
"license": "GPL-3.0", "license": "GPL-3.0",
"devDependencies": { "devDependencies": {
"version-changelog": "^2.1.0", "version-changelog": "^2.1.0",
@ -22,6 +22,7 @@
"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,17 +1,16 @@
/** /**
* Store options UI using browser.storage.local. * ParseInt with minimum dimension of 45px
* @return {void} - * @param {string} dimension -
* @return {int} -
*/ */
function storeSettings() { function parseIntDimension(dimension){
const settings = { const minDimension = 45;
url: document.querySelector("#url").value, let parsedDimension = parseInt(dimension);
popupWidth: parseInt(document.querySelector("#popupWidth").value), if(isNaN(parsedDimension) || parsedDimension < minDimension){
popupHeight: parseInt(document.querySelector("#popupHeight").value), parsedDimension = minDimension;
pageAction: document.querySelector("#pageAction").checked, }
}; return parsedDimension;
// console.log('storeSettings settings');
// console.log(settings);
browser.storage.local.set(settings);
} }
/** /**
@ -24,18 +23,45 @@ 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");
url.value = restoredSettings.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");
// Set HTML input with stored values
url.value = restoredSettings.url;
popupWidth.value = restoredSettings.popupWidth;
popupHeight.value = restoredSettings.popupHeight;
pageAction.checked = restoredSettings.pageAction; 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 * Display on error
* @param {object} error - * @param {object} error -

View file

@ -8,19 +8,23 @@ 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.storage) { if (storedSettings.url === undefined) {
browser.storage.local.set(storage); browser.storage.local.set(storage);
} }
} }

Binary file not shown.