124 lines
3.6 KiB
JavaScript
124 lines
3.6 KiB
JavaScript
/// <reference path="../../js/jquery-3.6.0.min.js" />
|
|
/// <reference path="../../js/utility.js" />
|
|
|
|
var old_hash;
|
|
var default_page;
|
|
|
|
(function () {
|
|
|
|
window.onmaskbg = function (flag, noanimation) {
|
|
if (noanimation) {
|
|
$(document.body).find('.hostmask').css('display', flag ? '' : 'none');
|
|
} else {
|
|
if (flag) {
|
|
$(document.body).find('.hostmask').fadeIn(100);
|
|
} else {
|
|
$(document.body).find('.hostmask').fadeOut(100);
|
|
}
|
|
}
|
|
};
|
|
window.ondocumentclick = function (e) {
|
|
$(document.body).click();
|
|
};
|
|
window.showconfirm = function (msg, title, fok, fcancel) {
|
|
var mask = $(document.body).children('.maskbg');
|
|
mask.children().hide();
|
|
mask.fadeIn(100);
|
|
_dialog.showConfirm(msg, title, function (e) {
|
|
mask.fadeOut(100);
|
|
if (typeof fok === 'function') {
|
|
fok(e);
|
|
}
|
|
}, function () {
|
|
if (typeof fcancel === 'function') {
|
|
fcancel();
|
|
}
|
|
mask.fadeOut(100);
|
|
}, true);
|
|
}
|
|
window.showalert = function (msg, title, icon, next) {
|
|
_dialog.showAlert(msg, title, icon, next, true);
|
|
}
|
|
window.onsubpageloaded = function () {
|
|
$('#set_right .loading_holder').fadeOut('fast');
|
|
$('#set_right iframe').fadeIn();
|
|
};
|
|
|
|
window.changePage = function (e) {
|
|
if (!e) {
|
|
if (old_hash == default_page) {
|
|
return;
|
|
}
|
|
e = default_page;
|
|
}
|
|
old_hash = e;
|
|
var iframe = $('<iframe class="set_iframe"></iframe').css('display', 'none');
|
|
var li = $(e); // '#nav_' + e.substring(1)
|
|
if (!li.length) {
|
|
return;
|
|
}
|
|
|
|
|
|
$('#set_left li').removeClass('selected');
|
|
li.addClass('selected');
|
|
iframe.attr('src', li.attr('page') + location.search);
|
|
//document.title = 'Iron Intel - ' + li.attr('title');
|
|
$('#set_right iframe').remove();
|
|
$('#set_right .loading_holder').fadeIn();
|
|
$('#set_right').append(iframe);
|
|
|
|
var name = $(li).find('span').text();
|
|
if (typeof afterpagechanged === 'function')
|
|
afterpagechanged(e, name);
|
|
};
|
|
|
|
old_hash = location.hash;
|
|
|
|
window.onhashchange = function (e) {
|
|
var hash = location.hash;
|
|
if (hash == old_hash) {
|
|
return;
|
|
}
|
|
window.changePage(hash);
|
|
};
|
|
})();
|
|
|
|
$(function () {
|
|
var ANIMATION_DURATION = 120;
|
|
var ANIMATION_DURATION_NORMAL = 'fast';
|
|
|
|
default_page = $('#set_left li.nav_item:visible:first').attr('id');
|
|
if (default_page) {
|
|
default_page = '#' + default_page;
|
|
if (!old_hash) {
|
|
old_hash = default_page;
|
|
}
|
|
}
|
|
|
|
$('#nav_arrow').click(function () {
|
|
var flag = !$('#set_left').prop('isexpanded');
|
|
setCookie("LeftPanelExpanded", flag ? "1" : "0");
|
|
$('#set_left').stop()
|
|
.prop('isexpanded', flag)
|
|
.animate({ 'width': flag ? 250 : 50 }, ANIMATION_DURATION)
|
|
//.find('li a').css('display', flag ? 'none' : '')
|
|
;
|
|
if (flag)
|
|
$('#set_left').find(".subitem").show();
|
|
else
|
|
$('#set_left').find(".subitem").hide();
|
|
|
|
$('#set_right').stop()
|
|
.animate({ 'margin-left': flag ? 250 : 50 }, ANIMATION_DURATION);
|
|
|
|
$('#nav_arrow div').attr('class', 'icn')
|
|
.addClass(flag ? 'expand' : 'collapse');
|
|
});
|
|
|
|
$('#set_left').prop('isexpanded', false);
|
|
var leftexpanded = getCookie("LeftPanelExpanded") === "1";
|
|
if (leftexpanded)
|
|
$('#nav_arrow').click();
|
|
|
|
});
|