This commit is contained in:
2024-10-03 17:29:42 +03:00
parent 0e20c69b78
commit f30e6e090b
23 changed files with 1429 additions and 33 deletions

266
books/test copy.html Normal file
View File

@@ -0,0 +1,266 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Manager Overview</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@1/css/pico.min.css">
<style>
body {
padding: 20px;
}
.breadcrumb {
margin-bottom: 20px;
}
.breadcrumb a {
color: #007bff;
text-decoration: none;
}
.breadcrumb a:hover {
text-decoration: underline;
}
.file-list {
list-style-type: none;
padding: 0;
}
.file-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 5px 10px;
border-bottom: 1px solid #e0e0e0;
cursor: pointer;
}
.file-item:hover {
background-color: #f5f5f5;
}
.file-name {
flex-grow: 1;
}
.folder-item {
font-weight: bold;
background-color: #e6f2ff;
}
.folder-item:hover {
background-color: #d9e9ff;
}
.context-menu, .modal {
display: none;
position: fixed;
z-index: 1000;
}
.context-menu {
background-color: #ffffff;
border: 1px solid #ccc;
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
padding: 5px 0;
}
.context-menu button {
display: block;
width: 100%;
padding: 5px 20px;
text-align: left;
border: none;
background: none;
cursor: pointer;
color: #333;
}
.context-menu button:hover {
background-color: #f0f0f0;
}
.modal {
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.4);
}
.modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 500px;
}
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
cursor: pointer;
}
.close:hover,
.close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
#fileSystem {
border: 1px solid #ccc;
padding: 10px;
margin-top: 10px;
}
</style>
</head>
<body>
<main class="container">
<div class="breadcrumb">
<a href="#">Home</a> / <a href="#">Documents</a> / Current Folder
</div>
<h1>File Manager</h1>
<ul class="file-list">
<li class="file-item folder-item" data-type="folder" data-items="5" data-modified="2023-05-12">
<span class="file-name">Documents</span>
<span class="file-size">5 items</span>
</li>
<li class="file-item" data-type="file" data-size="10 KB" data-modified="2023-05-15">
<span class="file-name">document.txt</span>
<span class="file-size">10 KB</span>
</li>
<li class="file-item" data-type="file" data-size="2 MB" data-modified="2023-05-14">
<span class="file-name">image.jpg</span>
<span class="file-size">2 MB</span>
</li>
<li class="file-item" data-type="file" data-size="500 KB" data-modified="2023-05-13">
<span class="file-name">spreadsheet.xlsx</span>
<span class="file-size">500 KB</span>
</li>
</ul>
</main>
<div id="contextMenu" class="context-menu">
<button id="moveBtn">Move</button>
<button id="copyBtn">Copy</button>
<button id="deleteBtn">Delete</button>
</div>
<div id="infoModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
<h2 id="modalTitle"></h2>
<p id="modalInfo"></p>
</div>
</div>
<div id="copyModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
<h2>Copy to:</h2>
<div id="fileSystem">
<ul>
<li>Home
<ul>
<li>Documents</li>
<li>Pictures</li>
<li>Music</li>
</ul>
</li>
<li>Desktop</li>
<li>Downloads</li>
</ul>
</div>
<button id="confirmCopy">Copy Here</button>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const fileItems = document.querySelectorAll('.file-item');
const contextMenu = document.getElementById('contextMenu');
const moveBtn = document.getElementById('moveBtn');
const copyBtn = document.getElementById('copyBtn');
const deleteBtn = document.getElementById('deleteBtn');
const infoModal = document.getElementById('infoModal');
const copyModal = document.getElementById('copyModal');
const modalTitle = document.getElementById('modalTitle');
const modalInfo = document.getElementById('modalInfo');
const closeBtns = document.getElementsByClassName('close');
const confirmCopyBtn = document.getElementById('confirmCopy');
let selectedFile = null;
fileItems.forEach(item => {
item.addEventListener('click', () => {
showModal(item);
});
item.addEventListener('contextmenu', (e) => {
e.preventDefault();
selectedFile = item.querySelector('.file-name').textContent;
showContextMenu(e.clientX, e.clientY);
});
});
document.addEventListener('click', (e) => {
if (!contextMenu.contains(e.target)) {
hideContextMenu();
}
});
function showContextMenu(x, y) {
contextMenu.style.display = 'block';
contextMenu.style.left = `${x}px`;
contextMenu.style.top = `${y}px`;
}
function hideContextMenu() {
contextMenu.style.display = 'none';
}
function showModal(item) {
const name = item.querySelector('.file-name').textContent;
const type = item.dataset.type;
const size = item.dataset.size;
const modified = item.dataset.modified;
const items = item.dataset.items;
modalTitle.textContent = name;
modalInfo.innerHTML = `
<p>Type: ${type}</p>
${type === 'file' ? `<p>Size: ${size}</p>` : `<p>Items: ${items}</p>`}
<p>Last Modified: ${modified}</p>
`;
infoModal.style.display = 'block';
}
Array.from(closeBtns).forEach(btn => {
btn.onclick = function() {
infoModal.style.display = 'none';
copyModal.style.display = 'none';
}
});
window.onclick = function(event) {
if (event.target == infoModal) {
infoModal.style.display = 'none';
}
if (event.target == copyModal) {
copyModal.style.display = 'none';
}
}
moveBtn.addEventListener('click', () => {
alert(`Moving ${selectedFile}`);
hideContextMenu();
});
copyBtn.addEventListener('click', () => {
copyModal.style.display = 'block';
hideContextMenu();
});
confirmCopyBtn.addEventListener('click', () => {
alert(`Copying ${selectedFile} to selected location`);
copyModal.style.display = 'none';
});
deleteBtn.addEventListener('click', () => {
alert(`Deleting ${selectedFile}`);
hideContextMenu();
});
});
</script>
</body>
</html>

285
books/test.html Normal file
View File

@@ -0,0 +1,285 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Manager Overview</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@1/css/pico.min.css">
<style>
body {
padding: 20px;
}
.breadcrumb {
margin-bottom: 20px;
font-size: 0.9em;
}
.breadcrumb a {
color: #007bff;
text-decoration: none;
}
.breadcrumb a:hover {
text-decoration: underline;
}
.file-list {
list-style-type: none;
padding: 0;
}
.file-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 5px 10px;
border-bottom: 1px solid #e0e0e0;
cursor: pointer;
}
.file-item:hover {
background-color: #f5f5f5;
}
.file-name {
flex-grow: 1;
}
.folder-item {
font-weight: bold;
background-color: #e6f2ff;
}
.folder-item:hover {
background-color: #d9e9ff;
}
.context-menu, .modal {
display: none;
position: fixed;
z-index: 1000;
}
.context-menu {
background-color: #ffffff;
border: 1px solid #ccc;
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
padding: 5px 0;
}
.context-menu button {
display: block;
width: 100%;
padding: 5px 20px;
text-align: left;
border: none;
background: none;
cursor: pointer;
color: #333;
}
.context-menu button:hover {
background-color: #f0f0f0;
}
.modal {
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.4);
}
.modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 500px;
}
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
cursor: pointer;
}
.close:hover,
.close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
#fileSystem {
border: 1px solid #ccc;
padding: 10px;
margin-top: 10px;
font-size: 0.9em;
}
#fileSystem .file-item {
font-size: 0.9em;
}
#fileSystem .breadcrumb {
font-size: 0.8em;
margin-bottom: 10px;
}
</style>
</head>
<body>
<main class="container">
<div class="breadcrumb">
<a href="#">Home</a> / <a href="#">Documents</a> / Current Folder
</div>
<h1>File Manager</h1>
<ul class="file-list">
<li class="file-item folder-item" data-type="folder" data-items="5" data-modified="2023-05-12">
<span class="file-name">Documents</span>
<span class="file-size">5 items</span>
</li>
<li class="file-item" data-type="file" data-size="10 KB" data-modified="2023-05-15">
<span class="file-name">document.txt</span>
<span class="file-size">10 KB</span>
</li>
<li class="file-item" data-type="file" data-size="2 MB" data-modified="2023-05-14">
<span class="file-name">image.jpg</span>
<span class="file-size">2 MB</span>
</li>
<li class="file-item" data-type="file" data-size="500 KB" data-modified="2023-05-13">
<span class="file-name">spreadsheet.xlsx</span>
<span class="file-size">500 KB</span>
</li>
</ul>
</main>
<div id="contextMenu" class="context-menu">
<button id="moveBtn">Move</button>
<button id="copyBtn">Copy</button>
<button id="deleteBtn">Delete</button>
</div>
<div id="infoModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
<h2 id="modalTitle"></h2>
<p id="modalInfo"></p>
</div>
</div>
<div id="copyModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
<h2>Copy to:</h2>
<div id="fileSystem">
<div class="breadcrumb">
<a href="#">Home</a> / <a href="#">Documents</a>
</div>
<ul class="file-list">
<li class="file-item folder-item" data-type="folder" data-items="3">
<span class="file-name">Pictures</span>
<span class="file-size">3 items</span>
</li>
<li class="file-item folder-item" data-type="folder" data-items="2">
<span class="file-name">Music</span>
<span class="file-size">2 items</span>
</li>
<li class="file-item" data-type="file" data-size="15 KB">
<span class="file-name">notes.txt</span>
<span class="file-size">15 KB</span>
</li>
<li class="file-item" data-type="file" data-size="1.2 MB">
<span class="file-name">report.pdf</span>
<span class="file-size">1.2 MB</span>
</li>
</ul>
</div>
<button id="confirmCopy">Copy Here</button>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const fileItems = document.querySelectorAll('.file-item');
const contextMenu = document.getElementById('contextMenu');
const moveBtn = document.getElementById('moveBtn');
const copyBtn = document.getElementById('copyBtn');
const deleteBtn = document.getElementById('deleteBtn');
const infoModal = document.getElementById('infoModal');
const copyModal = document.getElementById('copyModal');
const modalTitle = document.getElementById('modalTitle');
const modalInfo = document.getElementById('modalInfo');
const closeBtns = document.getElementsByClassName('close');
const confirmCopyBtn = document.getElementById('confirmCopy');
let selectedFile = null;
fileItems.forEach(item => {
item.addEventListener('click', () => {
showModal(item);
});
item.addEventListener('contextmenu', (e) => {
e.preventDefault();
selectedFile = item.querySelector('.file-name').textContent;
showContextMenu(e.clientX, e.clientY);
});
});
document.addEventListener('click', (e) => {
if (!contextMenu.contains(e.target)) {
hideContextMenu();
}
});
function showContextMenu(x, y) {
contextMenu.style.display = 'block';
contextMenu.style.left = `${x}px`;
contextMenu.style.top = `${y}px`;
}
function hideContextMenu() {
contextMenu.style.display = 'none';
}
function showModal(item) {
const name = item.querySelector('.file-name').textContent;
const type = item.dataset.type;
const size = item.dataset.size;
const modified = item.dataset.modified;
const items = item.dataset.items;
modalTitle.textContent = name;
modalInfo.innerHTML = `
<p>Type: ${type}</p>
${type === 'file' ? `<p>Size: ${size}</p>` : `<p>Items: ${items}</p>`}
<p>Last Modified: ${modified}</p>
`;
infoModal.style.display = 'block';
}
Array.from(closeBtns).forEach(btn => {
btn.onclick = function() {
infoModal.style.display = 'none';
copyModal.style.display = 'none';
}
});
window.onclick = function(event) {
if (event.target == infoModal) {
infoModal.style.display = 'none';
}
if (event.target == copyModal) {
copyModal.style.display = 'none';
}
}
moveBtn.addEventListener('click', () => {
alert(`Moving ${selectedFile}`);
hideContextMenu();
});
copyBtn.addEventListener('click', () => {
copyModal.style.display = 'block';
hideContextMenu();
});
confirmCopyBtn.addEventListener('click', () => {
alert(`Copying ${selectedFile} to selected location`);
copyModal.style.display = 'none';
});
deleteBtn.addEventListener('click', () => {
alert(`Deleting ${selectedFile}`);
hideContextMenu();
});
});
</script>
</body>
</html>

View File

@@ -1 +0,0 @@
- [Test Page](test/test.md)

168
books/test2.html Normal file
View File

@@ -0,0 +1,168 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Storage Interface</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
h1 {
text-align: center;
}
#file-list {
list-style-type: none;
padding: 0;
}
#file-list li {
margin-bottom: 10px;
padding: 10px;
background-color: #f0f0f0;
border-radius: 5px;
}
#file-list button {
margin-left: 10px;
}
</style>
</head>
<body>
<h1>File Storage Interface</h1>
<input type="file" id="file-input">
<button onclick="uploadFile()">Upload</button>
<h2>File List</h2>
<ul id="file-list"></ul>
<script>
class FileStorage {
constructor() {
this.storage = localStorage;
}
upload(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = (event) => {
const fileData = event.target.result;
const fileInfo = {
name: file.name,
size: file.size,
type: file.type,
data: fileData
};
this.storage.setItem(file.name, JSON.stringify(fileInfo));
resolve(fileInfo);
};
reader.onerror = (error) => reject(error);
reader.readAsDataURL(file);
});
}
download(fileName) {
const fileInfo = this.getFileInfo(fileName);
if (!fileInfo) {
throw new Error('File not found');
}
const link = document.createElement('a');
link.href = fileInfo.data;
link.download = fileInfo.name;
link.click();
}
delete(fileName) {
this.storage.removeItem(fileName);
}
list() {
return Object.keys(this.storage)
.map(key => this.getFileInfo(key))
.filter(fileInfo => fileInfo !== null)
.map(fileInfo => ({
name: fileInfo.name,
size: fileInfo.size
}));
}
stat(fileName) {
const fileInfo = this.getFileInfo(fileName);
if (!fileInfo) {
throw new Error('File not found');
}
return {
name: fileInfo.name,
size: fileInfo.size
};
}
getFileInfo(fileName) {
try {
const fileInfo = JSON.parse(this.storage.getItem(fileName));
if (fileInfo && fileInfo.name && fileInfo.size) {
return fileInfo;
}
} catch (error) {
console.warn(`Invalid file info for ${fileName}:`, error);
}
return null;
}
}
const fileStorage = new FileStorage();
function uploadFile() {
const fileInput = document.getElementById('file-input');
const file = fileInput.files[0];
if (file) {
fileStorage.upload(file).then(() => {
updateFileList();
fileInput.value = '';
});
}
}
function downloadFile(fileName) {
fileStorage.download(fileName);
}
function deleteFile(fileName) {
fileStorage.delete(fileName);
updateFileList();
}
function updateFileList() {
const fileList = document.getElementById('file-list');
fileList.innerHTML = '';
const files = fileStorage.list();
files.forEach(file => {
const li = document.createElement('li');
li.textContent = `${file.name} (${formatSize(file.size)})`;
const downloadBtn = document.createElement('button');
downloadBtn.textContent = 'Download';
downloadBtn.onclick = () => downloadFile(file.name);
const deleteBtn = document.createElement('button');
deleteBtn.textContent = 'Delete';
deleteBtn.onclick = () => deleteFile(file.name);
li.appendChild(downloadBtn);
li.appendChild(deleteBtn);
fileList.appendChild(li);
});
}
function formatSize(bytes) {
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
let size = bytes;
let unitIndex = 0;
while (size >= 1024 && unitIndex < units.length - 1) {
size /= 1024;
unitIndex++;
}
return `${size.toFixed(2)} ${units[unitIndex]}`;
}
updateFileList();
</script>
</body>
</html>

View File

@@ -1,3 +1,12 @@
- [Intro](tfgrid4specs/intro.md)
- [Test](tfgrid4specs/test.md)
- [Test2](tech/energy_efficient.md)
- [bootstrap](tfgrid4specs/bootstrap.md)
- [bootstrap_zos](tfgrid4specs/bootstrap_zos.md)
- [zinit 2](tfgrid4specs/zinit2.md)
- [zinit_registration](tfgrid4specs/zinit_registration.md)
- [zinit_units_config](tfgrid4specs/zinit_units_config.md)
- [zinit_flist.md](tfgrid4specs/zinit_flist.md)
- [zinit_runc.md](tfgrid4specs/zinit_runc.md)
- [components](tfgrid4specs/components.md)
- [components_tech](tfgrid4specs/components_tech.md)
- [openrpc](tfgrid4specs/openrpc.md)
- [openrpc_openapi_spec](tfgrid4specs/openrpc_openapi_spec.md)