Skip to content

Commit

Permalink
new idea for icon
Browse files Browse the repository at this point in the history
  • Loading branch information
C4illin committed Nov 20, 2023
1 parent 06716ef commit 9aff2bc
Show file tree
Hide file tree
Showing 69 changed files with 29 additions and 30 deletions.
58 changes: 29 additions & 29 deletions lasvecka-node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@ app.get('/data', (req, res) => {
res.send(computeTime());
});

app.get('/favicon.ico', (req, res) => {
let studyweek = computeTime();
let studyweekNum = studyweek.replace('LV ', '').replace('Självstudier', 'S').replace('Tentavecka', 'T');
res.sendFile(`${__dirname}/public/icons/${studyweekNum}/favicon.ico`);
});

app.get('/site.webmanifest', (req, res) => {
let studyweek = computeTime();
let studyweekNum = studyweek.replace('LV ', '').replace('Självstudier', 'S').replace('Tentavecka', 'T');
let manifest = {
"name": "läsvecka.nu",
"short_name": "läsvecka.nu",
"icons": [
{ "src": `/icons/${studyweekNum}/android-chrome-192x192.png`, "sizes": "192x192", "type": "image/png" },
{ "src": `/icons/${studyweekNum}/android-chrome-512x512.png`, "sizes": "512x512", "type": "image/png" }
],
"theme_color": "#1c7bb7",
"background_color": "#90c0de",
"display": "standalone"
};

res.send(manifest);
});

app.listen(port, () => {
console.log(`App listening at http://localhost:${port}`)
})
Expand All @@ -30,9 +54,9 @@ const render = (data) => {
<head>
<meta charset="UTF-8">
<title>läsvecka.nu | ${data.studyweek}</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" id="favicon">
<link rel="apple-touch-icon" sizes="180x180" href="/icons/${data.studyweekNum}/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/icons/${data.studyweekNum}/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/icons/${data.studyweekNum}/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<meta name="description" content="läsvecka.nu ger dig aktuell läsvecka, utan några konstigheter!">
<meta property="og:type" content="website">
Expand All @@ -59,32 +83,8 @@ const render = (data) => {
<body>
<time datetime="${data.week}">${data.studyweek}</time>
<script>
(function () {
console.log('Powered by G.U.D. https://gud.chs.chalmers.se/');
console.log('Source code: https://github.com/gudchalmers/lasvecka');
document.head = document.head || document.getElementsByTagName('head')[0];
var canvas = document.createElement('canvas'),
img = document.createElement('img'),
oldLink = document.getElementById('favicon'),
link = oldLink.cloneNode(true),
week = '${data.studyweekNum}';
if (canvas.getContext) {
canvas.height = canvas.width = 16;
var ctx = canvas.getContext('2d'),
textWidth = ctx.measureText(week).width;
img.onload = function () {
ctx.drawImage(this, 0, 0);
ctx.font = 'bold 10px "helvetica", sans-serif';
ctx.fillStyle = '#066EB0';
ctx.fillText(week, (canvas.width / 2) - (textWidth / 2), 12);
link.href = canvas.toDataURL('image/png');
document.head.removeChild(oldLink);
document.head.appendChild(link);
};
img.src = 'faviconbkg.png';
}
})();
console.log('Powered by G.U.D. https://gud.chs.chalmers.se/');
console.log('Source code: https://github.com/gudchalmers/lasvecka');
setTimeout(function () { location.reload(); }, 25886000);
</script>
</body>
Expand Down
Binary file removed lasvecka-node/public/android-chrome-192x192.png
Binary file not shown.
Binary file removed lasvecka-node/public/android-chrome-512x512.png
Binary file not shown.
Binary file removed lasvecka-node/public/apple-touch-icon.png
Binary file not shown.
Binary file removed lasvecka-node/public/favicon-16x16.png
Binary file not shown.
Binary file removed lasvecka-node/public/favicon-32x32.png
Binary file not shown.
Binary file removed lasvecka-node/public/favicon.ico
Binary file not shown.
Binary file removed lasvecka-node/public/faviconbkg.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/1/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/1/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/1/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/1/favicon.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/2/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/2/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/2/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/2/favicon.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/3/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/3/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/3/favicon.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/4/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/4/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lasvecka-node/public/icons/4/favicon-32x32.png
Binary file added lasvecka-node/public/icons/4/favicon.ico
Binary file not shown.
Binary file added lasvecka-node/public/icons/5/apple-touch-icon.png
Binary file added lasvecka-node/public/icons/5/favicon-16x16.png
Binary file added lasvecka-node/public/icons/5/favicon-32x32.png
Binary file added lasvecka-node/public/icons/5/favicon.ico
Binary file not shown.
Binary file added lasvecka-node/public/icons/6/apple-touch-icon.png
Binary file added lasvecka-node/public/icons/6/favicon-16x16.png
Binary file added lasvecka-node/public/icons/6/favicon-32x32.png
Binary file added lasvecka-node/public/icons/6/favicon.ico
Binary file not shown.
Binary file added lasvecka-node/public/icons/7/apple-touch-icon.png
Binary file added lasvecka-node/public/icons/7/favicon-16x16.png
Binary file added lasvecka-node/public/icons/7/favicon-32x32.png
Binary file added lasvecka-node/public/icons/7/favicon.ico
Binary file not shown.
Binary file added lasvecka-node/public/icons/8/apple-touch-icon.png
Binary file added lasvecka-node/public/icons/8/favicon-16x16.png
Binary file added lasvecka-node/public/icons/8/favicon-32x32.png
Binary file added lasvecka-node/public/icons/8/favicon.ico
Binary file not shown.
Binary file added lasvecka-node/public/icons/S/apple-touch-icon.png
Binary file added lasvecka-node/public/icons/S/favicon-16x16.png
Binary file added lasvecka-node/public/icons/S/favicon-32x32.png
Binary file added lasvecka-node/public/icons/S/favicon.ico
Binary file not shown.
Binary file added lasvecka-node/public/icons/T/apple-touch-icon.png
Binary file added lasvecka-node/public/icons/T/favicon-16x16.png
Binary file added lasvecka-node/public/icons/T/favicon-32x32.png
Binary file added lasvecka-node/public/icons/T/favicon.ico
Binary file not shown.
1 change: 0 additions & 1 deletion lasvecka-node/public/site.webmanifest

This file was deleted.

0 comments on commit 9aff2bc

Please sign in to comment.