2014-05-03 18:29:00 -04:00
|
|
|
function initHeader() {
|
|
|
|
//settings
|
|
|
|
var header = $("#header");
|
|
|
|
var fadeSpeed = 100, fadeTo = 0.8, topDistance = 20;
|
|
|
|
var topbarME = function () {
|
|
|
|
$(header).fadeTo(fadeSpeed, 1);
|
|
|
|
}, topbarML = function () {
|
|
|
|
$(header).fadeTo(fadeSpeed, fadeTo);
|
|
|
|
};
|
|
|
|
var inside = false;
|
|
|
|
//do
|
|
|
|
$(window).scroll(function () {
|
|
|
|
position = $(window).scrollTop();
|
|
|
|
if (position > topDistance && !inside) {
|
|
|
|
//add events
|
|
|
|
topbarML();
|
|
|
|
$(header).bind('mouseenter', topbarME);
|
|
|
|
$(header).bind('mouseleave', topbarML);
|
|
|
|
inside = true;
|
|
|
|
}
|
|
|
|
else if (position < topDistance) {
|
|
|
|
topbarME();
|
|
|
|
$(header).unbind('mouseenter', topbarME);
|
|
|
|
$(header).unbind('mouseleave', topbarML);
|
|
|
|
inside = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-03-10 01:18:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-05-03 18:29:00 -04:00
|
|
|
function showMsg(msg, loader, timeout, ms) {
|
|
|
|
var feedback = $("#ajaxMsg");
|
|
|
|
update = $("#updatebar");
|
|
|
|
if (update.is(":visible")) {
|
|
|
|
var height = update.height() + 35;
|
|
|
|
feedback.css("bottom", height + "px");
|
|
|
|
} else {
|
|
|
|
feedback.removeAttr("style");
|
|
|
|
}
|
|
|
|
feedback.fadeIn();
|
|
|
|
var message = $("<div class='msg'>" + msg + "</div>");
|
|
|
|
if (loader) {
|
|
|
|
var message = $("<div class='msg'><img src='interfaces/default/images/loader_black.gif' alt='loading' class='loader' style='position: relative;top:10px;margin-top:-15px; margin-left:-10px;'/>" + msg + "</div>");
|
|
|
|
feedback.css("padding", "14px 10px")
|
|
|
|
}
|
|
|
|
$(feedback).prepend(message);
|
|
|
|
if (timeout) {
|
|
|
|
setTimeout(function () {
|
|
|
|
message.fadeOut(function () {
|
|
|
|
$(this).remove();
|
|
|
|
feedback.fadeOut();
|
|
|
|
});
|
|
|
|
}, ms);
|
|
|
|
}
|
2014-03-10 01:18:05 -04:00
|
|
|
}
|
|
|
|
|
2014-05-03 18:29:00 -04:00
|
|
|
function resetFilters(text) {
|
|
|
|
if ($(".dataTables_filter").length > 0) {
|
|
|
|
$(".dataTables_filter input").attr("placeholder", "filter " + text + "");
|
|
|
|
}
|
2014-03-10 01:18:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function initFancybox() {
|
2014-05-03 18:29:00 -04:00
|
|
|
if ($("a[rel=dialog]").length > 0) {
|
2014-09-30 18:20:37 -04:00
|
|
|
$.getScript(sbRoot + '/js/fancybox/jquery.fancybox.js', function () {
|
|
|
|
$("head").append("<link rel='stylesheet' href='" + sbRoot + "/js/fancybox/jquery.fancybox.css'>");
|
2014-05-03 18:29:00 -04:00
|
|
|
$("a[rel=dialog]").fancybox({
|
2014-09-30 18:20:37 -04:00
|
|
|
type: "image",
|
|
|
|
padding: 0,
|
|
|
|
helpers : {
|
|
|
|
title : null,
|
|
|
|
overlay : {
|
|
|
|
locked: false,
|
|
|
|
css : {
|
|
|
|
'background' : 'rgba(0, 0, 0, 0.4)'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-05-03 18:29:00 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2014-03-10 01:18:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function initTabs() {
|
2014-05-03 18:29:00 -04:00
|
|
|
$("#config-components").tabs({
|
|
|
|
activate: function (event, ui) {
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
var lastOpenedPanel = $(this).data("lastOpenedPanel");
|
|
|
|
var selected = $(this).tabs('option', 'selected');
|
|
|
|
|
|
|
|
if (lastOpenedPanel) {
|
|
|
|
} else {
|
2014-05-03 18:29:00 -04:00
|
|
|
lastOpenedPanel = $(ui.oldPanel)
|
2014-03-10 01:18:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!$(this).data("topPositionTab")) {
|
|
|
|
$(this).data("topPositionTab", $(ui.newPanel).position()['top'])
|
|
|
|
}
|
|
|
|
|
|
|
|
//Dont use the builtin fx effects. This will fade in/out both tabs, we dont want that
|
|
|
|
//Fadein the new tab yourself
|
2014-09-30 18:20:37 -04:00
|
|
|
$(ui.newPanel).hide().fadeIn(0);
|
2014-03-10 01:18:05 -04:00
|
|
|
|
|
|
|
if (lastOpenedPanel) {
|
|
|
|
|
|
|
|
// 1. Show the previous opened tab by removing the jQuery UI class
|
|
|
|
// 2. Make the tab temporary position:absolute so the two tabs will overlap
|
|
|
|
// 3. Set topposition so they will overlap if you go from tab 1 to tab 0
|
|
|
|
// 4. Remove position:absolute after animation
|
|
|
|
lastOpenedPanel
|
|
|
|
.toggleClass("ui-tabs-hide")
|
|
|
|
.css("position", "absolute")
|
|
|
|
.css("top", $(this).data("topPositionTab") + "px")
|
2014-09-30 18:20:37 -04:00
|
|
|
.fadeOut(0, function () {
|
2014-03-10 01:18:05 -04:00
|
|
|
$(this)
|
2014-05-03 18:29:00 -04:00
|
|
|
.css("position", "");
|
2014-03-10 01:18:05 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//Saving the last tab has been opened
|
|
|
|
$(this).data("lastOpenedPanel", $(ui.newPanel));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function init() {
|
2014-05-03 18:29:00 -04:00
|
|
|
initHeader();
|
|
|
|
initFancybox();
|
|
|
|
initTabs();
|
2014-03-10 01:18:05 -04:00
|
|
|
}
|
|
|
|
|
2014-05-03 18:29:00 -04:00
|
|
|
$(document).ready(function () {
|
|
|
|
init();
|
|
|
|
});
|