about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/packs/settings.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/javascript/flavours/glitch/packs/settings.js')
-rw-r--r--app/javascript/flavours/glitch/packs/settings.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/packs/settings.js b/app/javascript/flavours/glitch/packs/settings.js
new file mode 100644
index 000000000..9c4d119c1
--- /dev/null
+++ b/app/javascript/flavours/glitch/packs/settings.js
@@ -0,0 +1,25 @@
+import 'packs/public-path';
+import loadPolyfills from 'flavours/glitch/util/load_polyfills';
+import ready from 'flavours/glitch/util/ready';
+import loadKeyboardExtensions from 'flavours/glitch/util/load_keyboard_extensions';
+
+function main() {
+  const { delegate } = require('@rails/ujs');
+
+  delegate(document, '.sidebar__toggle__icon', 'click', () => {
+    const target = document.querySelector('.sidebar ul');
+
+    if (target.style.display === 'block') {
+      target.style.display = 'none';
+    } else {
+      target.style.display = 'block';
+    }
+  });
+}
+
+loadPolyfills()
+  .then(main)
+  .then(loadKeyboardExtensions)
+  .catch(error => {
+    console.error(error);
+  });