feat(map): Implement interactive area overlays
This major update introduces a complete system for visualizing protected areas on the OpenLayers map. It adds a new sync script to process area data and heavily modifies the frontend to support interactive, multi-layer display with custom popups. Additionally, data-sync scripts were refactored to run globally on all configured worlds, simplifying cron automation.
This commit is contained in:
parent
fa94f0e23d
commit
a225feef98
11 changed files with 568 additions and 687 deletions
|
|
@ -96,7 +96,7 @@ a.world-preview:hover {
|
|||
.online-status-badge { font-size: 0.8em; padding: 3px 8px; border-radius: 10px; color: white !important; margin-left: 10px; }
|
||||
.online-status-badge.online { background-color: #3E8E41; }
|
||||
.online-status-badge.offline { background-color: #C0392B; }
|
||||
.online-status-badge.unknown { background-color: #808080; } /* HINZUGEFÜGT */
|
||||
.online-status-badge.unknown { background-color: #808080; }
|
||||
|
||||
/* Welt-Detailseite */
|
||||
.page-nav-buttons { text-align: right; margin-top: 10px; margin-bottom: 15px; }
|
||||
|
|
@ -114,68 +114,17 @@ a.world-preview:hover {
|
|||
.map-sub-info .map-last-update { text-align: right; }
|
||||
.info-box { background-color: #3a3a3a; border: 1px solid #555; padding: 15px; margin-bottom: 20px; border-left: 5px solid #FFD700; border-radius: 3px;}
|
||||
.info-box h3 { margin-top: 0; border-bottom: none; padding-bottom: 0.2em; }
|
||||
|
||||
/* Admin Sektion */
|
||||
.admin-section h3 { margin-top: 2.5em !important; }
|
||||
.admin-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 15px;
|
||||
}
|
||||
.admin-box {
|
||||
background-color: #303030;
|
||||
padding: 15px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #4a4a4a;
|
||||
flex-grow: 0;
|
||||
flex-shrink: 1;
|
||||
flex-basis: calc(50% - 8px);
|
||||
box-sizing: border-box;
|
||||
min-width: 280px;
|
||||
}
|
||||
.admin-grid { display: flex; flex-wrap: wrap; gap: 15px; }
|
||||
.admin-box { background-color: #303030; padding: 15px; border-radius: 5px; border: 1px solid #4a4a4a; flex-grow: 0; flex-shrink: 1; flex-basis: calc(50% - 8px); box-sizing: border-box; min-width: 280px; }
|
||||
.admin-contact-block { display: flex; align-items: center; }
|
||||
.admin-skin-icon { width: 48px; height: 48px; margin-right: 15px; border: 1px solid #666; border-radius: 3px; flex-shrink: 0;}
|
||||
.admin-text-details p { margin: 0.2em 0; }
|
||||
.admin-player-name { font-weight: bold; color: #FFD700; font-size: 1.1em; }
|
||||
.contact-links {
|
||||
margin-top: 10px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid #555;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.contact-button {
|
||||
background-color: #555;
|
||||
color: #ddd;
|
||||
border: 1px solid #666;
|
||||
padding: 3px 8px;
|
||||
font-size: 0.85em;
|
||||
border-radius: 3px;
|
||||
text-decoration: none;
|
||||
position: relative;
|
||||
}
|
||||
.contact-button:hover {
|
||||
background-color: #666;
|
||||
color: #FFA500;
|
||||
text-decoration: none;
|
||||
}
|
||||
.contact-links a[data-title]:hover::after {
|
||||
content: attr(data-title);
|
||||
position: absolute;
|
||||
background-color: #222;
|
||||
color: #fff;
|
||||
padding: 3px 7px;
|
||||
border-radius: 3px;
|
||||
font-size: 0.7rem;
|
||||
white-space: nowrap;
|
||||
z-index: 100;
|
||||
left: 50%;
|
||||
bottom: 125%;
|
||||
transform: translateX(-50%);
|
||||
border: 1px solid #555;
|
||||
}
|
||||
|
||||
.contact-links { margin-top: 10px; padding-top: 10px; border-top: 1px solid #555; display: flex; gap: 8px; flex-wrap: wrap; }
|
||||
.contact-button { background-color: #555; color: #ddd; border: 1px solid #666; padding: 3px 8px; font-size: 0.85em; border-radius: 3px; text-decoration: none; position: relative; }
|
||||
.contact-button:hover { background-color: #666; color: #FFA500; text-decoration: none; }
|
||||
.contact-links a[data-title]:hover::after { content: attr(data-title); position: absolute; background-color: #222; color: #fff; padding: 3px 7px; border-radius: 3px; font-size: 0.7rem; white-space: nowrap; z-index: 100; left: 50%; bottom: 125%; transform: translateX(-50%); border: 1px solid #555; }
|
||||
.server-details p { margin: 0.5em 0; display: flex; align-items: center;} .server-details strong { min-width: 120px; display: inline-block; flex-shrink: 0;}
|
||||
.status-text-colored.online { color: #7CFC00; font-weight: bold; }
|
||||
.status-text-colored.offline { color: #FF4500; font-weight: bold; }
|
||||
|
|
@ -184,16 +133,7 @@ a.world-preview:hover {
|
|||
.copy-button:hover { background: #666; }
|
||||
.player-list-container { margin-top: 1em; }
|
||||
.player-list-grid { display: flex; flex-wrap: wrap; gap: 15px; box-sizing: border-box; }
|
||||
.player-box {
|
||||
background-color: #303030;
|
||||
border: 1px solid #555;
|
||||
border-radius: 5px;
|
||||
padding: 10px;
|
||||
width: calc((100% - 30px) / 3);
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.player-box { background-color: #303030; border: 1px solid #555; border-radius: 5px; padding: 10px; width: calc((100% - 30px) / 3); box-sizing: border-box; display: flex; flex-direction: column; }
|
||||
.player-box.has-server-priv { border-left: 5px solid #FFD700; }
|
||||
.player-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
|
||||
.player-identity { display: flex; align-items: center; }
|
||||
|
|
@ -201,22 +141,12 @@ a.world-preview:hover {
|
|||
.player-icon { width: 40px; height: 40px; margin-right: 10px; border: 1px solid #666; border-radius: 3px; flex-shrink: 0;}
|
||||
.player-name-status { display: flex; align-items: center; }
|
||||
.player-name { font-weight: bold; margin-left: 5px; color: #FFD700; }
|
||||
.privilege-separator {
|
||||
height: 1px;
|
||||
background-color: #555;
|
||||
border: 0;
|
||||
margin: 8px 0;
|
||||
}
|
||||
.privilege-separator { height: 1px; background-color: #555; border: 0; margin: 8px 0; }
|
||||
.player-attributes { font-size: 0.9em; line-height: 1.5; }
|
||||
.player-attributes .icon { margin-right: 8px; cursor: help; font-size: 1.2em; }
|
||||
.player-attributes .icon.privilege { opacity: 0.15; }
|
||||
.player-attributes .icon.privilege.active { opacity: 1; }
|
||||
.player-attributes .icon[data-title]:hover::after, .status-dot[data-title]:hover::after, .player-vitals .icon[data-title]:hover::after {
|
||||
content: attr(data-title); position: absolute; background-color: #222; color: #fff;
|
||||
padding: 3px 7px; border-radius: 3px; font-size: 0.85em; white-space: nowrap;
|
||||
z-index: 100; margin-left: 5px; transform: translateY(-28px);
|
||||
border: 1px solid #555;
|
||||
}
|
||||
.player-attributes .icon[data-title]:hover::after, .status-dot[data-title]:hover::after, .player-vitals .icon[data-title]:hover::after { content: attr(data-title); position: absolute; background-color: #222; color: #fff; padding: 3px 7px; border-radius: 3px; font-size: 0.85em; white-space: nowrap; z-index: 100; margin-left: 5px; transform: translateY(-28px); border: 1px solid #555; }
|
||||
footer { text-align: center; margin-top: 30px; padding: 20px; background-color: #222; color: #aaa; border-top: 2px solid #4A2E0A;}
|
||||
.scrollable-mod-list { max-height: 20em; overflow-y: auto; border: 1px solid #555; padding: 10px; background-color: #303030; margin-top: 0.5em; border-radius: 3px; }
|
||||
ul.mod-list, ul.mod-list ul { list-style-type: none; padding-left: 20px; } ul.mod-list > li { margin-bottom: 0.5em; }
|
||||
|
|
@ -236,315 +166,50 @@ ul.mod-list > li > ul > li { font-size: 0.9em; }
|
|||
.archive-image-container img { max-width: 100%; border: 1px solid #666; background-color: #222; }
|
||||
.archive-image-container p { color: #aaa; }
|
||||
/* Stile für responsive Navigation & Burger-Menü */
|
||||
.responsive-nav {
|
||||
position: relative;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.burger-menu {
|
||||
display: none;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
background-color: #555;
|
||||
border: 1px solid #666;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
padding: 8px;
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
z-index: 101;
|
||||
}
|
||||
.burger-menu:hover {
|
||||
background-color: #666;
|
||||
}
|
||||
.burger-menu span {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 3px;
|
||||
background-color: #FFA500;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.responsive-nav { position: relative; margin-bottom: 15px; }
|
||||
.burger-menu { display: none; width: 40px; height: 40px; background-color: #555; border: 1px solid #666; border-radius: 5px; cursor: pointer; flex-direction: column; justify-content: space-around; align-items: center; padding: 8px; box-sizing: border-box; position: absolute; top: 0; right: 0; z-index: 101; }
|
||||
.burger-menu:hover { background-color: #666; }
|
||||
.burger-menu span { display: block; width: 100%; height: 3px; background-color: #FFA500; border-radius: 3px; }
|
||||
/* Stile für Live/Archiv Umschalter */
|
||||
.section-header-flex {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.map-toggle-controls {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
}
|
||||
.map-toggle-button {
|
||||
background-color: #555;
|
||||
color: #ddd;
|
||||
border: 1px solid #666;
|
||||
padding: 3px 8px;
|
||||
font-size: 0.85em;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.map-toggle-button:hover {
|
||||
background-color: #666;
|
||||
}
|
||||
.map-toggle-button.active {
|
||||
color: #FFA500;
|
||||
border-color: #FFA500;
|
||||
font-weight: bold;
|
||||
}
|
||||
.section-header-flex { display: flex; justify-content: space-between; align-items: center; }
|
||||
.map-toggle-controls { display: flex; gap: 5px; }
|
||||
.map-toggle-button { background-color: #555; color: #ddd; border: 1px solid #666; padding: 3px 8px; font-size: 0.85em; border-radius: 3px; cursor: pointer; }
|
||||
.map-toggle-button:hover { background-color: #666; }
|
||||
.map-toggle-button.active { color: #FFA500; border-color: #FFA500; font-weight: bold; }
|
||||
/* Spielerliste Filter */
|
||||
.filter-container {
|
||||
position: relative;
|
||||
}
|
||||
.filter-dropdown-btn {
|
||||
background-color: #555;
|
||||
color: #ddd;
|
||||
border: 1px solid #666;
|
||||
padding: 3px 8px;
|
||||
font-size: 0.85em;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.filter-dropdown-btn:hover {
|
||||
background-color: #666;
|
||||
}
|
||||
.filter-dropdown {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
right: 0;
|
||||
background-color: #3a3a3a;
|
||||
border: 1px solid #666;
|
||||
border-radius: 5px;
|
||||
padding: 10px;
|
||||
z-index: 100;
|
||||
min-width: 220px;
|
||||
box-shadow: 0 4px 8px rgba(0,0,0,0.5);
|
||||
}
|
||||
.filter-dropdown.show {
|
||||
display: block;
|
||||
}
|
||||
.filter-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 0.9em;
|
||||
font-weight: normal;
|
||||
color: #ddd;
|
||||
}
|
||||
.filter-option:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.filter-option input[type="checkbox"] {
|
||||
margin-right: 8px;
|
||||
}
|
||||
.filter-option .icon {
|
||||
font-size: 1.2em;
|
||||
width: 20px;
|
||||
text-align: center;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.filter-option .status-dot {
|
||||
margin-left: 0;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.filter-container { position: relative; }
|
||||
.filter-dropdown-btn { background-color: #555; color: #ddd; border: 1px solid #666; padding: 3px 8px; font-size: 0.85em; border-radius: 3px; cursor: pointer; }
|
||||
.filter-dropdown-btn:hover { background-color: #666; }
|
||||
.filter-dropdown { display: none; position: absolute; top: 100%; right: 0; background-color: #3a3a3a; border: 1px solid #666; border-radius: 5px; padding: 10px; z-index: 100; min-width: 220px; box-shadow: 0 4px 8px rgba(0,0,0,0.5); }
|
||||
.filter-dropdown.show { display: block; }
|
||||
.filter-option { display: flex; align-items: center; margin-bottom: 8px; cursor: pointer; font-size: 0.9em; font-weight: normal; color: #ddd; }
|
||||
.filter-option:last-child { margin-bottom: 0; }
|
||||
.filter-option input[type="checkbox"] { margin-right: 8px; }
|
||||
.filter-option .icon { font-size: 1.2em; width: 20px; text-align: center; margin-right: 8px; }
|
||||
.filter-option .status-dot { margin-left: 0; margin-right: 8px; }
|
||||
/* Stile für "Weiterlesen"-Funktion */
|
||||
.collapsible-text {
|
||||
max-height: 250px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
transition: max-height 0.5s ease-in-out;
|
||||
}
|
||||
.collapsible-text.expanded {
|
||||
max-height: 10000px;
|
||||
}
|
||||
.collapsible-text::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 80px;
|
||||
background: linear-gradient(to bottom, rgba(68, 68, 68, 0), rgba(68, 68, 68, 1) 100%);
|
||||
pointer-events: none;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
.collapsible-text.expanded::after {
|
||||
opacity: 0;
|
||||
}
|
||||
.read-more-container {
|
||||
text-align: right;
|
||||
margin-top: 5px;
|
||||
}
|
||||
a.read-more-link {
|
||||
font-size: 0.9em;
|
||||
font-weight: bold;
|
||||
}
|
||||
.collapsible-text { max-height: 250px; overflow: hidden; position: relative; transition: max-height 0.5s ease-in-out; }
|
||||
.collapsible-text.expanded { max-height: 10000px; }
|
||||
.collapsible-text::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 80px; background: linear-gradient(to bottom, rgba(68, 68, 68, 0), rgba(68, 68, 68, 1) 100%); pointer-events: none; transition: opacity 0.3s; }
|
||||
.collapsible-text.expanded::after { opacity: 0; }
|
||||
.read-more-container { text-align: right; margin-top: 5px; }
|
||||
a.read-more-link { font-size: 0.9em; font-weight: bold; }
|
||||
/* Schließen-Button (X) */
|
||||
.close-button-container {
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
right: 15px;
|
||||
z-index: 10;
|
||||
}
|
||||
.close-button {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
background-color: #555;
|
||||
color: #ddd;
|
||||
border: 1px solid #666;
|
||||
border-radius: 50%;
|
||||
text-decoration: none;
|
||||
font-size: 1em;
|
||||
line-height: 1;
|
||||
}
|
||||
.close-button:hover {
|
||||
background-color: #C0392B;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
}
|
||||
.close-button-container { position: absolute; top: 15px; right: 15px; z-index: 10; }
|
||||
.close-button { display: inline-flex; justify-content: center; align-items: center; width: 30px; height: 30px; background-color: #555; color: #ddd; border: 1px solid #666; border-radius: 50%; text-decoration: none; font-size: 1em; line-height: 1; }
|
||||
.close-button:hover { background-color: #C0392B; color: white; text-decoration: none; }
|
||||
/* Stile für "Nach oben"-Button */
|
||||
.scroll-to-top-btn {
|
||||
display: none;
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
z-index: 999;
|
||||
background-color: #555;
|
||||
color: #FFA500;
|
||||
border: 1px solid #666;
|
||||
border-radius: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
line-height: 38px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s, opacity 0.3s;
|
||||
}
|
||||
.scroll-to-top-btn:hover {
|
||||
background-color: #666;
|
||||
text-decoration: none;
|
||||
}
|
||||
.scroll-to-top-btn.show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
/* Responsive Stile für Burger-Menü */
|
||||
.responsive-nav {
|
||||
height: 50px;
|
||||
}
|
||||
.burger-menu {
|
||||
display: flex;
|
||||
}
|
||||
.page-nav-buttons {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 45px;
|
||||
right: 0;
|
||||
width: 200px;
|
||||
background-color: #3a3a3a;
|
||||
border: 1px solid #666;
|
||||
border-radius: 5px;
|
||||
z-index: 100;
|
||||
padding: 5px;
|
||||
box-shadow: 0 4px 8px rgba(0,0,0,0.5);
|
||||
}
|
||||
.page-nav-buttons.menu-open {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
.page-nav-buttons .button {
|
||||
text-align: left;
|
||||
margin: 5px;
|
||||
width: auto;
|
||||
}
|
||||
.player-box { width: calc((100% - 15px) / 2); }
|
||||
.page-nav-buttons .button { margin-top: 5px;}
|
||||
|
||||
.world-preview .world-preview-content {
|
||||
flex-direction: column;
|
||||
}
|
||||
.world-preview img {
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
margin-right: 0;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.map-view-container {
|
||||
height: auto;
|
||||
aspect-ratio: 4 / 3;
|
||||
max-height: 70vh;
|
||||
}
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.player-box { width: 100%; }
|
||||
.admin-box { flex-basis: 100%; }
|
||||
}
|
||||
|
||||
.scroll-to-top-btn { display: none; position: fixed; bottom: 20px; right: 20px; z-index: 999; background-color: #555; color: #FFA500; border: 1px solid #666; border-radius: 50%; width: 40px; height: 40px; text-align: center; font-size: 24px; line-height: 38px; cursor: pointer; transition: background-color 0.3s, opacity 0.3s; }
|
||||
.scroll-to-top-btn:hover { background-color: #666; text-decoration: none; }
|
||||
.scroll-to-top-btn.show { display: block; }
|
||||
/* Stile für OpenLayers Popups (Leaflet-Look-and-Feel) */
|
||||
.ol-popup {
|
||||
position: absolute;
|
||||
background-color: #303030;
|
||||
box-shadow: 0 1px 4px rgba(0,0,0,0.4);
|
||||
padding: 1px;
|
||||
border-radius: 5px;
|
||||
bottom: 12px;
|
||||
left: -50px;
|
||||
min-width: 280px;
|
||||
border: 1px solid #555;
|
||||
color: #ddd;
|
||||
}
|
||||
.ol-popup:after, .ol-popup:before {
|
||||
top: 100%;
|
||||
border: solid transparent;
|
||||
content: " ";
|
||||
height: 0;
|
||||
width: 0;
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
.ol-popup:after {
|
||||
border-top-color: #303030;
|
||||
border-width: 10px;
|
||||
left: 48px;
|
||||
margin-left: -10px;
|
||||
}
|
||||
.ol-popup:before {
|
||||
border-top-color: #555;
|
||||
border-width: 11px;
|
||||
left: 48px;
|
||||
margin-left: -11px;
|
||||
}
|
||||
.ol-popup-closer {
|
||||
text-decoration: none;
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 8px;
|
||||
color: #ddd;
|
||||
font-size: 1.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
.ol-popup-closer:hover {
|
||||
color: #fff;
|
||||
}
|
||||
.ol-popup-content {
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
padding: 10px;
|
||||
margin: 0;
|
||||
}
|
||||
/* Stile für den Inhalt innerhalb des Popups */
|
||||
.ol-popup { position: absolute; background-color: #303030; box-shadow: 0 1px 4px rgba(0,0,0,0.4); padding: 1px; border-radius: 5px; bottom: 12px; left: -50px; min-width: 280px; border: 1px solid #555; color: #ddd; }
|
||||
.ol-popup:after, .ol-popup:before { top: 100%; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; pointer-events: none; }
|
||||
.ol-popup:after { border-top-color: #303030; border-width: 10px; left: 48px; margin-left: -10px; }
|
||||
.ol-popup:before { border-top-color: #555; border-width: 11px; left: 48px; margin-left: -11px; }
|
||||
.ol-popup-closer { text-decoration: none; position: absolute; top: 2px; right: 8px; color: #ddd; font-size: 1.5em; font-weight: bold; }
|
||||
.ol-popup-closer:hover { color: #fff; }
|
||||
.ol-popup-content { font-size: 13px; line-height: 1.5; padding: 10px; margin: 0; }
|
||||
.popup-player-box .player-header { display: flex; align-items: center; margin-bottom: 8px; }
|
||||
.popup-player-box .player-identity { display: flex; align-items: center; }
|
||||
.popup-player-box .player-icon { width: 40px; height: 40px; margin-right: 10px; border-radius: 3px; flex-shrink: 0;}
|
||||
|
|
@ -554,3 +219,68 @@ a.read-more-link {
|
|||
.popup-player-box .popup-player-vitals { display: flex; justify-content: space-around; gap: 10px; align-items: center; margin-top: 8px; }
|
||||
.popup-player-box .popup-player-vitals .vital { display: flex; align-items: center; gap: 5px; }
|
||||
.popup-player-box .popup-player-vitals .icon { font-size: 1.2em; }
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.responsive-nav { height: 50px; }
|
||||
.burger-menu { display: flex; }
|
||||
.page-nav-buttons { display: none; position: absolute; top: 45px; right: 0; width: 200px; background-color: #3a3a3a; border: 1px solid #666; border-radius: 5px; z-index: 100; padding: 5px; box-shadow: 0 4px 8px rgba(0,0,0,0.5); }
|
||||
.page-nav-buttons.menu-open { display: flex; flex-direction: column; align-items: stretch; }
|
||||
.page-nav-buttons .button { text-align: left; margin: 5px; width: auto; }
|
||||
.player-box { width: calc((100% - 15px) / 2); }
|
||||
.world-preview .world-preview-content { flex-direction: column; }
|
||||
.world-preview img { width: 100%; max-width: 100%; height: auto; margin-right: 0; margin-bottom: 15px; }
|
||||
.map-view-container { height: auto; aspect-ratio: 4 / 3; max-height: 70vh; }
|
||||
}
|
||||
@media (max-width: 480px) {
|
||||
.player-box { width: 100%; }
|
||||
.admin-box { flex-basis: 100%; }
|
||||
}
|
||||
|
||||
/* KORREKTUR: Stile für OpenLayers Layer Switcher */
|
||||
|
||||
.layer-switcher.shown {
|
||||
background-color: #303030 !important;
|
||||
}
|
||||
|
||||
.layer-switcher button {
|
||||
font-size: 1.2em !important;
|
||||
}
|
||||
|
||||
.layer-switcher button:hover, .layer-switcher button:focus {
|
||||
background-color: #666 !important;
|
||||
}
|
||||
|
||||
.layer-switcher .panel {
|
||||
background-color: #303030 !important;
|
||||
border: 1px solid #555 !important;
|
||||
color: #ddd !important;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.layer-switcher ul {
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
.layer-switcher label {
|
||||
color: #ddd !important;
|
||||
}
|
||||
|
||||
/* NEU: Styling für Checkboxen im Layer-Switcher */
|
||||
.layer-switcher input[type=checkbox],
|
||||
.layer-switcher input[type=radio] {
|
||||
accent-color: #FFA500;
|
||||
vertical-align: middle;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
/* NEU: Vergrößerung der Standard-Karten-Buttons */
|
||||
.ol-zoom .ol-zoom-in,
|
||||
.ol-zoom .ol-zoom-out,
|
||||
.ol-rotate .ol-rotate-reset,
|
||||
.ol-full-screen button {
|
||||
width: 25px !important;
|
||||
height: 25px !important;
|
||||
font-size: 1.5em;
|
||||
line-height: 1;
|
||||
padding: 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@main/dist/en/v7.0.0/legacy/ol.css" type="text/css">
|
||||
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@main/dist/en/v7.0.0/legacy/ol.js"></script>
|
||||
|
||||
<script src="https://unpkg.com/ol-layerswitcher@4.1.1"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/ol-layerswitcher@4.1.1/dist/ol-layerswitcher.css" />
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const scrollToTopBtn = document.getElementById('scrollToTopBtn');
|
||||
|
|
|
|||
|
|
@ -26,32 +26,44 @@
|
|||
// Globale Referenzen
|
||||
window.olMap_%%current_world_key%% = null;
|
||||
window.playerMarkerSource_%%current_world_key%% = new ol.source.Vector();
|
||||
window.parentAreaLayerSource_%%current_world_key%% = new ol.source.Vector();
|
||||
window.subAreaLayerSource_%%current_world_key%% = new ol.source.Vector();
|
||||
window.mapData_%%current_world_key%% = {};
|
||||
|
||||
// Konvertiert Minetest-Koordinaten in OpenLayers-Pixel-Koordinaten
|
||||
function convertMinetestToOpenLayers_%%current_world_key%%(posX, posZ) {
|
||||
const mapData = window.mapData_%%current_world_key%%;
|
||||
if (!mapData || !mapData.mapWidth) return null;
|
||||
|
||||
const percentX = (posX - mapData.minX) / mapData.extentWidth;
|
||||
const percentZ = (posZ - mapData.minZ) / mapData.extentHeight;
|
||||
|
||||
const pixelX = percentX * mapData.mapWidth;
|
||||
const pixelY = - (mapData.mapHeight - (percentZ * mapData.mapHeight));
|
||||
|
||||
return [pixelX, pixelY];
|
||||
}
|
||||
|
||||
function createPolygonFromPos_%%current_world_key%%(pos1, pos2) {
|
||||
const p1 = convertMinetestToOpenLayers_%%current_world_key%%(pos1.x, pos1.z);
|
||||
const p2 = convertMinetestToOpenLayers_%%current_world_key%%(pos2.x, pos2.z);
|
||||
if (!p1 || !p2) return null;
|
||||
const minX = Math.min(p1[0], p2[0]);
|
||||
const minY = Math.min(p1[1], p2[1]);
|
||||
const maxX = Math.max(p1[0], p2[0]);
|
||||
const maxY = Math.max(p1[1], p2[1]);
|
||||
const coordinates = [[ [minX, minY], [maxX, minY], [maxX, maxY], [minX, maxY], [minX, minY] ]];
|
||||
return new ol.geom.Polygon(coordinates);
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const mapContainer = document.getElementById('ol-map-container-%%current_world_key%%');
|
||||
const mapInfoPath = '/%%web_map_info_rel_path%%?v=' + new Date().getTime();
|
||||
const areasPath = '/%%web_areas_json_rel_path%%?v=' + new Date().getTime();
|
||||
|
||||
fetch(mapInfoPath)
|
||||
.then(response => {
|
||||
if (!response.ok) throw new Error('map_info.txt nicht gefunden (Status: ' + response.status + ')');
|
||||
return response.text();
|
||||
})
|
||||
.then(mapInfoText => {
|
||||
Promise.all([
|
||||
fetch(mapInfoPath).then(res => { if (!res.ok) throw new Error('map_info.txt'); return res.text(); }),
|
||||
fetch(areasPath).then(res => { if (!res.ok) return {}; return res.json(); })
|
||||
]).then(([mapInfoText, areaData]) => {
|
||||
|
||||
const mapInfo = (text => {
|
||||
const data = {};
|
||||
text.split('\n').forEach(line => {
|
||||
|
|
@ -60,14 +72,12 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
});
|
||||
return data;
|
||||
})(mapInfoText);
|
||||
|
||||
if (!mapInfo.map_dimension || !mapInfo.map_extent) throw new Error('map_info.txt ist unvollständig.');
|
||||
|
||||
const mapData = window.mapData_%%current_world_key%%;
|
||||
const mapDim = mapInfo.map_dimension.split('x');
|
||||
mapData.mapWidth = parseInt(mapDim[0], 10);
|
||||
mapData.mapHeight = parseInt(mapDim[1], 10);
|
||||
|
||||
const mapExt = mapInfo.map_extent.split(/[+:]/);
|
||||
mapData.minX = parseInt(mapExt[0], 10);
|
||||
mapData.minZ = parseInt(mapExt[1], 10);
|
||||
|
|
@ -78,62 +88,60 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
mapContainer.innerHTML = '';
|
||||
|
||||
const extent = [0, -mapData.mapHeight, mapData.mapWidth, 0];
|
||||
|
||||
// KORREKTUR: Wir trennen die echten von den virtuellen Auflösungen
|
||||
const sourceResolutions = %%RESOLUTIONS_JS_ARRAY%%;
|
||||
|
||||
const viewResolutions = [...sourceResolutions]; // Kopie für die Ansicht
|
||||
const digitalZoomLevels = 3;
|
||||
// HINZUGEFÜGT: Logik für digitalen Zoom wiederhergestellt
|
||||
const maxNativeZoom = sourceResolutions.length -1;
|
||||
const viewResolutions = [...sourceResolutions];
|
||||
const digitalZoomLevels = 3;
|
||||
let lastResolution = viewResolutions[viewResolutions.length - 1];
|
||||
for (let i = 0; i < digitalZoomLevels; i++) {
|
||||
lastResolution = lastResolution / 2;
|
||||
viewResolutions.push(lastResolution);
|
||||
}
|
||||
|
||||
const projection = new ol.proj.Projection({
|
||||
code: 'pixel-map-%%current_world_key%%',
|
||||
units: 'pixels',
|
||||
extent: extent
|
||||
});
|
||||
|
||||
const tileGrid = new ol.tilegrid.TileGrid({
|
||||
origin: ol.extent.getTopLeft(extent),
|
||||
resolutions: sourceResolutions, // Das TileGrid kennt NUR die echten Auflösungen
|
||||
});
|
||||
const projection = new ol.proj.Projection({ code: 'pixel-map-%%current_world_key%%', units: 'pixels', extent: extent });
|
||||
const tileGrid = new ol.tilegrid.TileGrid({ origin: ol.extent.getTopLeft(extent), resolutions: sourceResolutions });
|
||||
|
||||
const tileSource = new ol.source.TileImage({
|
||||
projection: projection,
|
||||
tileGrid: tileGrid,
|
||||
tileUrlFunction: function(tileCoord) {
|
||||
if (!tileCoord) return '';
|
||||
// OpenLayers wählt jetzt selbst die beste verfügbare Kachel aus.
|
||||
// Die URL-Funktion kann wieder einfach sein.
|
||||
return ('/%%web_tiles_rel_path%%/' + tileCoord[0] + '/' + tileCoord[1] + '/' + tileCoord[2] + '.png?v=%%CACHE_BUSTER%%');
|
||||
let z = tileCoord[0]; let x = tileCoord[1]; let y = tileCoord[2];
|
||||
if (z > maxNativeZoom) {
|
||||
const zoomDiff = z - maxNativeZoom;
|
||||
const scale = Math.pow(2, zoomDiff);
|
||||
x = Math.floor(x / scale);
|
||||
y = Math.floor(y / scale);
|
||||
z = maxNativeZoom;
|
||||
}
|
||||
return ('/%%web_tiles_rel_path%%/' + z + '/' + x + '/' + y + '.png?v=%%CACHE_BUSTER%%');
|
||||
}
|
||||
});
|
||||
|
||||
const tileLayer = new ol.layer.Tile({ source: tileSource });
|
||||
const tileLayer = new ol.layer.Tile({ source: tileSource, title: 'Basiskarte', type: 'base' });
|
||||
|
||||
const playerLayer = new ol.layer.Vector({ source: window.playerMarkerSource_%%current_world_key%%, style: f => f.get('style') });
|
||||
const parentAreaStyle = new ol.style.Style({ stroke: new ol.style.Stroke({ color: 'rgba(0, 100, 255, 0.8)', width: 2 }), fill: new ol.style.Fill({ color: 'rgba(0, 100, 255, 0.2)' }) });
|
||||
const subAreaStyle = new ol.style.Style({ stroke: new ol.style.Stroke({ color: 'rgba(0, 100, 255, 0.8)', width: 1.5, lineDash: [6, 6] }), fill: new ol.style.Fill({ color: 'transparent' }) });
|
||||
const parentAreaLayer = new ol.layer.Vector({ source: window.parentAreaLayerSource_%%current_world_key%%, style: parentAreaStyle, title: 'Grundstücke' });
|
||||
const subAreaLayer = new ol.layer.Vector({ source: window.subAreaLayerSource_%%current_world_key%%, style: subAreaStyle, title: 'Parzellen', visible: false });
|
||||
const playerLayer = new ol.layer.Vector({ source: window.playerMarkerSource_%%current_world_key%%, style: f => f.get('style'), title: 'Spielerpositionen' });
|
||||
|
||||
const view = new ol.View({
|
||||
projection: projection,
|
||||
center: ol.extent.getCenter(extent),
|
||||
resolutions: viewResolutions, // Die View kennt ALLE Auflösungen (echte + digitale)
|
||||
});
|
||||
const overlayLayers = new ol.layer.Group({ title: 'Overlays', layers: [subAreaLayer, parentAreaLayer, playerLayer] });
|
||||
const view = new ol.View({ projection: projection, center: ol.extent.getCenter(extent), resolutions: viewResolutions });
|
||||
|
||||
const popupContainer = document.getElementById('popup-%%current_world_key%%');
|
||||
const popupContent = document.getElementById('popup-content-%%current_world_key%%');
|
||||
const popupCloser = document.getElementById('popup-closer-%%current_world_key%%');
|
||||
|
||||
const overlay = new ol.Overlay({ element: popupContainer, autoPan: { animation: { duration: 250 } } });
|
||||
popupCloser.onclick = () => { overlay.setPosition(undefined); popupCloser.blur(); return false; };
|
||||
|
||||
const mapControls = [ new ol.control.Zoom(), new ol.control.Rotate(), new ol.control.Attribution({ collapsible: false }), new ol.control.FullScreen() ];
|
||||
const mapControls = [ new ol.control.Zoom(), new ol.control.Rotate(), new ol.control.Attribution({ collapsible: false }), new ol.control.FullScreen(), new ol.control.LayerSwitcher() ];
|
||||
|
||||
window.olMap_%%current_world_key%% = new ol.Map({
|
||||
controls: mapControls,
|
||||
layers: [tileLayer, playerLayer],
|
||||
layers: [tileLayer, overlayLayers],
|
||||
overlays: [overlay],
|
||||
target: mapContainer,
|
||||
view: view
|
||||
|
|
@ -142,17 +150,31 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
const map = window.olMap_%%current_world_key%%;
|
||||
map.getView().fit(extent, { size: map.getSize() });
|
||||
|
||||
for (const id in areaData) {
|
||||
const area = areaData[id];
|
||||
const polygon = createPolygonFromPos_%%current_world_key%%(area.pos1, area.pos2);
|
||||
if (polygon) {
|
||||
const feature = new ol.Feature({ geometry: polygon, areaData: area });
|
||||
window.parentAreaLayerSource_%%current_world_key%%.addFeature(feature);
|
||||
}
|
||||
}
|
||||
|
||||
// KORREKTUR: Klick-Handler mit korrekter Priorisierung
|
||||
map.on('click', function(evt) {
|
||||
const feature = map.forEachFeatureAtPixel(evt.pixel, f => f);
|
||||
|
||||
// Reset
|
||||
overlay.setPosition(undefined);
|
||||
popupCloser.blur();
|
||||
|
||||
// Priorität 1: Spieler-Marker
|
||||
const playerFeature = map.forEachFeatureAtPixel(evt.pixel, (f, l) => l === playerLayer ? f : undefined);
|
||||
if (playerFeature) {
|
||||
window.subAreaLayerSource_%%current_world_key%%.clear(); // Sub-Areas ausblenden, wenn ein Spieler geklickt wird
|
||||
subAreaLayer.setVisible(false);
|
||||
|
||||
if (feature) {
|
||||
const playerData = feature.get('playerData');
|
||||
const playerData = playerFeature.get('playerData');
|
||||
if (playerData) {
|
||||
const statusDotClass = feature.get('statusDotClass');
|
||||
const lastLoginFormatted = feature.get('lastLoginFormatted');
|
||||
const statusDotClass = playerFeature.get('statusDotClass');
|
||||
const lastLoginFormatted = playerFeature.get('lastLoginFormatted');
|
||||
const popupHTML = `
|
||||
<div class='popup-player-box'>
|
||||
<div class="player-header">
|
||||
|
|
@ -172,8 +194,39 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
</div>
|
||||
</div>`;
|
||||
popupContent.innerHTML = popupHTML;
|
||||
overlay.setPosition(feature.getGeometry().getCoordinates());
|
||||
overlay.setPosition(playerFeature.getGeometry().getCoordinates());
|
||||
}
|
||||
return; // Verarbeitung hier beenden
|
||||
}
|
||||
|
||||
// Priorität 2: Hauptgrundstück (nur wenn kein Spieler geklickt wurde)
|
||||
window.subAreaLayerSource_%%current_world_key%%.clear(); // Alte Sub-Areas immer entfernen
|
||||
const areaFeature = map.forEachFeatureAtPixel(evt.pixel, (f, l) => l === parentAreaLayer ? f : undefined);
|
||||
if (areaFeature) {
|
||||
const areaData = areaFeature.get('areaData');
|
||||
if (areaData.sub_areas && areaData.sub_areas.length > 0) {
|
||||
const sub_features = [];
|
||||
areaData.sub_areas.forEach(sub => {
|
||||
const sub_polygon = createPolygonFromPos_%%current_world_key%%(sub.pos1, sub.pos2);
|
||||
if(sub_polygon) sub_features.push(new ol.Feature({ geometry: sub_polygon }));
|
||||
});
|
||||
window.subAreaLayerSource_%%current_world_key%%.addFeatures(sub_features);
|
||||
subAreaLayer.setVisible(true);
|
||||
} else {
|
||||
subAreaLayer.setVisible(false);
|
||||
}
|
||||
|
||||
let popupHTML = `<strong>${areaData.name}</strong><br>Besitzer: ${areaData.owner}`;
|
||||
if (areaData.sub_areas && areaData.sub_areas.length > 0) {
|
||||
popupHTML += `<hr class="privilege-separator"><p><strong>Parzellen:</strong></p><ul>`;
|
||||
areaData.sub_areas.forEach(sub => { popupHTML += `<li>${sub.name} (${sub.owner})</li>`; });
|
||||
popupHTML += `</ul>`;
|
||||
}
|
||||
popupContent.innerHTML = popupHTML;
|
||||
overlay.setPosition(evt.coordinate);
|
||||
} else {
|
||||
// Wenn nichts geklickt wurde, auch die sub-areas ausblenden
|
||||
subAreaLayer.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -183,7 +236,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Fehler beim Initialisieren der Karte:", error);
|
||||
console.error("Fehler beim Initialisieren der Karte oder der Grundstücksdaten:", error);
|
||||
mapContainer.innerHTML = "<p><em>Karte konnte nicht initialisiert werden: " + error.message + "</em></p>";
|
||||
});
|
||||
|
||||
|
|
@ -191,19 +244,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
const archiveBtn = document.getElementById('toggle-archive-btn-%%current_world_key%%');
|
||||
const liveContainer = document.getElementById('live-map-container-%%current_world_key%%');
|
||||
const archiveContainer = document.getElementById('archive-view-container-%%current_world_key%%');
|
||||
|
||||
if (liveBtn && archiveBtn && liveContainer && archiveContainer) {
|
||||
liveBtn.addEventListener('click', () => {
|
||||
liveBtn.classList.add('active'); archiveBtn.classList.remove('active');
|
||||
liveContainer.style.display = 'block'; archiveContainer.style.display = 'none';
|
||||
if (window.olMap_%%current_world_key%%) {
|
||||
setTimeout(() => window.olMap_%%current_world_key%%.updateSize(), 10);
|
||||
}
|
||||
});
|
||||
archiveBtn.addEventListener('click', () => {
|
||||
archiveBtn.classList.add('active'); liveBtn.classList.remove('active');
|
||||
archiveContainer.style.display = 'block'; liveContainer.style.display = 'none';
|
||||
});
|
||||
liveBtn.addEventListener('click', () => { liveContainer.style.display = 'block'; archiveContainer.style.display = 'none'; if (window.olMap_%%current_world_key%%) { setTimeout(() => window.olMap_%%current_world_key%%.updateSize(), 10); } });
|
||||
archiveBtn.addEventListener('click', () => { archiveContainer.style.display = 'block'; liveContainer.style.display = 'none'; });
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue