diff options
-rw-r--r-- | js/chats.js | 64 | ||||
-rw-r--r-- | js/meals.js | 14 | ||||
-rw-r--r-- | pages-src/chats.bvr | 8 | ||||
-rw-r--r-- | pages-src/meals.bvr | 4 | ||||
-rw-r--r-- | pages/about.html | 5 | ||||
-rw-r--r-- | pages/chats.html | 8 | ||||
-rw-r--r-- | pages/meals.html | 4 | ||||
-rw-r--r-- | sw.js | 4 |
8 files changed, 75 insertions, 36 deletions
diff --git a/js/chats.js b/js/chats.js index 5b4bbfd..daf10ab 100644 --- a/js/chats.js +++ b/js/chats.js @@ -367,27 +367,6 @@ function getUrlParameter(sParam) { return found_param; } -document.addEventListener("DOMContentLoaded", () => { - checkLogin(); - loadDirectory(); - updateSendButton(); - - // var receivedmessages = null; - - M.updateTextFields(); - - // Setup side menu - const menus = document.querySelectorAll(".side-menu"); - M.Sidenav.init(menus, { edge: "right", draggable: true }); - let elems = document.querySelectorAll(".modal"); - M.Modal.init(elems, {}); - - // Setup side modal - const modals = document.querySelectorAll(".side-modal"); - M.Sidenav.init(modals, { edge: "left", draggable: false }); - prepareAndStartFetchingMessages(); // just opens modal, as there is no recipient selected -}); - async function updateSendButton() { if ($("#msg-body").val().length == 0) { $("#msg-send").prop("disabled", true); @@ -480,3 +459,46 @@ async function renderMessages(gsecMsgList, whom, order = 1) { // order: 1=newest } } } + +function setupEventListeners() { + $("#chat-recipient-select-btn").click(() => { + setRecipient(); + }); + + $("#msg-send").click(() => { + sendMessage(); + }); + + $("#full-name").on("input", () => { + validateName(); + }); + + $("#msg-body").on("input", () => { + updateSendButton(); + }); +} + +document.addEventListener("DOMContentLoaded", () => { + + checkLogin(); + loadDirectory(); + + setupEventListeners(); + + updateSendButton(); + + // var receivedmessages = null; + + M.updateTextFields(); + + // Setup side menu + const menus = document.querySelectorAll(".side-menu"); + M.Sidenav.init(menus, { edge: "right", draggable: true }); + let elems = document.querySelectorAll(".modal"); + M.Modal.init(elems, {}); + + // Setup side modal + const modals = document.querySelectorAll(".side-modal"); + M.Sidenav.init(modals, { edge: "left", draggable: false }); + prepareAndStartFetchingMessages(); // just opens modal, as there is no recipient selected +});
\ No newline at end of file diff --git a/js/meals.js b/js/meals.js index f0d0266..0a5313a 100644 --- a/js/meals.js +++ b/js/meals.js @@ -341,9 +341,23 @@ async function setMenu(date, menu) { getToken(getMenus, [setMenus, choice]); } + +function setupEventListeners() { + $("#meals-login").click(() => { + lopolisLogin(); + }); + + $("#meals-logout").click(() => { + lopolisLogout(); + }); +} + // Initialization code document.addEventListener("DOMContentLoaded", async () => { checkLogin(); + + setupEventListeners(); + let coll_elem = document.querySelectorAll('.collapsible'); M.Collapsible.init(coll_elem, {}); diff --git a/pages-src/chats.bvr b/pages-src/chats.bvr index ed62fd8..9e3e619 100644 --- a/pages-src/chats.bvr +++ b/pages-src/chats.bvr @@ -54,12 +54,12 @@ <div class="row"> <div class="input-field"> <i class="material-icons prefix">account_circle</i> - <input oninput="validateName();" id="full-name" type="text" class="autocomplete-fullname validate"> + <input id="full-name" type="text" class="autocomplete-fullname validate"> <label for="full-name"><x-su>recipient</x-su></label> </div> </div> <div class="row"> - <button id="chat-recipient-select-btn" onclick="setRecipient()" class="btn waves-effect"> + <button id="chat-recipient-select-btn" class="btn waves-effect"> <x-su>select</x-su> </button> </div> @@ -77,11 +77,11 @@ <div class="row"> <div class="input-field col s10"> <i class="material-icons prefix">mode_edit</i> - <textarea maxlength="180" disabled="disabled" oninput="updateSendButton();" id="msg-body" class="materialize-textarea"></textarea> + <textarea maxlength="180" disabled="disabled" id="msg-body" class="materialize-textarea"></textarea> <label for="msg-body"><x-su>messageBody</x-su></label> </div> <div class="input-field col s2"> - <button class="btn waves-effect waves-light" onclick="sendMessage();" id="msg-send" type="button" disabled="disabled" name="action"> + <button class="btn waves-effect waves-light" id="msg-send" type="button" disabled="disabled" name="action"> <i class="material-icons">send</i> </button> </div> diff --git a/pages-src/meals.bvr b/pages-src/meals.bvr index a92a6d7..38f8371 100644 --- a/pages-src/meals.bvr +++ b/pages-src/meals.bvr @@ -69,7 +69,7 @@ </div> <div class="row"> <div class="input-field col s12"> - <button id="meals_login" type="button" class="waves-effect waves-light btn" onclick="lopolisLogin();"> + <button id="meals-login" type="button" class="waves-effect waves-light btn"> <x-su>loginToLopolis</x-su> <i class="material-icons right">arrow_right_alt</i> </button> @@ -80,7 +80,7 @@ </div> <div class="meals-container container" hidden="hidden" id="meals-container"> <h4>Meals - <button id="meals_logout" onclick="lopolisLogout();" type="button" class="waves-effect waves-light btn" style="float: right"> + <button id="meals-logout" type="button" class="waves-effect waves-light btn" style="float: right"> <x-su>logOutFromLopolis</x-su> <i class="material-icons right">exit_to_app</i> </button> diff --git a/pages/about.html b/pages/about.html index 66d1fab..4537766 100644 --- a/pages/about.html +++ b/pages/about.html @@ -140,7 +140,10 @@ </div> </div> <div class="row"> - 521ae242efd365f5b7e4138db5c7f36f6b0549a3 + <p> + <small> + ^HEAD a8f74121067041fde53676ee4e04d6f59eb82bd7 + </p> </div> </div> </body> diff --git a/pages/chats.html b/pages/chats.html index 48a414a..634d9ff 100644 --- a/pages/chats.html +++ b/pages/chats.html @@ -75,12 +75,12 @@ <div class="row"> <div class="input-field"> <i class="material-icons prefix">account_circle</i> - <input oninput="validateName();" id="full-name" type="text" class="autocomplete-fullname validate"> + <input id="full-name" type="text" class="autocomplete-fullname validate"> <label for="full-name"><x-su>recipient</x-su></label> </div> </div> <div class="row"> - <button id="chat-recipient-select-btn" onclick="setRecipient()" class="btn waves-effect"> + <button id="chat-recipient-select-btn" class="btn waves-effect"> <x-su>select</x-su> </button> </div> @@ -98,11 +98,11 @@ <div class="row"> <div class="input-field col s10"> <i class="material-icons prefix">mode_edit</i> - <textarea maxlength="180" disabled="disabled" oninput="updateSendButton();" id="msg-body" class="materialize-textarea"></textarea> + <textarea maxlength="180" disabled="disabled" id="msg-body" class="materialize-textarea"></textarea> <label for="msg-body"><x-su>messageBody</x-su></label> </div> <div class="input-field col s2"> - <button class="btn waves-effect waves-light" onclick="sendMessage();" id="msg-send" type="button" disabled="disabled" name="action"> + <button class="btn waves-effect waves-light" id="msg-send" type="button" disabled="disabled" name="action"> <i class="material-icons">send</i> </button> </div> diff --git a/pages/meals.html b/pages/meals.html index 4664284..058d2e1 100644 --- a/pages/meals.html +++ b/pages/meals.html @@ -90,7 +90,7 @@ </div> <div class="row"> <div class="input-field col s12"> - <button id="meals_login" type="button" class="waves-effect waves-light btn" onclick="lopolisLogin();"> + <button id="meals-login" type="button" class="waves-effect waves-light btn"> <x-su>loginToLopolis</x-su> <i class="material-icons right">arrow_right_alt</i> </button> @@ -101,7 +101,7 @@ </div> <div class="meals-container container" hidden="hidden" id="meals-container"> <h4>Meals - <button id="meals_logout" onclick="lopolisLogout();" type="button" class="waves-effect waves-light btn" style="float: right"> + <button id="meals-logout" type="button" class="waves-effect waves-light btn" style="float: right"> <x-su>logOutFromLopolis</x-su> <i class="material-icons right">exit_to_app</i> </button> @@ -3,8 +3,8 @@ // Change version to cause cache refresh -const static_cache_name = "site-static-1.0.13-beta-521ae24"; -// latest commit is 521ae242efd365f5b7e4138db5c7f36f6b0549a3 +const static_cache_name = "site-static-1.0.13-beta-a8f7412"; +// latest commit is a8f74121067041fde53676ee4e04d6f59eb82bd7 // Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js // sw.js NE SME BITI CACHAN, ker vsebuje verzijo! |