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