update
This commit is contained in:
229
app/static/css/components.css
Normal file
229
app/static/css/components.css
Normal file
@ -0,0 +1,229 @@
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
margin: 0;
|
||||
flex-grow: 1;
|
||||
text-align: center;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
.settings {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.icon-button {
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
margin: 5px;
|
||||
border-radius: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background-color 0.3s, border-color 0.3s;
|
||||
}
|
||||
|
||||
.settings-menu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
right: 0;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.settings-menu.visible {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.group {
|
||||
margin-bottom: 15px; /* Reduced margin between groups */
|
||||
}
|
||||
|
||||
.group-title {
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
margin-top: 10px; /* Reduced margin above group title */
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
.group-icon {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.router-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.router {
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
padding: 20px 15px; /* Added padding top and bottom */
|
||||
margin: 15px; /* Added margin between boxes */
|
||||
flex: 1 1 calc(33.333% - 40px); /* Adjusted for new margin */
|
||||
max-width: calc(33.333% - 40px); /* Adjusted for new margin */
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
transition: box-shadow 0.3s ease;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.router svg {
|
||||
font-size: 32px; /* Made the icon bigger */
|
||||
margin-right: 15px; /* Added padding between icon and text */
|
||||
}
|
||||
|
||||
.router:hover {
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.router h2 {
|
||||
font-size: 18px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.router div {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.router p {
|
||||
font-size: 14px;
|
||||
margin: 5px 0 0;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 20px; /* Added padding to the left and right of the webpage */
|
||||
padding-bottom: 60px
|
||||
}
|
||||
|
||||
/* List mode styles */
|
||||
.list-mode .content {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.list-mode .group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 1 calc(33.333% - 40px); /* Adjusted for new margin */
|
||||
max-width: calc(33.333% - 40px); /* Adjusted for new margin */
|
||||
margin: 0 15px 15px 15px;
|
||||
}
|
||||
|
||||
.list-mode .group-title {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.list-mode .router-container {
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.list-mode .router {
|
||||
max-width: 100%;
|
||||
margin: 1px 0; /* Adjusted margin between routers */
|
||||
}
|
||||
|
||||
.router:first-child {
|
||||
margin-top: 15px; /* Adjusted margin between routers */
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
padding: 10px 0;
|
||||
box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.search-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
border-radius: 20px;
|
||||
padding: 5px 10px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
|
||||
.search-bar i {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#clear-search, #start-search {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.search-bar input {
|
||||
width: 100%;
|
||||
border: none;
|
||||
background: none;
|
||||
outline: none;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 1024px) {
|
||||
body:not(.list-mode) .router {
|
||||
flex: 1 1 calc(50% - 40px); /* Adjusted for new margin */
|
||||
max-width: calc(50% - 40px); /* Adjusted for new margin */
|
||||
}
|
||||
|
||||
.list-mode .group {
|
||||
flex: 1 1 calc(50% - 40px); /* Adjusted for new margin */
|
||||
max-width: calc(50% - 40px); /* Adjusted for new margin */
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
body:not(.list-mode) .router {
|
||||
flex: 1 1 calc(50% - 40px); /* Adjusted for new margin */
|
||||
max-width: calc(50% - 40px); /* Adjusted for new margin */
|
||||
}
|
||||
|
||||
.list-mode .group {
|
||||
flex: 1 1 calc(50% - 40px); /* Adjusted for new margin */
|
||||
max-width: calc(50% - 40px); /* Adjusted for new margin */
|
||||
}
|
||||
.header h1 {
|
||||
font-size: 1.8em;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
body:not(.list-mode) .router {
|
||||
flex: 1 1 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.list-mode .group {
|
||||
flex: 1 1 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
.router:first-child {
|
||||
margin-top: 1px; /* Adjusted margin between routers */
|
||||
}
|
||||
.header h1 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
}
|
||||
|
43
app/static/css/styles.css
Normal file
43
app/static/css/styles.css
Normal file
@ -0,0 +1,43 @@
|
||||
body {
|
||||
font-family: 'Helvetica', 'Arial', sans-serif;
|
||||
margin: 0;
|
||||
transition: background-color 0.3s, color 0.3s;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.group {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.group.collapsed .router-container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.router-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.router {
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
padding: 20px;
|
||||
margin: 10px;
|
||||
flex: 1 1 calc(33.333% - 20px);
|
||||
max-width: calc(33.333% - 20px);
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: box-shadow 0.3s ease;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
/* Custom scrollbar for webkit browsers */
|
||||
body::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
overflow: visible;
|
||||
display: none;
|
||||
}
|
6044
app/static/js/fontawesome.js
Normal file
6044
app/static/js/fontawesome.js
Normal file
File diff suppressed because one or more lines are too long
261
app/static/js/scripts.js
Normal file
261
app/static/js/scripts.js
Normal file
@ -0,0 +1,261 @@
|
||||
let initialWindowHeight;
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
initialWindowHeight = window.innerHeight;
|
||||
|
||||
if (localStorage.getItem("dark-mode") === "true") {
|
||||
document.body.classList.add("dark-mode");
|
||||
document.getElementById('theme-icon').classList.remove('fa-moon');
|
||||
document.getElementById('theme-icon').classList.add('fa-sun');
|
||||
} else {
|
||||
document.getElementById('theme-icon').classList.remove('fa-sun');
|
||||
document.getElementById('theme-icon').classList.add('fa-moon');
|
||||
}
|
||||
|
||||
if (localStorage.getItem("view-mode") === "list") {
|
||||
document.body.classList.add("list-mode");
|
||||
document.getElementById('view-mode-icon').classList.remove('fa-list');
|
||||
document.getElementById('view-mode-icon').classList.add('fa-table');
|
||||
} else {
|
||||
document.getElementById('view-mode-icon').classList.remove('fa-table');
|
||||
document.getElementById('view-mode-icon').classList.add('fa-list');
|
||||
}
|
||||
|
||||
document.querySelectorAll('.group').forEach(group => {
|
||||
const groupName = group.id;
|
||||
const collapsed = group.dataset.collapsed === 'true';
|
||||
if (collapsed) {
|
||||
group.classList.add('collapsed');
|
||||
} else if (localStorage.getItem(`collapsed-${groupName}`) === 'true') {
|
||||
group.classList.add('collapsed');
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("click", function(event) {
|
||||
const settingsMenu = document.getElementById('settings-menu');
|
||||
if (!settingsMenu.contains(event.target) && !event.target.closest('.icon-button')) {
|
||||
settingsMenu.classList.remove('visible');
|
||||
}
|
||||
});
|
||||
|
||||
const searchInput = document.getElementById('search-input');
|
||||
searchInput.addEventListener('input', handleSearch);
|
||||
searchInput.addEventListener('keydown', handleKeyDown);
|
||||
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.key === '/') {
|
||||
event.preventDefault();
|
||||
searchInput.focus();
|
||||
}
|
||||
if (event.key === 'Escape' || event.key === 'Esc') {
|
||||
event.preventDefault();
|
||||
clearSearch();
|
||||
searchInput.blur();
|
||||
}
|
||||
});
|
||||
|
||||
window.visualViewport.addEventListener('resize', adjustFooterPosition);
|
||||
});
|
||||
|
||||
function searchFocus() {
|
||||
document.getElementById('search-input').focus()
|
||||
}
|
||||
|
||||
function toggleDarkMode() {
|
||||
document.body.classList.toggle("dark-mode");
|
||||
const themeIcon = document.getElementById('theme-icon');
|
||||
if (document.body.classList.contains("dark-mode")) {
|
||||
localStorage.setItem("dark-mode", "true");
|
||||
themeIcon.classList.remove('fa-moon');
|
||||
themeIcon.classList.add('fa-sun');
|
||||
} else {
|
||||
localStorage.setItem("dark-mode", "false");
|
||||
themeIcon.classList.remove('fa-sun');
|
||||
themeIcon.classList.add('fa-moon');
|
||||
}
|
||||
}
|
||||
|
||||
function toggleGroup(group) {
|
||||
const groupElement = document.getElementById(group);
|
||||
groupElement.classList.toggle("collapsed");
|
||||
const isCollapsed = groupElement.classList.contains("collapsed");
|
||||
localStorage.setItem(`collapsed-${group}`, isCollapsed);
|
||||
}
|
||||
|
||||
function toggleSettings() {
|
||||
const settingsMenu = document.getElementById('settings-menu');
|
||||
settingsMenu.classList.toggle('visible');
|
||||
}
|
||||
|
||||
function refreshData() {
|
||||
location.reload();
|
||||
}
|
||||
|
||||
function toggleViewMode() {
|
||||
document.body.classList.toggle("list-mode");
|
||||
const viewModeIcon = document.getElementById('view-mode-icon');
|
||||
if (document.body.classList.contains("list-mode")) {
|
||||
localStorage.setItem("view-mode", "list");
|
||||
viewModeIcon.classList.remove('fa-list');
|
||||
viewModeIcon.classList.add('fa-table');
|
||||
} else {
|
||||
localStorage.setItem("view-mode", "box");
|
||||
viewModeIcon.classList.remove('fa-table');
|
||||
viewModeIcon.classList.add('fa-list');
|
||||
}
|
||||
}
|
||||
|
||||
let selectedRouterIndex = -1;
|
||||
|
||||
function handleSearch(event) {
|
||||
const query = event.target.value.toLowerCase();
|
||||
const groups = document.querySelectorAll('.group');
|
||||
const content = document.getElementById('content');
|
||||
|
||||
// Remove the search group if it exists
|
||||
let searchGroup = document.getElementById('search-group');
|
||||
if (searchGroup) {
|
||||
searchGroup.remove();
|
||||
}
|
||||
|
||||
if (query === '') {
|
||||
// Show all original groups
|
||||
groups.forEach(group => group.style.display = '');
|
||||
selectedRouterIndex = -1;
|
||||
} else {
|
||||
// Hide all original groups
|
||||
groups.forEach(group => group.style.display = 'none');
|
||||
|
||||
// Create and show the search group
|
||||
searchGroup = document.createElement('div');
|
||||
searchGroup.id = 'search-group';
|
||||
searchGroup.className = 'group';
|
||||
content.appendChild(searchGroup);
|
||||
|
||||
searchGroup.innerHTML = `
|
||||
<h2 class="group-title"><i class="fas fa-search"></i> ${query}</h2>
|
||||
<div class="router-container"></div>
|
||||
`;
|
||||
|
||||
const routerContainer = searchGroup.querySelector('.router-container');
|
||||
const matchingRouters = [];
|
||||
|
||||
document.querySelectorAll('.router').forEach(router => {
|
||||
const displayName = router.querySelector('h2').textContent.toLowerCase();
|
||||
if (displayName.includes(query)) {
|
||||
const clonedRouter = router.cloneNode(true);
|
||||
matchingRouters.push(clonedRouter);
|
||||
routerContainer.appendChild(clonedRouter);
|
||||
}
|
||||
});
|
||||
|
||||
if (matchingRouters.length > 0) {
|
||||
selectedRouterIndex = 0;
|
||||
matchingRouters[selectedRouterIndex].classList.add('selected');
|
||||
}
|
||||
|
||||
// Scroll to search group
|
||||
document.getElementById("header").scrollIntoView({ behavior: "instant" });
|
||||
}
|
||||
}
|
||||
|
||||
function handleKeyDown(event) {
|
||||
const searchGroup = document.getElementById('search-group');
|
||||
if (!searchGroup) return;
|
||||
|
||||
const matchingRouters = searchGroup.querySelectorAll('.router');
|
||||
if (matchingRouters.length === 0) return;
|
||||
|
||||
const isListMode = document.body.classList.contains('list-mode');
|
||||
const itemsPerRow = getItemsPerRow();
|
||||
|
||||
switch (event.key) {
|
||||
case 'ArrowDown':
|
||||
event.preventDefault();
|
||||
if (isListMode) {
|
||||
if (selectedRouterIndex < matchingRouters.length - 1) {
|
||||
matchingRouters[selectedRouterIndex].classList.remove('selected');
|
||||
selectedRouterIndex++;
|
||||
matchingRouters[selectedRouterIndex].classList.add('selected');
|
||||
matchingRouters[selectedRouterIndex].scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
} else {
|
||||
if (selectedRouterIndex + itemsPerRow < matchingRouters.length) {
|
||||
matchingRouters[selectedRouterIndex].classList.remove('selected');
|
||||
selectedRouterIndex += itemsPerRow;
|
||||
matchingRouters[selectedRouterIndex].classList.add('selected');
|
||||
matchingRouters[selectedRouterIndex].scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'ArrowUp':
|
||||
event.preventDefault();
|
||||
if (isListMode) {
|
||||
if (selectedRouterIndex > 0) {
|
||||
matchingRouters[selectedRouterIndex].classList.remove('selected');
|
||||
selectedRouterIndex--;
|
||||
matchingRouters[selectedRouterIndex].classList.add('selected');
|
||||
matchingRouters[selectedRouterIndex].scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
} else {
|
||||
if (selectedRouterIndex - itemsPerRow >= 0) {
|
||||
matchingRouters[selectedRouterIndex].classList.remove('selected');
|
||||
selectedRouterIndex -= itemsPerRow;
|
||||
matchingRouters[selectedRouterIndex].classList.add('selected');
|
||||
matchingRouters[selectedRouterIndex].scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'ArrowRight':
|
||||
if (!isListMode) {
|
||||
event.preventDefault();
|
||||
if (selectedRouterIndex < matchingRouters.length - 1) {
|
||||
matchingRouters[selectedRouterIndex].classList.remove('selected');
|
||||
selectedRouterIndex++;
|
||||
matchingRouters[selectedRouterIndex].classList.add('selected');
|
||||
matchingRouters[selectedRouterIndex].scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'ArrowLeft':
|
||||
if (!isListMode) {
|
||||
event.preventDefault();
|
||||
if (selectedRouterIndex > 0) {
|
||||
matchingRouters[selectedRouterIndex].classList.remove('selected');
|
||||
selectedRouterIndex--;
|
||||
matchingRouters[selectedRouterIndex].classList.add('selected');
|
||||
matchingRouters[selectedRouterIndex].scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'Enter':
|
||||
event.preventDefault();
|
||||
if (selectedRouterIndex >= 0 && selectedRouterIndex < matchingRouters.length) {
|
||||
matchingRouters[selectedRouterIndex].click();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function getItemsPerRow() {
|
||||
const width = window.innerWidth;
|
||||
if (width <= 480) return 1;
|
||||
if (width <= 1024) return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
function clearSearch() {
|
||||
const searchInput = document.getElementById('search-input');
|
||||
searchInput.value = '';
|
||||
handleSearch({ target: searchInput });
|
||||
}
|
||||
|
||||
function adjustFooterPosition() {
|
||||
const footer = document.querySelector('.footer');
|
||||
const visualViewportHeight = window.visualViewport.height;
|
||||
const bottomOffset = window.innerHeight - visualViewportHeight;
|
||||
|
||||
// Set the bottom position
|
||||
footer.style.bottom = `${bottomOffset}px`;
|
||||
}
|
||||
|
BIN
app/static/tf.png
Normal file
BIN
app/static/tf.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 394 KiB |
Reference in New Issue
Block a user