chore: unify and improve codestyle

This commit is contained in:
Thomas Rupprecht 2023-02-04 17:09:47 +01:00
parent 25708ea410
commit 701ec4b226
11 changed files with 169 additions and 151 deletions

View File

@ -3,7 +3,7 @@
# top-most EditorConfig file # top-most EditorConfig file
root = true root = true
[*.{html,css,js,json,svg}] [*.{html,css,js,json,svg,toml}]
indent_style = tab indent_style = tab
indent_size = 2 indent_size = 2
end_of_line = lf end_of_line = lf

View File

@ -5,36 +5,41 @@ All notable changes to this project will be documented in this file.
## [unreleased] ## [unreleased]
### Features ### Features
- Add git-cliff to update the CHANGELOG.md - Add git-cliff to update the CHANGELOG.md
### Miscellaneous Tasks ### Miscellaneous Tasks
- Update husky - Update husky
- Improve CHANGELOG config
- Unify and improve codestyle
### Other ### Other
- Add pre-commit hook with husky
- Add pre-commit hook with husky
## [v0.9.1](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.9.1) - 2023-01-22 ## [v0.9.1](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.9.1) - 2023-01-22
### Other ### Other
- Extract code into setBadgeStatus and createStatusChangedNotification function - Extract code into setBadgeStatus and createStatusChangedNotification function
- Don't fetch data if offline - Don't fetch data if offline
- Replace web-ext types package - Replace web-ext types package
- Await init - Await init
- Add link to Pad - Add link to Pad
## [v0.9.0](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.9.0) - 2023-01-20 ## [v0.9.0](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.9.0) - 2023-01-20
### Other ### Other
- Manifest_v3 - Manifest_v3
- Update to manifest_version v3 - Update to manifest_version v3
- Make code compatible with manifest_version v3 - Make code compatible with manifest_version v3
## [v0.8.7](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.7) - 2023-01-20 ## [v0.8.7](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.7) - 2023-01-20
### Other ### Other
- Add badges to README - Add badges to README
- Improve README - Improve README
- Improve badges - Improve badges
@ -44,52 +49,53 @@ All notable changes to this project will be documented in this file.
- Remove persistent flag in manifest config - Remove persistent flag in manifest config
- Open usrspace.at homepage on install - Open usrspace.at homepage on install
## [v0.8.6](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.6) - 2023-01-05 ## [v0.8.6](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.6) - 2023-01-05
### Other ### Other
- Change addon id to currently used one
- Change addon id to currently used one
## [v0.8.5](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.5) - 2023-01-05 ## [v0.8.5](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.5) - 2023-01-05
### Other ### Other
- Add web-ext-config.js and add watch scripts - Add web-ext-config.js and add watch scripts
- Improve README - Improve README
- Add development docs - Add development docs
- Inject browser-polyfill only in chromium builds - Inject browser-polyfill only in chromium builds
- Add addon id - Add addon id
## [v0.8.4](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.4) - 2023-01-05 ## [v0.8.4](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.4) - 2023-01-05
### Other ### Other
- Use html template tag - Use html template tag
- Change strict_min_version to v79 - Change strict_min_version to v79
- Simplify updateSpaceApiJson - Simplify updateSpaceApiJson
- Add lint script - Add lint script
## [v0.8.3](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.3) - 2023-01-04 ## [v0.8.3](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.3) - 2023-01-04
### Other ### Other
- Update strict_min_version to 57.0
- Update strict_min_version to 57.0
## [v0.8.2](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.2) - 2023-01-04 ## [v0.8.2](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.2) - 2023-01-04
### Other ### Other
- Explicit set persistent=true and add browser_specific_settings in manifest.json - Explicit set persistent=true and add browser_specific_settings in manifest.json
- Set html lang by browser language - Set html lang by browser language
- Improve popup styling - Improve popup styling
## [v0.8.1](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.1) - 2022-12-25 ## [v0.8.1](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.1) - 2022-12-25
### Bug Fixes ### Bug Fixes
- Fix copy-version script - Fix copy-version script
### Other ### Other
- Manifest l10n - Manifest l10n
- Faster data fetching, badge improvements - Faster data fetching, badge improvements
- Cursor pointer on clickable elements - Cursor pointer on clickable elements
@ -101,10 +107,10 @@ All notable changes to this project will be documented in this file.
- Unfiy codestyle - Unfiy codestyle
- Cleanup data on startup - Cleanup data on startup
## [v0.8.0](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.0) - 2022-12-24 ## [v0.8.0](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.0) - 2022-12-24
### Other ### Other
- Improve code, doc, tooling - Improve code, doc, tooling
- Npm version scripts - Npm version scripts
- Copy browser-polyfill - Copy browser-polyfill
@ -119,15 +125,16 @@ All notable changes to this project will be documented in this file.
- Increase svg size - Increase svg size
- Set build filename - Set build filename
## [v0.7](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.7) - 2021-11-06 ## [v0.7](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.7) - 2021-11-06
### Bug Fixes ### Bug Fixes
- Fix new urls - Fix new urls
- Fix dates if no date is found - Fix dates if no date is found
- Fix data, remove logging, improve code - Fix data, remove logging, improve code
### Other ### Other
- Change spaceApiUrl and nextcloud label - Change spaceApiUrl and nextcloud label
- Add release info - Add release info
- Add editorconfig - Add editorconfig
@ -143,27 +150,28 @@ All notable changes to this project will be documented in this file.
- Change icon - Change icon
- Remove old html code and load right svg - Remove old html code and load right svg
## [v0.4](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.4) - 2019-10-04 ## [v0.4](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.4) - 2019-10-04
### Bug Fixes ### Bug Fixes
- Fix wrong icon
- Fix wrong icon
## [v0.3](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.3) - 2019-10-04 ## [v0.3](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.3) - 2019-10-04
### Other ### Other
- Improve popup content
- Improve popup content
## [v0.2](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.2) - 2019-08-28 ## [v0.2](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.2) - 2019-08-28
### Bug Fixes ### Bug Fixes
- Fix icon style - Fix icon style
- Fix compatibility with chromium based browsers - Fix compatibility with chromium based browsers
- Fix typo - Fix typo
### Other ### Other
- Init - Init
- Add first readme - Add first readme
- Add LICENSE and improve README - Add LICENSE and improve README
@ -183,5 +191,4 @@ All notable changes to this project will be documented in this file.
- Combine updateBadge promises - Combine updateBadge promises
- Check for online/offline events if fetching should be enabled - Check for online/offline events if fetching should be enabled
<!-- generated by git-cliff --> <!-- generated by git-cliff -->

View File

@ -6,6 +6,7 @@
[![Mozilla Add-on](https://img.shields.io/amo/stars/usr-space?style=for-the-badge)](https://addons.mozilla.org/de/firefox/addon/usr-space/) [![Mozilla Add-on](https://img.shields.io/amo/stars/usr-space?style=for-the-badge)](https://addons.mozilla.org/de/firefox/addon/usr-space/)
## Features ## Features
- Show if someone is in the Space - Show if someone is in the Space
- Looks for connected dynamic IPs (DHCP) (provided by backend) - Looks for connected dynamic IPs (DHCP) (provided by backend)
- Refreshes every 5min - Refreshes every 5min
@ -13,6 +14,7 @@
- Quick-Links (Homepage, Wiki, Gitea, Nextcloud) - Quick-Links (Homepage, Wiki, Gitea, Nextcloud)
## Install ## Install
```ssh ```ssh
$ git clone https://gitea.usrspace.at/XimeX/usrspace-browser-addon.git $ git clone https://gitea.usrspace.at/XimeX/usrspace-browser-addon.git
$ npm i -g web-ext $ npm i -g web-ext
@ -20,6 +22,7 @@ $ npm i
``` ```
## Run / Develop / Debug ## Run / Develop / Debug
```ssh ```ssh
$ npm run watch:{firefox|firefox-android|chromium} $ npm run watch:{firefox|firefox-android|chromium}
``` ```
@ -27,6 +30,7 @@ $ npm run watch:{firefox|firefox-android|chromium}
If more options are needed add them after a `--`. If more options are needed add them after a `--`.
Some useful options: Some useful options:
- `--devtools` - `--devtools`
- `--firefox-apk=...` - `--firefox-apk=...`
- `--android-device=...` - `--android-device=...`
@ -34,6 +38,7 @@ Some useful options:
Example: `npm run watch:firefox-android -- --firefox-apk=org.mozilla.fenix --firefox-device=XXXXXXXX` Example: `npm run watch:firefox-android -- --firefox-apk=org.mozilla.fenix --firefox-device=XXXXXXXX`
## Build ## Build
```ssh ```ssh
// For Firefox // For Firefox
$ npm run build:firefox $ npm run build:firefox
@ -42,18 +47,22 @@ $ npm run build:chromium
``` ```
## Release ## Release
```ssh ```ssh
$ npm version {major|minor|patch|...} $ npm version {major|minor|patch|...}
``` ```
## Developent Docs ## Developent Docs
- [Getting started](https://extensionworkshop.com/documentation/develop/getting-started-with-web-ext/) - [Getting started](https://extensionworkshop.com/documentation/develop/getting-started-with-web-ext/)
- [web-ext command reference](https://extensionworkshop.com/documentation/develop/web-ext-command-reference/) - [web-ext command reference](https://extensionworkshop.com/documentation/develop/web-ext-command-reference/)
- [WebExtensions MDN Docu](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions) - [WebExtensions MDN Docu](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions)
## Credits ## Credits
Used icons from Bootstrap Used icons from Bootstrap
https://github.com/twbs/icons/blob/main/LICENSE.md https://github.com/twbs/icons/blob/main/LICENSE.md
## License ## License
MIT MIT

View File

@ -11,16 +11,16 @@ All notable changes to this project will be documented in this file.\n
# https://tera.netlify.app/docs/#introduction # https://tera.netlify.app/docs/#introduction
body = """ body = """
{% if version %}\ {% if version %}\
## [{{ version }}](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }} ## [{{ version }}](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\ {% else %}\
## [unreleased] ## [unreleased]
{% endif %}\ {% endif %}\
{% for group, commits in commits | group_by(attribute="group") %} {% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }} ### {{ group | upper_first }}\n
{% for commit in commits %}\ {% for commit in commits %}\
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first | trim_end }} - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first | trim_end }}
{% endfor %}\ {% endfor %}\
{% endfor %}\n\n {% endfor %}\n
""" """
# remove the leading and trailing whitespace from the template # remove the leading and trailing whitespace from the template
trim = true trim = true
@ -38,24 +38,24 @@ filter_unconventional = false
split_commits = false split_commits = false
# regex for preprocessing the commit messages # regex for preprocessing the commit messages
commit_preprocessors = [ commit_preprocessors = [
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/orhun/git-cliff/issues/${2}))"}, # replace issue numbers # { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/orhun/git-cliff/issues/${2}))" }, # replace issue numbers
] ]
# regex for parsing and grouping commits # regex for parsing and grouping commits
commit_parsers = [ commit_parsers = [
{ message = "^feat", group = "Features"}, { message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes"}, { message = "^fix", group = "Bug Fixes" },
{ message = "^doc", group = "Documentation"}, { message = "^doc", group = "Documentation" },
{ message = "^perf", group = "Performance"}, { message = "^perf", group = "Performance" },
{ message = "^refactor", group = "Refactor"}, { message = "^refactor", group = "Refactor" },
{ message = "^style", group = "Styling"}, { message = "^style", group = "Styling" },
{ message = "^test", group = "Testing"}, { message = "^test", group = "Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true}, { message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore", group = "Miscellaneous Tasks"}, { message = "^chore", group = "Miscellaneous Tasks" },
{ body = ".*security", group = "Security"}, { body = ".*security", group = "Security" },
{ message = "^[0-9]+.[0-9]+.[0-9]+", skip = true}, { message = "^[0-9]+.[0-9]+.[0-9]+", skip = true },
{ message = "^release v0.[0-9]", skip = true}, { message = "^release v0.[0-9]", skip = true },
{ message = "^Merge branch ", skip = true}, { message = "^Merge branch ", skip = true },
{ message = ".*", group = "Other", default_scope = "other"}, { message = ".*", group = "Other", default_scope = "other" },
] ]
# protect breaking changes from being skipped due to matching a skipping commit_parser # protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false protect_breaking_commits = false

View File

@ -41,8 +41,8 @@
"stateNotificationMessage": { "stateNotificationMessage": {
"message": "Space ist jetzt $STATE$.", "message": "Space ist jetzt $STATE$.",
"placeholders": { "placeholders": {
"STATE" : { "STATE": {
"content" : "$1" "content": "$1"
} }
} }
}, },

View File

@ -41,8 +41,8 @@
"stateNotificationMessage": { "stateNotificationMessage": {
"message": "Space is now $STATE$.", "message": "Space is now $STATE$.",
"placeholders": { "placeholders": {
"STATE" : { "STATE": {
"content" : "$1" "content": "$1"
} }
} }
}, },

View File

@ -1,10 +1,10 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="de"> <html lang="de">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>/usr/space</title> <title>/usr/space</title>
<!-- [INJECT-BROWSER-POLYFILL] --> <!-- [INJECT-BROWSER-POLYFILL] -->
<script type="module" src="background.js"></script> <script type="module" src="background.js"></script>
</head> </head>
</html> </html>

View File

@ -65,7 +65,7 @@ async function fetchNewData() {
await setBadgeStatus(spaceApiJson.state.open, eventActive); await setBadgeStatus(spaceApiJson.state.open, eventActive);
const {spaceApi} = await browser.storage.local.get('spaceApi'); const { spaceApi } = await browser.storage.local.get('spaceApi');
if (spaceApi && spaceApi.state.open !== spaceApiJson.state.open) { if (spaceApi && spaceApi.state.open !== spaceApiJson.state.open) {
await createStatusChangedNotification(spaceApiJson.state.open); await createStatusChangedNotification(spaceApiJson.state.open);
} }
@ -87,8 +87,8 @@ async function fetchNewData() {
async function setBadgeStatus(open, eventActive) { async function setBadgeStatus(open, eventActive) {
const badgeText = browser.i18n.getMessage(open ? 'badgeOpen' : eventActive ? 'badgeEvent' : 'badgeClosed'); const badgeText = browser.i18n.getMessage(open ? 'badgeOpen' : eventActive ? 'badgeEvent' : 'badgeClosed');
const badgeBgColor = open ? BADGE_COLORS.open : eventActive ? BADGE_COLORS.event : BADGE_COLORS.closed; const badgeBgColor = open ? BADGE_COLORS.open : eventActive ? BADGE_COLORS.event : BADGE_COLORS.closed;
await browser.action.setBadgeText({text: badgeText}); await browser.action.setBadgeText({ text: badgeText });
await browser.action.setBadgeBackgroundColor({color: badgeBgColor}); await browser.action.setBadgeBackgroundColor({ color: badgeBgColor });
} }
/** /**

View File

@ -18,13 +18,13 @@
} }
:root { :root {
--light-blue: #2AA1BF; --light-blue: #2aa1bf;
--dark-blue: #095C81; --dark-blue: #095c81;
--light-color: #0C0C0C; --light-color: #0c0c0c;
--dark-color: #FFFFFF; --dark-color: #ffffff;
--light-background: #F9F9F9; --light-background: #f9f9f9;
--dark-background: #4A4A4A; --dark-background: #4a4a4a;
--light-code-background: #EBEBEB; --light-code-background: #ebebeb;
--dark-code-background: #383838; --dark-code-background: #383838;
} }
@ -75,7 +75,9 @@ svg {
cursor: pointer; cursor: pointer;
} }
#state > svg, #calendar > .calendar-entry > svg, #calendar > .calendar-entry strong { #state > svg,
#calendar > .calendar-entry > svg,
#calendar > .calendar-entry strong {
margin-right: 8px; margin-right: 8px;
} }
#calendar > .calendar-entry { #calendar > .calendar-entry {

View File

@ -1,99 +1,99 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="de"> <html lang="de">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>/usr/space</title> <title>/usr/space</title>
<link rel="stylesheet" href="popup.css" /> <link rel="stylesheet" href="popup.css" />
<template id="template-icon-closed"> <template id="template-icon-closed">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M3 2a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v13h1.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1H3V2zm1 13h8V2H4v13z"/>
<path d="M9 9a1 1 0 1 0 2 0 1 1 0 0 0-2 0z"/>
</svg>
</template>
<template id="template-icon-open">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M8.5 10c-.276 0-.5-.448-.5-1s.224-1 .5-1 .5.448.5 1-.224 1-.5 1z"/>
<path d="M10.828.122A.5.5 0 0 1 11 .5V1h.5A1.5 1.5 0 0 1 13 2.5V15h1.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1H3V1.5a.5.5 0 0 1 .43-.495l7-1a.5.5 0 0 1 .398.117zM11.5 2H11v13h1V2.5a.5.5 0 0 0-.5-.5zM4 1.934V15h6V1.077l-6 .857z"/>
</svg>
</template>
<template id="template-state">
<svg></svg>
<span></span>
<time datetime=""></time>
</template>
<template id="template-icon-homepage">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path fill-rule="evenodd" d="m8 3.293 6 6V13.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5V9.293l6-6zm5-.793V6l-2-2V2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5z"/>
<path fill-rule="evenodd" d="M7.293 1.5a1 1 0 0 1 1.414 0l6.647 6.646a.5.5 0 0 1-.708.708L8 2.207 1.354 8.854a.5.5 0 1 1-.708-.708L7.293 1.5z"/>
</svg>
</template>
<template id="template-icon-wiki">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 640 512" fill="currentColor" role="img" aria-level="">
<path d="M640 51.2l-.3 12.2c-28.1.8-45 15.8-55.8 40.3-25 57.8-103.3 240-155.3 358.6H415l-81.9-193.1c-32.5 63.6-68.3 130-99.2 193.1-.3.3-15 0-15-.3C172 352.3 122.8 243.4 75.8 133.4 64.4 106.7 26.4 63.4.2 63.7c0-3.1-.3-10-.3-14.2h161.9v13.9c-19.2 1.1-52.8 13.3-43.3 34.2 21.9 49.7 103.6 240.3 125.6 288.6 15-29.7 57.8-109.2 75.3-142.8-13.9-28.3-58.6-133.9-72.8-160-9.7-17.8-36.1-19.4-55.8-19.7V49.8l142.5.3v13.1c-19.4.6-38.1 7.8-29.4 26.1 18.9 40 30.6 68.1 48.1 104.7 5.6-10.8 34.7-69.4 48.1-100.8 8.9-20.6-3.9-28.6-38.6-29.4.3-3.6 0-10.3.3-13.6 44.4-.3 111.1-.3 123.1-.6v13.6c-22.5.8-45.8 12.8-58.1 31.7l-59.2 122.8c6.4 16.1 63.3 142.8 69.2 156.7L559.2 91.8c-8.6-23.1-36.4-28.1-47.2-28.3V49.6l127.8 1.1.2.5z"/>
</svg>
</template>
<template id="template-icon-git">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M15.698 7.287 8.712.302a1.03 1.03 0 0 0-1.457 0l-1.45 1.45 1.84 1.84a1.223 1.223 0 0 1 1.55 1.56l1.773 1.774a1.224 1.224 0 0 1 1.267 2.025 1.226 1.226 0 0 1-2.002-1.334L8.58 5.963v4.353a1.226 1.226 0 1 1-1.008-.036V5.887a1.226 1.226 0 0 1-.666-1.608L5.093 2.465l-4.79 4.79a1.03 1.03 0 0 0 0 1.457l6.986 6.986a1.03 1.03 0 0 0 1.457 0l6.953-6.953a1.031 1.031 0 0 0 0-1.457"/>
</svg>
</template>
<template id="template-icon-cloud">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M4.406 3.342A5.53 5.53 0 0 1 8 2c2.69 0 4.923 2 5.166 4.579C14.758 6.804 16 8.137 16 9.773 16 11.569 14.502 13 12.687 13H3.781C1.708 13 0 11.366 0 9.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383z"/>
</svg>
</template>
<template id="template-icon-pad">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path fill-rule="evenodd" d="M8 0c-.69 0-1.843.265-2.928.56-1.11.3-2.229.655-2.887.87a1.54 1.54 0 0 0-1.044 1.262c-.596 4.477.787 7.795 2.465 9.99a11.777 11.777 0 0 0 2.517 2.453c.386.273.744.482 1.048.625.28.132.581.24.829.24s.548-.108.829-.24a7.159 7.159 0 0 0 1.048-.625 11.775 11.775 0 0 0 2.517-2.453c1.678-2.195 3.061-5.513 2.465-9.99a1.541 1.541 0 0 0-1.044-1.263 62.467 62.467 0 0 0-2.887-.87C9.843.266 8.69 0 8 0zm0 5a1.5 1.5 0 0 1 .5 2.915l.385 1.99a.5.5 0 0 1-.491.595h-.788a.5.5 0 0 1-.49-.595l.384-1.99A1.5 1.5 0 0 1 8 5z"/>
</svg>
</template>
<template id="template-link-item">
<li class="panel-list-item link" data-url="">
<div class="icon"></div>
<div class="text"></div>
<div class="text-shortcut"></div>
</li>
</template>
<template id="template-calendar-entry">
<div class="calendar-entry">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label=""> <svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M11 6.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1z"/> <path d="M3 2a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v13h1.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1H3V2zm1 13h8V2H4v13z" />
<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/> <path d="M9 9a1 1 0 1 0 2 0 1 1 0 0 0-2 0z" />
</svg> </svg>
<div> </template>
<template id="template-icon-open">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M8.5 10c-.276 0-.5-.448-.5-1s.224-1 .5-1 .5.448.5 1-.224 1-.5 1z" />
<path d="M10.828.122A.5.5 0 0 1 11 .5V1h.5A1.5 1.5 0 0 1 13 2.5V15h1.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1H3V1.5a.5.5 0 0 1 .43-.495l7-1a.5.5 0 0 1 .398.117zM11.5 2H11v13h1V2.5a.5.5 0 0 0-.5-.5zM4 1.934V15h6V1.077l-6 .857z" />
</svg>
</template>
<template id="template-state">
<svg></svg>
<span></span>
<time datetime=""></time>
</template>
<template id="template-icon-homepage">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path fill-rule="evenodd" d="m8 3.293 6 6V13.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5V9.293l6-6zm5-.793V6l-2-2V2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5z" />
<path fill-rule="evenodd" d="M7.293 1.5a1 1 0 0 1 1.414 0l6.647 6.646a.5.5 0 0 1-.708.708L8 2.207 1.354 8.854a.5.5 0 1 1-.708-.708L7.293 1.5z" />
</svg>
</template>
<template id="template-icon-wiki">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 640 512" fill="currentColor" role="img" aria-level="">
<path d="M640 51.2l-.3 12.2c-28.1.8-45 15.8-55.8 40.3-25 57.8-103.3 240-155.3 358.6H415l-81.9-193.1c-32.5 63.6-68.3 130-99.2 193.1-.3.3-15 0-15-.3C172 352.3 122.8 243.4 75.8 133.4 64.4 106.7 26.4 63.4.2 63.7c0-3.1-.3-10-.3-14.2h161.9v13.9c-19.2 1.1-52.8 13.3-43.3 34.2 21.9 49.7 103.6 240.3 125.6 288.6 15-29.7 57.8-109.2 75.3-142.8-13.9-28.3-58.6-133.9-72.8-160-9.7-17.8-36.1-19.4-55.8-19.7V49.8l142.5.3v13.1c-19.4.6-38.1 7.8-29.4 26.1 18.9 40 30.6 68.1 48.1 104.7 5.6-10.8 34.7-69.4 48.1-100.8 8.9-20.6-3.9-28.6-38.6-29.4.3-3.6 0-10.3.3-13.6 44.4-.3 111.1-.3 123.1-.6v13.6c-22.5.8-45.8 12.8-58.1 31.7l-59.2 122.8c6.4 16.1 63.3 142.8 69.2 156.7L559.2 91.8c-8.6-23.1-36.4-28.1-47.2-28.3V49.6l127.8 1.1.2.5z" />
</svg>
</template>
<template id="template-icon-git">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M15.698 7.287 8.712.302a1.03 1.03 0 0 0-1.457 0l-1.45 1.45 1.84 1.84a1.223 1.223 0 0 1 1.55 1.56l1.773 1.774a1.224 1.224 0 0 1 1.267 2.025 1.226 1.226 0 0 1-2.002-1.334L8.58 5.963v4.353a1.226 1.226 0 1 1-1.008-.036V5.887a1.226 1.226 0 0 1-.666-1.608L5.093 2.465l-4.79 4.79a1.03 1.03 0 0 0 0 1.457l6.986 6.986a1.03 1.03 0 0 0 1.457 0l6.953-6.953a1.031 1.031 0 0 0 0-1.457" />
</svg>
</template>
<template id="template-icon-cloud">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M4.406 3.342A5.53 5.53 0 0 1 8 2c2.69 0 4.923 2 5.166 4.579C14.758 6.804 16 8.137 16 9.773 16 11.569 14.502 13 12.687 13H3.781C1.708 13 0 11.366 0 9.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383z" />
</svg>
</template>
<template id="template-icon-pad">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path fill-rule="evenodd" d="M8 0c-.69 0-1.843.265-2.928.56-1.11.3-2.229.655-2.887.87a1.54 1.54 0 0 0-1.044 1.262c-.596 4.477.787 7.795 2.465 9.99a11.777 11.777 0 0 0 2.517 2.453c.386.273.744.482 1.048.625.28.132.581.24.829.24s.548-.108.829-.24a7.159 7.159 0 0 0 1.048-.625 11.775 11.775 0 0 0 2.517-2.453c1.678-2.195 3.061-5.513 2.465-9.99a1.541 1.541 0 0 0-1.044-1.263 62.467 62.467 0 0 0-2.887-.87C9.843.266 8.69 0 8 0zm0 5a1.5 1.5 0 0 1 .5 2.915l.385 1.99a.5.5 0 0 1-.491.595h-.788a.5.5 0 0 1-.49-.595l.384-1.99A1.5 1.5 0 0 1 8 5z" />
</svg>
</template>
<template id="template-link-item">
<li class="panel-list-item link" data-url="">
<div class="icon"></div>
<div class="text"></div>
<div class="text-shortcut"></div>
</li>
</template>
<template id="template-calendar-entry">
<div class="calendar-entry">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M11 6.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1z" />
<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z" />
</svg>
<div> <div>
<strong></strong> <div>
<time datetime=""></time> <strong></strong>
<time datetime=""></time>
</div>
</div> </div>
</div> </div>
</div> </template>
</template> <template id="template-calendar-entry-location">
<template id="template-calendar-entry-location"> <div>(<address></address>)</div>
<div>(<address></address>)</div> </template>
</template> </head>
</head> <body>
<body> <section>
<section> <h2 id="currentState"></h2>
<h2 id="currentState"></h2> <div id="state"></div>
<div id="state"></div> </section>
</section> <section>
<section> <h2 id="links"></h2>
<h2 id="links"></h2> <ul id="link-list" class="panel-section panel-section-list"></ul>
<ul id="link-list" class="panel-section panel-section-list"></ul> </section>
</section> <section>
<section> <h2 id="nextEvent"></h2>
<h2 id="nextEvent"></h2> <div id="calendar"></div>
<div id="calendar"></div> </section>
</section> <section class="no-padding">
<section class="no-padding"> <details>
<details> <summary><h2 id="spaceApiJson"></h2></summary>
<summary><h2 id="spaceApiJson"></h2></summary> <pre id="space-api"><code></code></pre>
<pre id="space-api"><code></code></pre> </details>
</details> </section>
</section>
<!-- [INJECT-BROWSER-POLYFILL] --> <!-- [INJECT-BROWSER-POLYFILL] -->
<script type="module" src="popup.js"></script> <script type="module" src="popup.js"></script>
</body> </body>
</html> </html>

View File

@ -1,6 +1,6 @@
import { QUICK_LINKS } from './config.js'; import { QUICK_LINKS } from './config.js';
const dateTimeFormat = Intl.DateTimeFormat([], {dateStyle: 'medium', timeStyle: 'short'}); const dateTimeFormat = Intl.DateTimeFormat([], { dateStyle: 'medium', timeStyle: 'short' });
function setL10n() { function setL10n() {
document.querySelector('html').setAttribute('lang', browser.i18n.getUILanguage()); document.querySelector('html').setAttribute('lang', browser.i18n.getUILanguage());
@ -38,7 +38,7 @@ function setLinks() {
*/ */
async function linkElementClickListener(event) { async function linkElementClickListener(event) {
try { try {
await browser.tabs.create({url: event.currentTarget.dataset.url}); await browser.tabs.create({ url: event.currentTarget.dataset.url });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
@ -53,7 +53,7 @@ async function init() {
linkElement.addEventListener('click', linkElementClickListener); linkElement.addEventListener('click', linkElementClickListener);
}); });
const {calendar, spaceApi} = await browser.storage.local.get(['calendar', 'spaceApi']); const { calendar, spaceApi } = await browser.storage.local.get(['calendar', 'spaceApi']);
if (calendar) { if (calendar) {
updateNextEvent(calendar); updateNextEvent(calendar);