improve code, doc, tooling
This commit is contained in:
parent
e812aa8feb
commit
863315d77c
|
@ -10,6 +10,8 @@
|
|||
## Install
|
||||
```ssh
|
||||
$ git clone https://gitea.usrspace.at/XimeX/usrspace-browser-addon.git
|
||||
$ npm install -g web-ext
|
||||
$ npm install
|
||||
```
|
||||
|
||||
- Open `about:debugging` or `about:debugging-new` in Firefox
|
||||
|
@ -20,9 +22,8 @@ $ git clone https://gitea.usrspace.at/XimeX/usrspace-browser-addon.git
|
|||
|
||||
## Release
|
||||
```ssh
|
||||
$ git commit -m "release vX.Y"
|
||||
$ git tag vX.Y
|
||||
$ web-ext build -n _usr_space-X.Y.zip
|
||||
$ npm version {major|minor|patch|...}
|
||||
$ web-ext build
|
||||
```
|
||||
|
||||
## Credits
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<title>/usr/space</title>
|
||||
<script type="application/javascript" src="../browser-polyfill.js"></script>
|
||||
<script type="application/javascript" src="../node_modules/webextension-polyfill/dist/browser-polyfill.js"></script>
|
||||
<script type="application/javascript" src="../config.js"></script>
|
||||
<script type="application/javascript" src="index.js"></script>
|
||||
</head>
|
||||
|
|
1187
browser-polyfill.js
1187
browser-polyfill.js
File diff suppressed because it is too large
Load Diff
12
config.js
12
config.js
|
@ -6,19 +6,19 @@ window.Config = {
|
|||
quickLinks: [
|
||||
{
|
||||
url: 'https://www.usrspace.at/',
|
||||
text: 'Homepage'
|
||||
text: 'Homepage',
|
||||
},
|
||||
{
|
||||
url: 'https://wiki.usrspace.at/',
|
||||
text: 'Wiki'
|
||||
text: 'Wiki',
|
||||
},
|
||||
{
|
||||
url: 'https://gitea.usrspace.at/',
|
||||
text: 'Gitea'
|
||||
text: 'Gitea',
|
||||
},
|
||||
{
|
||||
url: 'https://cloud.usrspace.at/',
|
||||
text: 'Nextcloud'
|
||||
}
|
||||
]
|
||||
text: 'Nextcloud',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"manifest_version": 2,
|
||||
"name": "/usr/space",
|
||||
"version": "0.7",
|
||||
"description": "An Add-on for the Hacker-/Maker-Space /usr/space.",
|
||||
"description": "WebExtension for the Hacker-/Maker-Space /usr/space",
|
||||
"icons": {
|
||||
"48": "icons/favicon.svg",
|
||||
"96": "icons/favicon.svg"
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
{
|
||||
"name": "usrspace-browser-addon",
|
||||
"lockfileVersion": 2,
|
||||
"version": "0.7.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "usrspace-browser-addon",
|
||||
"version": "0.7.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"webextension-polyfill": "^0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"web-ext-types": "^3.2.1"
|
||||
}
|
||||
|
@ -13,14 +20,11 @@
|
|||
"resolved": "https://registry.npmjs.org/web-ext-types/-/web-ext-types-3.2.1.tgz",
|
||||
"integrity": "sha512-oQZYDU3W8X867h8Jmt3129kRVKklz70db40Y6OzoTTuzOJpF/dB2KULJUf0txVPyUUXuyzV8GmT3nVvRHoG+Ew==",
|
||||
"dev": true
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"web-ext-types": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/web-ext-types/-/web-ext-types-3.2.1.tgz",
|
||||
"integrity": "sha512-oQZYDU3W8X867h8Jmt3129kRVKklz70db40Y6OzoTTuzOJpF/dB2KULJUf0txVPyUUXuyzV8GmT3nVvRHoG+Ew==",
|
||||
"dev": true
|
||||
"node_modules/webextension-polyfill": {
|
||||
"version": "0.10.0",
|
||||
"resolved": "https://registry.npmjs.org/webextension-polyfill/-/webextension-polyfill-0.10.0.tgz",
|
||||
"integrity": "sha512-c5s35LgVa5tFaHhrZDnr3FpQpjj1BB+RXhLTYUxGqBVN460HkbM8TBtEqdXWbpTKfzwCcjAZVF7zXCYSKtcp9g=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
17
package.json
17
package.json
|
@ -1,5 +1,20 @@
|
|||
{
|
||||
"name": "usrspace-browser-addon",
|
||||
"description": "WebExtension for the Hacker-/Maker-Space /usr/space",
|
||||
"version": "0.7.0",
|
||||
"dependencies": {
|
||||
"webextension-polyfill": "^0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"web-ext-types": "^3.2.1"
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://gitea.usrspace.at/XimeX/usrspace-browser-addon"
|
||||
},
|
||||
"keywords": [
|
||||
"/usr/space"
|
||||
],
|
||||
"author": "Thomas Rupprecht",
|
||||
"license": "MIT"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta charset="utf-8" />
|
||||
<title>/usr/space</title>
|
||||
<link rel="stylesheet" href="index.css" />
|
||||
</head>
|
||||
|
@ -63,7 +63,7 @@
|
|||
</details>
|
||||
</section>
|
||||
|
||||
<script type="application/javascript" src="../browser-polyfill.js"></script>
|
||||
<script type="application/javascript" src="../node_modules/webextension-polyfill/dist/browser-polyfill.js"></script>
|
||||
<script type="application/javascript" src="../config.js"></script>
|
||||
<script type="application/javascript" src="index.js"></script>
|
||||
</body>
|
||||
|
|
|
@ -17,10 +17,11 @@ const doorOpenSVG = `
|
|||
</svg>
|
||||
`;
|
||||
|
||||
const dateTimeFormat = Intl.DateTimeFormat([], {dateStyle: "medium", timeStyle: "short"});
|
||||
|
||||
async function linkElementClickListener(event) {
|
||||
try {
|
||||
const tab = await browser.tabs.create({url: event.currentTarget.dataset.url});
|
||||
// console.log(tab);
|
||||
await browser.tabs.create({url: event.currentTarget.dataset.url});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
@ -67,7 +68,7 @@ function updateNextEvent(nextEvents) {
|
|||
const timeElement = document.createElement('time');
|
||||
strongElement.textContent = nextEventDateEvent.name;
|
||||
timeElement.datetime = beginDate.toISOString();
|
||||
const dateNode = document.createTextNode(beginDate.toLocaleString([], {dateStyle: "medium", timeStyle: "short"}));
|
||||
const dateNode = document.createTextNode(dateTimeFormat.format(beginDate));
|
||||
// divElement.innerText = '';
|
||||
divElement.append(strongElement, ' ', timeElement);
|
||||
timeElement.append(dateNode);
|
||||
|
@ -91,7 +92,7 @@ function updateSpaceApiJson(spaceApi) {
|
|||
function updateState(spaceApi) {
|
||||
const stateElement = document.getElementById('state');
|
||||
const since = new Date(spaceApi.state.lastchange * 1000);
|
||||
const sinceStr = ` seit <time datetime="${since.toISOString()}">${since.toLocaleString([], {dateStyle: "medium", timeStyle: "short"})}</time>`;
|
||||
const sinceStr = ` seit <time datetime="${since.toISOString()}">${dateTimeFormat.format(since)}</time>`;
|
||||
if (spaceApi.state.open) {
|
||||
stateElement.innerHTML = `${doorOpenSVG}Offen ${sinceStr}`;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue