You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Station/www/js/functions.js

55 lines
1.5 KiB
JavaScript

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
function openScreen(id) {
$('#content-frame').fadeOut('fast', function () {
$('#content-frame').load("pages/" + id + ".html", function () {
$('#content-frame').fadeIn('fast', function () {
});
});
});
}
function getApps(callback) {
$.post(accounthubapi, {
key: apikey,
action: "listapps"
}, function (resp) {
if (resp.status == "OK") {
callback(resp.apps);
} else {
alert(resp.msg);
}
}, "json");
}
var msgtimeout = null;
function showmsg(text, style, details, timeout) {
if (timeout == null) {
timeout = 5 * 1000;
}
if (details == null) {
details = "";
} else {
details = "<p>" + details + "</p>";
}
if (style == null) {
style = "info";
}
$("#alert-box")
.hide()
.html('<div class="alert alert-' + style + ' alert-dismissible fade show" role="alert" style="position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 9999999;"><h5 class="alert-heading">' + text + '</h5>' + details + '<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">&times;</span></button></div>')
.fadeIn("fast");
clearTimeout(msgtimeout);
if (timeout !== false) {
msgtimeout = setTimeout(function () {
$("#alert-box").fadeOut("fast");
}, timeout);
}
}