From f4fd919987397819ee29d68a4e562e599f95737c Mon Sep 17 00:00:00 2001 From: rstular Date: Mon, 18 May 2020 01:24:07 +0200 Subject: Bug fix - modal opens when hash is proivded --- assets/js/messaging.js | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'assets/js/messaging.js') diff --git a/assets/js/messaging.js b/assets/js/messaging.js index c548965..5426c7b 100644 --- a/assets/js/messaging.js +++ b/assets/js/messaging.js @@ -91,9 +91,13 @@ function populateAutocomplete() { minLength: 0 }); - if (window.location.hash.length > 1 && !window.location.hash.substring(1).startsWith("beziapp")) { - $("#full-name").val(decodeURIComponent(window.location.hash.substring(1))); - } + $(document).ready(function () { + if (window.location.hash.length > 1 && !window.location.hash.substring(1).startsWith("beziapp")) { + $("#full-name").val(decodeURIComponent(window.location.hash.substring(1))); + $("#beziapp-new-message").modal(); + $("#beziapp-new-message").modal("open"); + } + }); M.updateTextFields(); validateName(); @@ -347,11 +351,12 @@ function displayData(messageType) { delete reply @@ -560,6 +565,16 @@ var additionalstufftoaddtomessage = ""; document.addEventListener("DOMContentLoaded", () => { checkLogin(); + + // Setup modals + const modal_elems = document.querySelectorAll('.modal'); + const modal_options = { + onOpenStart: () => { $("#fab-new").hide() }, + onCloseEnd: () => { $("#fab-new").show() }, + dismissible: false + }; + M.Modal.init(modal_elems, modal_options); + loadDirectory(); setupEventListeners(); @@ -596,15 +611,6 @@ document.addEventListener("DOMContentLoaded", () => { const fab_elem = document.querySelectorAll(".fixed-action-btn"); M.FloatingActionButton.init(fab_elem, fab_options); - // Setup modals - const modal_elems = document.querySelectorAll('.modal'); - const modal_options = { - onOpenStart: () => { $("#fab-new").hide() }, - onCloseEnd: () => { $("#fab-new").show() }, - dismissible: false - }; - M.Modal.init(modal_elems, modal_options); - var receivedmessages = null; loadMessages(true, 0); M.updateTextFields(); -- cgit v1.2.3