From 9f0b255f32dfa81bffe75f89335a78a659b4ce6a Mon Sep 17 00:00:00 2001 From: TrueKuehli Date: Tue, 27 Nov 2018 12:16:33 +0100 Subject: Reworked the code, but currently unable to test, so bugs are bound to be in there Will test it sometime later. There also might still be stuff, that has yet to be reworked. --- .../NodeJSServer/src/modules/ui/backdrop.js | 69 ---------------------- 1 file changed, 69 deletions(-) delete mode 100644 WebInterface/NodeJSServer/src/modules/ui/backdrop.js (limited to 'WebInterface/NodeJSServer/src/modules/ui/backdrop.js') diff --git a/WebInterface/NodeJSServer/src/modules/ui/backdrop.js b/WebInterface/NodeJSServer/src/modules/ui/backdrop.js deleted file mode 100644 index f89a3c9..0000000 --- a/WebInterface/NodeJSServer/src/modules/ui/backdrop.js +++ /dev/null @@ -1,69 +0,0 @@ -// Showing / Hiding the backdrop menu - -/** - * Class for adding functionality to backdrop elements - */ -export default class Backdrop { - /** - * Registers all important elements in the backdrop - * @param {string} backdropMenu ID of Backdrop Menu - * @param {string} frontLayer ID of Front Layer - * @param {string} menuButton ID of Show / Hide Menu Button - */ - constructor(backdropMenu, frontLayer, menuButton) { - this.ids = {backdropMenu, frontLayer, menuButton}; - this.backdrop = document.getElementById(backdropMenu); - this.frontLayer = document.getElementById(frontLayer); - this.menuButton = document.getElementById(menuButton); - } - - /** - * Registers all neccessary events - */ - register() { - this.registerButtonEvent(); - this.registerFrontLayerEvent(); - } - - /** - * Reloads the object - */ - refresh() { - this.backdrop = document.getElementById(this.ids.backdropMenu); - this.frontLayer = document.getElementById(this.ids.frontLayer); - this.menuButton = document.getElementById(this.ids.menuButton); - this.register(); - } - - /** - * Registers showing / hiding through menu button - */ - registerButtonEvent() { - this.menuButton.addEventListener('click', () => { - // Hide / Unhide Backdrop Menu - if (this.backdrop.classList.contains('hidden')) { - this.backdrop.classList.remove('hidden'); - } else { - this.backdrop.classList.add('hidden'); - } - - // Set open state for menu button - if (this.menuButton.classList.contains('open')) { - this.menuButton.classList.remove('open'); - } else { - this.menuButton.classList.add('open'); - } - }); - } - - /** - * Registers hiding, when clicking on the front layer - */ - registerFrontLayerEvent() { - // Hide menu when interacting with front layer - this.frontLayer.addEventListener('click', () => { - this.backdrop.classList.add('hidden'); - this.menuButton.classList.remove('open'); - }); - } -} -- cgit v1.2.3-54-g00ecf