summaryrefslogtreecommitdiff
path: root/WebInterface/NodeJSServer/src/modules/ui/backdrop.js
diff options
context:
space:
mode:
authorTrueKuehli <rctcoaster2000@hotmail.de>2018-11-27 12:16:33 +0100
committerTrueKuehli <rctcoaster2000@hotmail.de>2018-11-27 12:16:33 +0100
commit9f0b255f32dfa81bffe75f89335a78a659b4ce6a (patch)
treec4345ef6f98fee35f326bc06c29cada542a78e43 /WebInterface/NodeJSServer/src/modules/ui/backdrop.js
parenta653a4efc60ef0bbc18e65cb11a4bd8c06c7ad5c (diff)
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.
Diffstat (limited to 'WebInterface/NodeJSServer/src/modules/ui/backdrop.js')
-rw-r--r--WebInterface/NodeJSServer/src/modules/ui/backdrop.js69
1 files changed, 0 insertions, 69 deletions
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');
- });
- }
-}