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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>UniShare</title>
|
| 7 |
+
<style>
|
| 8 |
+
body {
|
| 9 |
+
font-family: Arial, sans-serif;
|
| 10 |
+
margin: 0;
|
| 11 |
+
padding: 0;
|
| 12 |
+
background: #f0f2f5;
|
| 13 |
+
}
|
| 14 |
+
header {
|
| 15 |
+
background: #3b82f6;
|
| 16 |
+
color: white;
|
| 17 |
+
padding: 1em;
|
| 18 |
+
text-align: center;
|
| 19 |
+
font-size: 1.8em;
|
| 20 |
+
}
|
| 21 |
+
#overview {
|
| 22 |
+
display: grid;
|
| 23 |
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
| 24 |
+
gap: 1em;
|
| 25 |
+
padding: 1em;
|
| 26 |
+
}
|
| 27 |
+
.list-tile {
|
| 28 |
+
background: white;
|
| 29 |
+
padding: 1em;
|
| 30 |
+
border-radius: 10px;
|
| 31 |
+
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
| 32 |
+
cursor: pointer;
|
| 33 |
+
transition: transform 0.2s;
|
| 34 |
+
}
|
| 35 |
+
.list-tile:hover {
|
| 36 |
+
transform: scale(1.02);
|
| 37 |
+
}
|
| 38 |
+
#list-view {
|
| 39 |
+
display: none;
|
| 40 |
+
padding: 1em;
|
| 41 |
+
}
|
| 42 |
+
.back-button {
|
| 43 |
+
background: #3b82f6;
|
| 44 |
+
color: white;
|
| 45 |
+
padding: 0.5em 1em;
|
| 46 |
+
border: none;
|
| 47 |
+
border-radius: 5px;
|
| 48 |
+
cursor: pointer;
|
| 49 |
+
margin-bottom: 1em;
|
| 50 |
+
}
|
| 51 |
+
.card {
|
| 52 |
+
background: white;
|
| 53 |
+
padding: 1em;
|
| 54 |
+
border-radius: 10px;
|
| 55 |
+
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
| 56 |
+
margin-bottom: 1em;
|
| 57 |
+
}
|
| 58 |
+
.submenu {
|
| 59 |
+
margin-top: 1em;
|
| 60 |
+
}
|
| 61 |
+
.submenu h4 {
|
| 62 |
+
margin: 0.5em 0;
|
| 63 |
+
}
|
| 64 |
+
.grid {
|
| 65 |
+
display: grid;
|
| 66 |
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
| 67 |
+
gap: 1em;
|
| 68 |
+
}
|
| 69 |
+
.item {
|
| 70 |
+
background: #f9f9f9;
|
| 71 |
+
padding: 1em;
|
| 72 |
+
border-radius: 10px;
|
| 73 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
|
| 74 |
+
}
|
| 75 |
+
.item img {
|
| 76 |
+
max-width: 100%;
|
| 77 |
+
max-height: 150px;
|
| 78 |
+
object-fit: cover;
|
| 79 |
+
border-radius: 5px;
|
| 80 |
+
margin-bottom: 0.5em;
|
| 81 |
+
}
|
| 82 |
+
.item a {
|
| 83 |
+
display: inline-block;
|
| 84 |
+
margin-top: 0.5em;
|
| 85 |
+
text-decoration: none;
|
| 86 |
+
color: #3b82f6;
|
| 87 |
+
}
|
| 88 |
+
#toast {
|
| 89 |
+
position: fixed;
|
| 90 |
+
bottom: 20px;
|
| 91 |
+
right: 20px;
|
| 92 |
+
background: #333;
|
| 93 |
+
color: white;
|
| 94 |
+
padding: 1em;
|
| 95 |
+
border-radius: 5px;
|
| 96 |
+
display: none;
|
| 97 |
+
z-index: 1000;
|
| 98 |
+
}
|
| 99 |
+
</style>
|
| 100 |
+
</head>
|
| 101 |
+
<body>
|
| 102 |
+
<header>UniShare</header>
|
| 103 |
+
<div id="overview"></div>
|
| 104 |
+
<div id="list-view">
|
| 105 |
+
<button class="back-button" onclick="backToOverview()">← Back to Overview</button>
|
| 106 |
+
<div id="content"></div>
|
| 107 |
+
</div>
|
| 108 |
+
<div id="toast"></div>
|
| 109 |
+
|
| 110 |
+
<script>
|
| 111 |
+
const urlParams = new URLSearchParams(window.location.search);
|
| 112 |
+
const overviewDiv = document.getElementById('overview');
|
| 113 |
+
const contentDiv = document.getElementById('content');
|
| 114 |
+
const listViewDiv = document.getElementById('list-view');
|
| 115 |
+
const toastDiv = document.getElementById('toast');
|
| 116 |
+
|
| 117 |
+
const lists = {};
|
| 118 |
+
|
| 119 |
+
function showToast(message) {
|
| 120 |
+
toastDiv.textContent = message;
|
| 121 |
+
toastDiv.style.display = 'block';
|
| 122 |
+
setTimeout(() => {
|
| 123 |
+
toastDiv.style.display = 'none';
|
| 124 |
+
}, 3000);
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
function backToOverview() {
|
| 128 |
+
listViewDiv.style.display = 'none';
|
| 129 |
+
overviewDiv.style.display = 'grid';
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
function showList(name) {
|
| 133 |
+
const sections = lists[name];
|
| 134 |
+
contentDiv.innerHTML = '';
|
| 135 |
+
|
| 136 |
+
sections.forEach(section => {
|
| 137 |
+
const card = document.createElement('div');
|
| 138 |
+
card.className = 'card';
|
| 139 |
+
const title = document.createElement('h3');
|
| 140 |
+
title.textContent = section.sectionTitle;
|
| 141 |
+
card.appendChild(title);
|
| 142 |
+
|
| 143 |
+
const grid = document.createElement('div');
|
| 144 |
+
grid.className = 'grid';
|
| 145 |
+
|
| 146 |
+
section.items.forEach(item => {
|
| 147 |
+
const div = document.createElement('div');
|
| 148 |
+
div.className = 'item';
|
| 149 |
+
let content = <strong>${item.title}</strong><br>;
|
| 150 |
+
if (item.link.match(/\.(jpeg|jpg|gif|png)$/)) {
|
| 151 |
+
content += <img src="${item.link}" alt="${item.title}" />;
|
| 152 |
+
}
|
| 153 |
+
content += <a href="${item.link}" download>Download</a>;
|
| 154 |
+
div.innerHTML = content;
|
| 155 |
+
grid.appendChild(div);
|
| 156 |
+
});
|
| 157 |
+
|
| 158 |
+
card.appendChild(grid);
|
| 159 |
+
contentDiv.appendChild(card);
|
| 160 |
+
});
|
| 161 |
+
|
| 162 |
+
overviewDiv.style.display = 'none';
|
| 163 |
+
listViewDiv.style.display = 'block';
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
// Load from single ?lists= parameter with NEWLISTBREAK separator
|
| 167 |
+
if (urlParams.has('lists')) {
|
| 168 |
+
const rawData = decodeURIComponent(urlParams.get('lists'));
|
| 169 |
+
const listStrings = rawData.split('NEWLISTBREAK');
|
| 170 |
+
|
| 171 |
+
listStrings.forEach((listStr, index) => {
|
| 172 |
+
try {
|
| 173 |
+
const parsed = JSON.parse(listStr);
|
| 174 |
+
if (Array.isArray(parsed)) {
|
| 175 |
+
const listName = List ${index + 1};
|
| 176 |
+
lists[listName] = parsed;
|
| 177 |
+
const tile = document.createElement('div');
|
| 178 |
+
tile.className = 'list-tile';
|
| 179 |
+
tile.innerHTML = <strong>${listName}</strong><br>${parsed.length} sections;
|
| 180 |
+
tile.onclick = () => showList(listName);
|
| 181 |
+
overviewDiv.appendChild(tile);
|
| 182 |
+
showToast(Loaded ${listName});
|
| 183 |
+
}
|
| 184 |
+
} catch (e) {
|
| 185 |
+
console.warn('Failed to parse list:', e);
|
| 186 |
+
}
|
| 187 |
+
});
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
if (Object.keys(lists).length === 0) {
|
| 191 |
+
overviewDiv.innerHTML = '<p style="padding:1em">No valid list data found in ?lists parameter.</p>';
|
| 192 |
+
}
|
| 193 |
+
</script>
|
| 194 |
+
</body>
|
| 195 |
+
</html>
|