From 7a294b9add248992f1d35c6d451ed16c215cdbb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Sat, 8 Feb 2020 22:46:08 +0100 Subject: added http://beziapp/?m=Name Surname to redirect to the messaging page with prefilled recipient --- index.html | 2 +- js/initialize.js | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 4c27e9a..184668d 100644 --- a/index.html +++ b/index.html @@ -22,4 +22,4 @@ - \ No newline at end of file + diff --git a/js/initialize.js b/js/initialize.js index 39ed505..2023921 100644 --- a/js/initialize.js +++ b/js/initialize.js @@ -1,3 +1,15 @@ +function getUrlParameter(sParam) { + var sPageURL = window.location.search.substring(1), + sURLVariables = sPageURL.split('&'), + sParameterName, + i; + for (i = 0; i < sURLVariables.length; i++) { + sParameterName = sURLVariables[i].split('='); + if (sParameterName[0] === sParam) { + return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); + } + } +}; function setupStorage() { promises_to_run = [ localforage.setItem("logged_in", false), @@ -28,7 +40,11 @@ localforage.getItem("logged_in") } else if (value === false) { window.location.replace("/login.html"); } else { - window.location.replace("/pages/timetable.html"); + if(getUrlParameter("m")) { + window.location.replace("pages/messaging.html?"+getUrlParameter("m")); + } else { + window.location.replace("/pages/timetable.html"); + } } } ).catch( -- cgit v1.2.3