hyperion.ng/assets/webconfig/js/ui_utils.js
redPanther eeb9b0f7da implement hyperion restart via webui (#242)
* first try

* implement hyperion restart. core function is good, but needs a beeter structuring- something for next refactoring session ;-)

* several fixes (including osx)
merge with upstream
some refactoring

* add some eye candy to webui
2016-09-15 20:42:58 +02:00

65 lines
1.0 KiB
JavaScript

function bindNavToContent(containerId, fileName, loadNow)
{
$("#page-content").off();
$(containerId).on("click", function() {
$("#page-content").load("/content/"+fileName+".html");
});
if (loadNow)
{
$(containerId).trigger("click");
}
}
function loadContentTo(containerId, fileName)
{
$(containerId).load("/content/"+fileName+".html");
}
function toggleClass(obj,class1,class2)
{
if ( $(obj).hasClass(class1))
{
$(obj).removeClass(class1);
$(obj).addClass(class2);
}
else
{
$(obj).removeClass(class2);
$(obj).addClass(class1);
}
}
function setClassByBool(obj,enable,class1,class2)
{
if (enable)
{
$(obj).removeClass(class1);
$(obj).addClass(class2);
}
else
{
$(obj).removeClass(class2);
$(obj).addClass(class1);
}
}
function showErrorDialog(header,message)
{
$('#error_dialog .modal-title').html(header);
$('#error_dialog .modal-body').html(message);
$('#error_dialog').modal('show');
}
function isJsonString(str) {
try {
JSON.parse(str);
} catch (e) {
return e;
}
return "";
}