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/initialize.js | 2 +- js/meals.js | 45 ++++++++++----------------------------------- js/messaging.js | 14 ++++++++------ pages/about.html | 24 +++++++++++++++--------- pages/changelog.html | 9 ++++++++- pages/meals.html | 2 +- sw.js | 4 +++- 7 files changed, 46 insertions(+), 54 deletions(-) diff --git a/js/initialize.js b/js/initialize.js index 2305742..d62e8d4 100644 --- a/js/initialize.js +++ b/js/initialize.js @@ -45,7 +45,7 @@ localforage.getItem("logged_in") // User is logged in, execute appropriate action if (getUrlParameter("m") !== "") { - window.location.replace("/pages/messaging.html?m=" + getUrlParameter("m")); + window.location.replace("/pages/messaging.html#" + getUrlParameter("m")); } else { window.location.replace("/pages/timetable.html"); } diff --git a/js/meals.js b/js/meals.js index bb3653f..59463c0 100644 --- a/js/meals.js +++ b/js/meals.js @@ -109,6 +109,8 @@ function displayMeals() { let root_element = document.getElementById("meals-collapsible"); for(const [date, mealzz] of Object.entries(meals.data)) { + let unabletochoosequestionmark = ""; + let readonly = mealzz.readonly; var datum = new Date(date); // Create root element for a date entry let subject_entry = document.createElement("li"); @@ -118,8 +120,11 @@ function displayMeals() { subject_header.classList.add("collapsible-header-root"); // Create header text element let subject_header_text = document.createElement("span"); + if(mealzz.readonly) { + unabletochoosequestionmark = "*Read only*"; + } subject_header_text.innerText = jsDateDayString[datum.getDay()]+", "+datum.getDate()+". "+jsDateMonthString[datum.getMonth()]+" "+datum.getFullYear()+" ("+mealzz.meal+"@" - +mealzz.location+")"; + +mealzz.location+") "+unabletochoosequestionmark; // Create collection for displaying individuals meals let subject_body = document.createElement("div"); @@ -134,8 +139,10 @@ function displayMeals() { meal_node.classList.add("collection-item") meal_node.classList.add("meal-node"); meal_node.dataset["index"] = dindex; - meal_node.onclick = function () { - setMenu(date, dmil.value); + if(!readonly) { + meal_node.onclick = function () { + setMenu(date, dmil.value); + } } let meal_node_div = document.createElement("div"); @@ -195,38 +202,6 @@ function refreshMeals(force) { loadMeals(force); } -function refreshClickHandlers() { // unused - $("#meals-collapsible").find(".collection-item.meal-node").click(function () { - let grade_obj = grades[parseInt(this.dataset["index"])]; - document.getElementById("grade-header").innerText = grade_obj["predmet"] + ": " + grade_obj["ocena"]; - document.getElementById("grade-date").innerText = grade_obj["datum"]; - document.getElementById("grade-title").innerText = grade_obj["naslov"]; - document.getElementById("grade-type").innerText = "Type: " + grade_obj["vrsta"]; - - let term_element = document.getElementById("grade-term"); - if (grade_obj["rok"] !== "") { - term_element.innerText = "Term: " + grade_obj["rok"]; - term_element.style["display"] = ""; - } else { - term_element.style["display"] = "none"; - } - - document.getElementById("grade-teacher").innerText = "Teacher: " + grade_obj["profesor"]; - - let temporary_object = document.getElementById("grade-temporary"); - let temporary_object_root = document.getElementById("grade-temporary-root"); - if (grade_obj["zacasna"]) { - temporary_object.innerText = "(zacasna)"; - temporary_object_root.style["display"] = ""; - } else { - temporary_object_root.style["display"] = "none"; - } - - const modal = document.querySelectorAll('.side-modal')[0]; - M.Sidenav.getInstance(modal).open(); - }); -} - function lopolisLogout() { localforage.setItem("logged_in_lopolis", false); checkLogin(); 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"); diff --git a/pages/about.html b/pages/about.html index 682af72..4a90f5d 100644 --- a/pages/about.html +++ b/pages/about.html @@ -48,14 +48,11 @@

BežiApp

-
  • view_moduleTimetable -
  • +
  • view_moduleTimetable
  • eventGradings
  • receiptGrades
  • -
  • supervisor_accountTeachers
  • -
  • query_builderAbsences -
  • +
  • supervisor_accountTeachers
  • +
  • query_builderAbsences
  • messageMessaging
  • fastfoodMeals
  • @@ -77,7 +74,7 @@

    BežiApp

    -
    Version 1.0.9-beta
    +
    Version 1.0.10-beta
    @@ -89,6 +86,10 @@
  • Rok Štular +      + + message + @@ -100,6 +101,11 @@ + +      + + message +
  • @@ -111,11 +117,11 @@ Terms of Service Privacy policy Report a bug / Send - a suggestion + a suggestion (instagram: @beziapp) - \ No newline at end of file + diff --git a/pages/changelog.html b/pages/changelog.html index dd97c72..b225acb 100644 --- a/pages/changelog.html +++ b/pages/changelog.html @@ -47,6 +47,13 @@

    Changelog