init (move to laptop from pc)

This commit is contained in:
Alexander Popov 2023-08-03 21:18:50 +03:00
commit 5420715adc
29 changed files with 6094 additions and 0 deletions

28
.editorconfig Normal file
View File

@ -0,0 +1,28 @@
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[.posthtmlrc]
indent_style = space
indent_size = 2
[{*.html,*.css,*.json}]
indent_style = tab
indent_size = 4
[{*.js,package.json}]
indent_style = space
indent_size = 2
[humans.txt]
indent_style = tab
indent_size = 2
[*.md]
trim_trailing_whitespace = false

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.parcel-cache/
ec*.exe

5
.posthtmlrc Normal file
View File

@ -0,0 +1,5 @@
{
"plugins": {
"posthtml-include": {}
}
}

5
.prettierignore Normal file
View File

@ -0,0 +1,5 @@
public/index.*
app/assets/css/bootstrap*
app/assets/js/bootstrap*
package.json
package-lock.json

1
.prettierrc.json Normal file
View File

@ -0,0 +1 @@
{ "singleQuote": true }

1
app/assets/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
bootstrap*.min.*

38
app/assets/css/styles.css Normal file
View File

@ -0,0 +1,38 @@
@import url('bootstrap-v5.3.1.min.css');
.nav-masthead .nav-link {
color: rgba(255, 255, 255, 0.5);
border-bottom: 0.25rem solid transparent;
}
.nav-masthead .nav-link:hover,
.nav-masthead .nav-link:focus {
border-bottom-color: rgba(255, 255, 255, 0.25);
}
.nav-masthead .nav-link + .nav-link {
margin-left: 1rem;
}
.nav-masthead .active {
color: #fff;
border-bottom-color: #fff;
}
.text-shadow {
text-shadow: 0 0.05rem 0.1rem rgba(0, 0, 0, 0.5);
}
svg.svg-icon {
flex-shrink: 0;
width: 1em;
height: 1em;
transition: transform 0.2s ease-in-out;
}
.btn-icon {
display: inline-flex;
gap: 0.375rem;
align-items: center;
justify-content: center;
}

79
app/assets/js/app.js Normal file
View File

@ -0,0 +1,79 @@
/* main */
window.onload = function () {
let app = document.documentElement;
if (
window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches
) {
switch_theme('dark');
} else {
switch_theme('light');
}
// theme switcher
document
.getElementById('app_theme_switcher')
.addEventListener('click', switch_theme, false);
// routes handler
window.addEventListener('hashchange', location_handler);
location_handler();
};
/* Изменяет тему приложения */
function switch_theme() {
let app = document.documentElement;
let theme = app.getAttribute('data-bs-theme');
let theme_switcher = document.getElementById('app_theme_switcher');
let theme_icon = {
dark: '☀️',
light: '🌙',
};
if (theme == 'auto' || theme == 'light') {
theme_switcher.innerText = theme_icon['dark'];
app.setAttribute('data-bs-theme', 'dark');
} else {
theme_switcher.innerText = theme_icon['light'];
app.setAttribute('data-bs-theme', 'light');
}
}
const location_handler = async () => {
let location = window.location.hash.replace('#', '');
if (location.length == 0) {
location = '/';
}
const route = routes[location] || routes['404'];
const html = await fetch(route.template).then((response) => response.text());
document.getElementById('content').innerHTML = html;
document.title = route.title;
document
.querySelector('meta[name="description"]')
.setAttribute('content', route.description);
};
const routes = {
404: {
template: '/pages/404.html',
title: '404',
description: 'Page not found',
},
'/': {
template: '/pages/home.html',
title: 'Home',
description: '...',
},
about: {
template: '/pages/about.html',
title: 'About Us',
description: '...',
},
games: {
template: '/pages/games.html',
title: 'Games',
description: '...',
},
};

BIN
app/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

34
app/index.html Normal file
View File

@ -0,0 +1,34 @@
<!doctype html>
<html lang="en" class="h-100" data-bs-theme="auto">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>a2s</title>
<meta name="description" content="" />
<link rel="manifest" href="manifest.json" />
<style>
@import './assets/css/styles.css';
</style>
<script type="module">
import './assets/js/app.js';
</script>
<link rel="icon" type="image/png" href="favicon.png" />
</head>
<body class="d-flex h-100 text-bg-dark">
<div class="cover-container d-flex w-100 h-100 p-3 mx-auto flex-column">
<!-- app header -->
<include src="app/partitial/header.html"></include>
<!-- app working window -->
<main>
<div class="d-flex gap-3">
<include src="app/partitial/menu.html"></include>
<div class="flex-fill card shadow p-3" id="content"></div>
</div>
</main>
<!-- app footer -->
<include src="app/partitial/footer.html"></include>
</div>
</body>
</html>

34
app/manifest.json Normal file
View File

@ -0,0 +1,34 @@
{
"name": "a2s",
"icons": [
{
"src": "/icons/72.png",
"sizes": "72x72",
"type": "image/png",
"density": "1.5"
},
{
"src": "/icons/96.png",
"sizes": "96x96",
"type": "image/png",
"density": "2.0"
},
{
"src": "/icons/144.png",
"sizes": "144x144",
"type": "image/png",
"density": "3.0"
},
{
"src": "/icons/192.png",
"sizes": "192x192",
"type": "image/png",
"density": "4.0"
},
{
"src": "/icons/512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}

View File

@ -0,0 +1,7 @@
<footer class="text-center mt-3 text-white-50">
<p class="text-shadow m-0">// licking and assemble //</p>
<p class="font-monospace">
build:
<a class="text-reset" href="#" target="_blank">ab6324f</a>
</p>
</footer>

55
app/partitial/header.html Normal file
View File

@ -0,0 +1,55 @@
<header class="mb-3">
<div class="text-shadow">
<h3 id="app_title" class="float-md-start mb-0">
<span class="font-monospace">inet://home/</span>
</h3>
<nav class="nav nav-masthead justify-content-center float-md-end">
<a class="nav-link fw-bold py-1 px-0 icon-link" href="/">
<svg
class="svg-icon"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="feather feather-home"
>
<path
d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"
></path>
<polyline points="9 22 9 12 15 12 15 22"></polyline>
</svg>
Home
</a>
<a class="nav-link fw-bold py-1 px-0 icon-link" href="#about">
<svg
class="svg-icon"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="feather feather-info"
>
<circle cx="12" cy="12" r="10"></circle>
<line x1="12" y1="16" x2="12" y2="12"></line>
<line x1="12" y1="8" x2="12.01" y2="8"></line>
</svg>
About
</a>
<a
id="app_theme_switcher"
class="nav-link fw-bold py-1 px-0"
href="#"
></a>
</nav>
</div>
</header>

93
app/partitial/menu.html Normal file
View File

@ -0,0 +1,93 @@
<ul class="dropdown-menu d-block position-static shadow">
<li>
<a class="dropdown-item d-flex gap-2 align-items-center" href="#games">
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="feather feather-activity"
>
<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline>
</svg>
Games
</a>
</li>
<li><hr class="dropdown-divider" /></li>
<li>
<a
class="dropdown-item d-flex gap-2 align-items-center"
href="https://ё.a2s.su/"
target="_blank"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="feather feather-book"
>
<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path>
<path
d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"
></path>
</svg>
Буква <span class="font-monospace">ё</span>
</a>
</li>
<li><hr class="dropdown-divider" /></li>
<li>
<a class="dropdown-item d-flex gap-2 align-items-center" href="#">
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="feather feather-user"
>
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
<circle cx="12" cy="7" r="4"></circle>
</svg>
Personal
</a>
</li>
<li>
<a class="dropdown-item d-flex gap-2 align-items-center" href="#">
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="feather feather-trash-2"
>
<polyline points="3 6 5 6 21 6"></polyline>
<path
d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"
></path>
<line x1="10" y1="11" x2="10" y2="17"></line>
<line x1="14" y1="11" x2="14" y2="17"></line>
</svg>
Trash
</a>
</li>
</ul>

BIN
icons/120.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
icons/144.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
icons/16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

BIN
icons/192.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
icons/32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

BIN
icons/512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
icons/72.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
icons/96.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

5676
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

21
package.json Normal file
View File

@ -0,0 +1,21 @@
{
"private": true,
"name": "a2s",
"version": "1.0.0",
"description": "ololo",
"scripts": {
"serve": "npx parcel serve --dist-dir public app/index.html",
"build": "npx parcel build --dist-dir public app/index.html",
"prettier": "npx prettier --write .",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Alexander Popov <iiiypuk@fastmail.fm>",
"license": "WTFPL",
"devDependencies": {
"@parcel/packager-raw-url": "^2.9.3",
"@parcel/transformer-webmanifest": "^2.9.3",
"parcel": "^2.9.3",
"posthtml-include": "^1.7.4",
"prettier": "3.0.1"
}
}

3
public/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
index.*
manifest.webmanifest
*.png

1
public/pages/404.html Normal file
View File

@ -0,0 +1 @@
404

9
public/pages/about.html Normal file
View File

@ -0,0 +1,9 @@
<p>
<span class="font-monospace">a2s.su</span>
— домен, который я купил очень давно, но так и не придумал, для чего его
использовать.
</p>
<p>
В первую очередь, я не придумал как расшифровать
<span class="font-monospace">a2s.su</span>.
</p>

1
public/pages/games.html Normal file
View File

@ -0,0 +1 @@
Games

1
public/pages/home.html Normal file
View File

@ -0,0 +1 @@
<p>sdololo</p>