update app_logic.js
This commit is contained in:
@@ -4,6 +4,7 @@ function tableScroll(query) {
|
||||
//var secretTokenEl = document.getElementById("secretToken");
|
||||
var groupIdEl = document.getElementById("groupId");
|
||||
var container = document.getElementById("container");
|
||||
|
||||
function LinkAccount(LinkAccount_group, LinkAccount_secret, refresh = false) {
|
||||
GROUPID = LinkAccount_group.toUpperCase();
|
||||
SECRET = LinkAccount_secret.toUpperCase();
|
||||
@@ -33,26 +34,8 @@ if (urlParams.get("login") != null) {
|
||||
);
|
||||
//location.search = "";
|
||||
}
|
||||
|
||||
function open_page(params) {
|
||||
if (SUB_LOGGED_IN != true) {
|
||||
PAGES["login"].index();
|
||||
return;
|
||||
}
|
||||
if (params == "") {
|
||||
params = "index";
|
||||
}
|
||||
var path = params.split(",");
|
||||
var app = path[0];
|
||||
if (path[1] == undefined) {
|
||||
PAGES[app].index();
|
||||
return;
|
||||
}
|
||||
PAGES[app].edit(path[1]);
|
||||
}
|
||||
function setUrlHash(hash) {
|
||||
location.hash = "#" + hash;
|
||||
}
|
||||
window.onhashchange = () => {
|
||||
try {
|
||||
if (EVENTLISTENER != null) {
|
||||
try {
|
||||
@@ -70,9 +53,31 @@ window.onhashchange = () => {
|
||||
} catch (e) {
|
||||
console.debug("EVENTLISTENER onhashchange", e);
|
||||
}
|
||||
if (SUB_LOGGED_IN != true) {
|
||||
PAGES["login"].index();
|
||||
return;
|
||||
}
|
||||
if (params == "") {
|
||||
params = "index";
|
||||
}
|
||||
var path = params.split(",");
|
||||
var app = path[0];
|
||||
if (path[1] == undefined) {
|
||||
PAGES[app].index();
|
||||
return;
|
||||
}
|
||||
PAGES[app].edit(path[1]);
|
||||
}
|
||||
|
||||
function setUrlHash(hash) {
|
||||
location.hash = "#" + hash;
|
||||
|
||||
|
||||
}
|
||||
window.onhashchange = () => {
|
||||
open_page(location.hash.replace("#", ""));
|
||||
};
|
||||
|
||||
function download(filename, text) {
|
||||
var element = document.createElement("a");
|
||||
element.setAttribute(
|
||||
@@ -88,6 +93,7 @@ function download(filename, text) {
|
||||
|
||||
document.body.removeChild(element);
|
||||
}
|
||||
|
||||
function resizeInputImage(
|
||||
file,
|
||||
callback,
|
||||
@@ -122,24 +128,27 @@ function resizeInputImage(
|
||||
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
|
||||
function CurrentISODate() {
|
||||
return new Date().toISOString().split("T")[0].replace("T", " ");
|
||||
}
|
||||
|
||||
function CurrentISOTime() {
|
||||
return new Date().toISOString();
|
||||
}
|
||||
|
||||
function fixGunLocalStorage() {
|
||||
localStorage.removeItem("radata");
|
||||
removeCache();
|
||||
location.reload();
|
||||
}
|
||||
|
||||
function betterGunPut(ref, data) {
|
||||
ref.put(data, (ack) => {
|
||||
if (ack.err) {
|
||||
toastr.error(
|
||||
ack.err + "<br>Pulsa aqui para reiniciar la app",
|
||||
"Error al guardar",
|
||||
{ onclick: () => fixGunLocalStorage() }
|
||||
"Error al guardar", { onclick: () => fixGunLocalStorage() }
|
||||
);
|
||||
} else {
|
||||
console.debug("Guardado correctamente");
|
||||
|
||||
Reference in New Issue
Block a user