Files
Trashbox/template.html

244 lines
10 KiB
HTML
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0">
<title>Trashbox</title>
<link rel="shortcut icon" href="/logo.png" type="image/png">
<link rel="stylesheet" href="/cgi-bin/style.cgi">
<meta property="og:image" content="https://home.mashup.su/og.png" />
<meta property="og:image:width" content="600" />
<meta property="og:image:height" content="315" />
<meta property="og:locale" content="ru_RU" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Файлопомойка от RomkaZVO" />
<meta property="og:description" content="Моя личная помоечка" />
<meta property="og:url" content="https://home.mashup.su/" />
<meta property="og:site_name" content="Помойка от RomkaZVO" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Файлопомойка от RomkaZVO" />
<meta name="twitter:description" content="Моя личная помоечка" />
<meta name="twitter:image" content="https://home.mashup.su/og.png" />
<meta name="description" content="Моя личная помоечка" />
<meta name="keywords" content="файлы, обмен, скачать, загрузить" />
<script>
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}
(function() {
const savedTheme = getCookie('theme');
if (savedTheme === 'dark') {
document.documentElement.classList.add('dark-theme');
}
})();
</script>
</head>
<body>
<button class="theme-toggle" onclick="toggleTheme()">🌙</button>
<div class="container">
<div class="header">
<h1>Trashbox</h1>
<div style="margin-top: 0.5rem; opacity: 0.9; font-size: 1.1rem;">
Моя личная помоечка
</div>
</div>
<div class="content">
<!--BREADCRUMB-->
<!--CONTENT-->
</div>
</div>
<footer class="footer">
<div class="footer-content">
<span>Навайбкодил с любовью ❤️</span>
<a href="https://romkazvo.ru" target="_blank" class="footer-link">RomkaZVO</a><br>
Сделано при помощи BusyBox httpd и nginx для SSL<br>
Боже, храни Китай партия за DeepSeek
</div>
<div id="status" style="margin-top: 1rem; font-size: 0.8rem; opacity: 0.7; line-height: 1.4;">
Загрузка статистики...
</div>
<script>
fetch('/cgi-bin/status.cgi')
.then(response => response.text())
.then(data => {
document.getElementById('status').innerHTML = data;
})
.catch(err => {
document.getElementById('status').innerHTML = 'Ошибка загрузки статуса';
});
</script>
</footer>
<button class="scroll-top" onclick="scrollToTop()"></button>
<!-- Модальное окно предпросмотра -->
<div id="previewModal" class="preview-modal">
<div class="preview-content" id="previewContent">
<div class="preview-header">
<h3 class="preview-title" id="previewTitle">Предпросмотр файла</h3>
<button class="close-preview" onclick="closePreview()">×</button>
</div>
<iframe id="previewFrame" class="preview-iframe" sandbox="allow-scripts allow-same-origin"></iframe>
</div>
</div>
<script>
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
}
window.addEventListener('scroll', function() {
const scrollBtn = document.querySelector('.scroll-top');
if (window.scrollY > 300) {
scrollBtn.classList.add('visible');
} else {
scrollBtn.classList.remove('visible');
}
});
function toggleTheme() {
const isDark = document.body.classList.contains('dark-theme');
const newTheme = isDark ? 'light' : 'dark';
document.body.classList.toggle('dark-theme');
document.documentElement.classList.toggle('dark-theme');
const button = document.querySelector('.theme-toggle');
button.textContent = isDark ? '🌙' : '☀️';
const date = new Date();
date.setFullYear(date.getFullYear() + 1);
document.cookie = `theme=${newTheme}; expires=${date.toUTCString()}; path=/`;
}
// Функции для предпросмотра файлов
function openPreview(fileUrl) {
const modal = document.getElementById('previewModal');
const frame = document.getElementById('previewFrame');
const content = document.getElementById('previewContent');
const title = document.getElementById('previewTitle');
// Получаем имя файла из URL
const fileName = fileUrl.split('/').pop();
title.textContent = `Предпросмотр: ${fileName}`;
// Определяем тип файла для адаптивного масштабирования
const fileExt = fileName.split('.').pop().toLowerCase();
const imageTypes = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp', 'svg', 'ico'];
const textTypes = ['txt', 'md', 'html', 'htm', 'css', 'js', 'json', 'xml', 'csv'];
const audioTypes = ['mp3', 'wav', 'ogg', 'flac', 'm4a', 'aac'];
const videoTypes = ['mp4', 'webm', 'ogv', 'mov', 'avi', 'mkv'];
const isPDF = fileExt === 'pdf';
// Устанавливаем размеры в зависимости от типа файла
if (imageTypes.includes(fileExt)) {
// Для изображений - автоматический размер
content.style.width = 'auto';
content.style.height = 'auto';
content.style.maxWidth = '90vw';
content.style.maxHeight = '90vh';
} else if (textTypes.includes(fileExt)) {
// Для текстовых файлов - компактное окно
content.style.width = '80vw';
content.style.height = '70vh';
content.style.maxWidth = '800px';
content.style.maxHeight = '600px';
} else if (audioTypes.includes(fileExt)) {
// Для аудио - маленькое окно
content.style.width = '500px';
content.style.height = '300px';
content.style.maxWidth = '90vw';
content.style.maxHeight = '400px';
} else if (videoTypes.includes(fileExt)) {
// Для видео - большое окно
content.style.width = '90vw';
content.style.height = '80vh';
content.style.maxWidth = '1200px';
content.style.maxHeight = '800px';
} else if (isPDF) {
// Для PDF - большое окно
content.style.width = '90vw';
content.style.height = '90vh';
content.style.maxWidth = '1200px';
content.style.maxHeight = '900px';
frame.classList.add('pdf');
} else {
// По умолчанию - средний размер
content.style.width = '80vw';
content.style.height = '80vh';
content.style.maxWidth = '1000px';
content.style.maxHeight = '800px';
}
// Просто открываем файл напрямую в iframe
frame.src = fileUrl;
// Показываем модальное окно
modal.style.display = 'block';
document.body.style.overflow = 'hidden';
}
function closePreview() {
const modal = document.getElementById('previewModal');
const frame = document.getElementById('previewFrame');
const content = document.getElementById('previewContent');
// Скрываем модальное окно и сбрасываем iframe
modal.style.display = 'none';
frame.src = '';
frame.classList.remove('pdf');
// Сбрасываем стили
content.style.width = '';
content.style.height = '';
content.style.maxWidth = '';
content.style.maxHeight = '';
document.body.style.overflow = 'auto';
}
// Закрытие модального окна по клику вне контента
document.getElementById('previewModal').addEventListener('click', function(e) {
if (e.target === this) {
closePreview();
}
});
// Закрытие по ESC
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
closePreview();
}
});
document.addEventListener('DOMContentLoaded', function() {
const savedTheme = getCookie('theme');
const button = document.querySelector('.theme-toggle');
if (savedTheme === 'dark') {
document.body.classList.add('dark-theme');
button.textContent = '☀️';
} else {
document.body.classList.remove('dark-theme');
button.textContent = '🌙';
}
document.body.classList.add('loaded');
});
document.addEventListener('touchstart', function() {}, { passive: true });
</script>
</body>
</html>