From 4f38105bc4017248568e4c8c8b0506f6ac09a3b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Tue, 25 Feb 2020 20:22:33 +0100 Subject: 1.0.10-beta, hrana ~dela, netestirano, ker nimam menijev za izbrat --- js/messaging.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'js/messaging.js') diff --git a/js/messaging.js b/js/messaging.js index f5d2e13..70b7545 100644 --- a/js/messaging.js +++ b/js/messaging.js @@ -82,6 +82,13 @@ function populateAutocomplete() { onAutocomplete: validateName, minLength: 0 }); + if(window.location.hash.length > 1) { + document.getElementById("full-name").value = decodeURIComponent(window.location.hash.substring(1)); + } else { + document.getElementById("full-name").value = getUrlParameter("m"); + } + M.updateTextFields(); + validateName(); } // Function to toggle loading bar @@ -317,9 +324,8 @@ async function sendMessage(recipient_number, subject, body) { }); } -function validateName() { +async function validateName() { if (directory !== null) { - if ($("#full-name").val() in directory) { $("#full-name").addClass("valid"); $("#full-name").removeClass("invalid"); @@ -329,7 +335,6 @@ function validateName() { $("#full-name").removeClass("valid"); document.getElementById("msg-send").disabled = true; } - } } @@ -398,10 +403,7 @@ document.addEventListener("DOMContentLoaded", () => { var receivedmessages = null; loadMessages(true, 0); - - document.getElementById("full-name").value = getUrlParameter("m"); M.updateTextFields(); - validateName(); // Setup side menu const menus = document.querySelectorAll(".side-menu"); -- cgit v1.2.3