Compare commits
	
		
			2 Commits
		
	
	
		
			5cfd8b2319
			...
			c6e441dc26
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| c6e441dc26 | |||
| c89eb37361 | 
							
								
								
									
										13
									
								
								static/js/kiosk_mode.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								static/js/kiosk_mode.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					document.addEventListener('DOMContentLoaded', () => {
 | 
				
			||||||
 | 
						setTimeout(() => {
 | 
				
			||||||
 | 
							// TODO: How to start kiosk mode?
 | 
				
			||||||
 | 
							if (true) {
 | 
				
			||||||
 | 
								console.info('Kiosk mode -> Disabled all external links');
 | 
				
			||||||
 | 
								document.querySelectorAll('a').forEach((link) => {
 | 
				
			||||||
 | 
									if (link.classList.contains('external-link')) {
 | 
				
			||||||
 | 
										link.style.pointerEvents = 'none';
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}, 1000);
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
@@ -79,7 +79,7 @@ function handleImage() {
 | 
				
			|||||||
					}, 1000);
 | 
										}, 1000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					// Set the credits
 | 
										// Set the credits
 | 
				
			||||||
					credits.innerHTML = `Photo by <a href="${data.user.links.html}" target="_blank">${data.user.name}</a>`;
 | 
										credits.innerHTML = `Photo by <a href="${data.user.links.html}" class="external-link" target="_blank">${data.user.name}</a>`;
 | 
				
			||||||
					credits.style.zIndex = 300000;
 | 
										credits.style.zIndex = 300000;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,4 +23,5 @@ hidden {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
footer {
 | 
					footer {
 | 
				
			||||||
	margin-top: auto;
 | 
						margin-top: auto;
 | 
				
			||||||
 | 
						padding: 1rem !important;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,10 +2,11 @@
 | 
				
			|||||||
	<div class="content has-text-centered">
 | 
						<div class="content has-text-centered">
 | 
				
			||||||
		<p>
 | 
							<p>
 | 
				
			||||||
		<i class="bi bi-cup-straw"></i>
 | 
							<i class="bi bi-cup-straw"></i>
 | 
				
			||||||
			<strong>HydrationHUB</strong> by <a target="_blank" rel="noopener noreferrer" href="https://pnh.fyi">[Project-name-here]</a>.<br>
 | 
								<strong>HydrationHUB</strong> by <a target="_blank" rel="noopener noreferrer" href="https://pnh.fyi" class="external-link">[Project-name-here]</a>.<br>
 | 
				
			||||||
			Running Version <span data-dataSource="version" data-dataAction="SPECIAL" class="is-skeleton">Load.</span>
 | 
								Running Version <span data-dataSource="version" data-dataAction="SPECIAL" class="is-skeleton">Load.</span>
 | 
				
			||||||
		</p>
 | 
							</p>
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
</footer>
 | 
					</footer>
 | 
				
			||||||
<script src="/static/apiWrapper.js"></script>
 | 
					<script src="/static/apiWrapper.js"></script>
 | 
				
			||||||
<script src="/static/pageDriver.js"></script>
 | 
					<script src="/static/pageDriver.js"></script>
 | 
				
			||||||
 | 
					<script src="/static/js/kiosk_mode.js"></script>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,74 +2,67 @@
 | 
				
			|||||||
	<div class="navbar-brand">
 | 
						<div class="navbar-brand">
 | 
				
			||||||
		<a class="navbar-item primary" href="/">
 | 
							<a class="navbar-item primary" href="/">
 | 
				
			||||||
			<i class="bi bi-cup-straw"></i>
 | 
								<i class="bi bi-cup-straw"></i>
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		</a>
 | 
							</a>
 | 
				
			||||||
 | 
							<a class="navbar-item primary is-hidden" id="nav_username" href="/">
 | 
				
			||||||
		<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
 | 
								<strong>Hey, <span id="nav_usernameContent"></span></strong>
 | 
				
			||||||
			<span aria-hidden="true"></span>
 | 
					 | 
				
			||||||
			<span aria-hidden="true"></span>
 | 
					 | 
				
			||||||
			<span aria-hidden="true"></span>
 | 
					 | 
				
			||||||
			<span aria-hidden="true"></span>
 | 
					 | 
				
			||||||
		</a>
 | 
							</a>
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	<div id="navbarBasicExample" class="navbar-menu">
 | 
						<div id="navbarBasicExample" class="navbar-menu is-active">
 | 
				
			||||||
		<div class="navbar-start">
 | 
							<div class="navbar-end">
 | 
				
			||||||
			<a class="navbar-item" href="/">Screensaver</a>
 | 
								<div class="navbar-item" id="dynamic-navbar-buttons">
 | 
				
			||||||
			<a class="navbar-item" href="/user_select">user_select</a>
 | 
									<!-- Buttons will be dynamically injected here -->
 | 
				
			||||||
			<a class="navbar-item" href="/product_select">product_select</a>
 | 
								</div>
 | 
				
			||||||
			<a class="navbar-item" href="/test">Test <span class="tag is-info">Dev</span></a>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			<!--<div class="navbar-item has-dropdown is-hoverable">
 | 
					 | 
				
			||||||
				<a class="navbar-link">More</a>
 | 
					 | 
				
			||||||
				<div class="navbar-dropdown">
 | 
					 | 
				
			||||||
					<a class="navbar-item">About</a>
 | 
					 | 
				
			||||||
					<a class="navbar-item is-selected">Jobs</a>
 | 
					 | 
				
			||||||
					<a class="navbar-item">Contact</a>
 | 
					 | 
				
			||||||
					<hr class="navbar-divider">
 | 
					 | 
				
			||||||
					<a class="navbar-item">Report an issue</a>
 | 
					 | 
				
			||||||
				</div>
 | 
					 | 
				
			||||||
			</div>-->
 | 
					 | 
				
			||||||
		</div>
 | 
							</div>
 | 
				
			||||||
 | 
					 | 
				
			||||||
		 <div class="navbar-end">
 | 
					 | 
				
			||||||
			<div class="navbar-item is-hidden" id="showOnLogin">
 | 
					 | 
				
			||||||
				<strong>Hey, <span id="nav_username"></span></strong>
 | 
					 | 
				
			||||||
				<button class="button" onclick="window.location='/pay_up'" >Zur Abrechnung</button>
 | 
					 | 
				
			||||||
			</div>
 | 
					 | 
				
			||||||
			<div class="navbar-item is-hidden" id="onlyShowRoot">
 | 
					 | 
				
			||||||
				<button class="button" onclick="window.location='/admin/'" >Zur Administration</button>
 | 
					 | 
				
			||||||
			</div>
 | 
					 | 
				
			||||||
			<div class="navbar-item is-hidden" id="onlyShowAdmin">
 | 
					 | 
				
			||||||
			<button class="button" onclick="window.location='/admin/'" >Zur Administration</button>
 | 
					 | 
				
			||||||
				<button class="button" onclick="window.location='/'" >Abmelden</button>
 | 
					 | 
				
			||||||
			</div>
 | 
					 | 
				
			||||||
		</div> 
 | 
					 | 
				
			||||||
		<script>
 | 
							<script>
 | 
				
			||||||
			// Check if ?user is set
 | 
								document.addEventListener('DOMContentLoaded', () => {
 | 
				
			||||||
			if (window.location.search.includes('user')) {
 | 
									const navbarButtons = document.getElementById('dynamic-navbar-buttons');
 | 
				
			||||||
				// Show the sign up button
 | 
									const currentPath = window.location.pathname;
 | 
				
			||||||
				document.querySelector('#showOnLogin').classList.remove('is-hidden');
 | 
									const queryParams = new URLSearchParams(window.location.search);
 | 
				
			||||||
				// Get the username from the cookie
 | 
					 | 
				
			||||||
				username = document.cookie.split('; ').find(row => row.startsWith('name')).split('=')[1];
 | 
					 | 
				
			||||||
				// Set the username in the nav
 | 
					 | 
				
			||||||
				document.getElementById('nav_username').innerText = username;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Check if /user_select is the current page
 | 
									const buttonsConfig = {
 | 
				
			||||||
			if (window.location.pathname == '/user_select') {
 | 
										'/user_select': [
 | 
				
			||||||
				// Show the sign up button
 | 
											{ text: '', icon: 'bi bi-gear', link: '/admin' }
 | 
				
			||||||
				document.querySelector('#onlyShowRoot').classList.remove('is-hidden');
 | 
										],
 | 
				
			||||||
			}
 | 
										'/product_select': [
 | 
				
			||||||
 | 
											{ text: 'Zur Abrechnung', link: '/pay_up' },
 | 
				
			||||||
 | 
											{ text: '', icon: 'bi bi-gear', link: '/admin' },
 | 
				
			||||||
 | 
											{ text: '', icon: 'bi bi-box-arrow-right', link: '/user_select' }
 | 
				
			||||||
 | 
										],
 | 
				
			||||||
 | 
										'/pay_up': [
 | 
				
			||||||
 | 
											{ text: '', icon: 'bi bi-gear', link: '/admin' },
 | 
				
			||||||
 | 
											{ text: '', icon: 'bi bi-box-arrow-right', link: '/user_select' }
 | 
				
			||||||
 | 
										],
 | 
				
			||||||
 | 
										'/admin': [
 | 
				
			||||||
 | 
											{ text: '', icon: 'bi bi-gear', link: '/admin' },
 | 
				
			||||||
 | 
											{ text: '', icon: 'bi bi-house', link: '/user_select' }
 | 
				
			||||||
 | 
										]
 | 
				
			||||||
 | 
									};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// If admin is contained in url
 | 
									if (currentPath === '/product_select' && queryParams.has('user')) {
 | 
				
			||||||
			if (window.location.pathname.includes('admin')) {
 | 
										const username = document.cookie.split('; ').find(row => row.startsWith('name'))?.split('=')[1];
 | 
				
			||||||
				// Show the sign up button
 | 
										if (username) {
 | 
				
			||||||
				document.querySelector('#onlyShowAdmin').classList.remove('is-hidden');
 | 
											document.getElementById('nav_usernameContent').innerText = username; // Set greeting
 | 
				
			||||||
			}
 | 
											document.getElementById('nav_username').classList.remove('is-hidden'); // Show greeting
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			
 | 
									const buttons = buttonsConfig[currentPath] || [];
 | 
				
			||||||
 | 
									buttons.forEach(button => {
 | 
				
			||||||
 | 
										const btn = document.createElement('button');
 | 
				
			||||||
 | 
										btn.className = 'button';
 | 
				
			||||||
 | 
										btn.onclick = () => window.location = button.link;
 | 
				
			||||||
 | 
										if (button.icon) {
 | 
				
			||||||
 | 
											const icon = document.createElement('i');
 | 
				
			||||||
 | 
											icon.className = button.icon;
 | 
				
			||||||
 | 
											btn.appendChild(icon);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										if (button.text) {
 | 
				
			||||||
 | 
											btn.appendChild(document.createTextNode(button.text));
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										navbarButtons.appendChild(btn);
 | 
				
			||||||
 | 
									});
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
		</script>
 | 
							</script>
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
</nav>
 | 
					</nav>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,5 +13,6 @@
 | 
				
			|||||||
<script src="/static/apiWrapper.js"></script>
 | 
					<script src="/static/apiWrapper.js"></script>
 | 
				
			||||||
<script src="/static/pageDriver.js"></script>
 | 
					<script src="/static/pageDriver.js"></script>
 | 
				
			||||||
<script src="/static/js/lockscreenBgHandler.js"></script>
 | 
					<script src="/static/js/lockscreenBgHandler.js"></script>
 | 
				
			||||||
 | 
					<script src="/static/js/kiosk_mode.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<%~ include("partials/base_foot.eta") %>	
 | 
					<%~ include("partials/base_foot.eta") %>	
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user