Current File : /home/itiffy/public_html/quickadmin/js/main.js |
$(document).ready(function () {
var activeSub = $(document).find('.active-sub');
if (activeSub.length > 0) {
activeSub.parent().show();
activeSub.parent().parent().find('.arrow').addClass('open');
activeSub.parent().parent().addClass('open');
}
$('.datatable').dataTable({
retrieve: true,
"iDisplayLength": 100,
"aaSorting": [],
"aoColumnDefs": [
{'bSortable': false, 'aTargets': [0]}
]
});
$('.ckeditor').each(function () {
CKEDITOR.replace($(this));
})
$('.mass').click(function () {
if ($(this).is(":checked")) {
$('.single').each(function () {
if ($(this).is(":checked") == false) {
$(this).click();
}
});
} else {
$('.single').each(function () {
if ($(this).is(":checked") == true) {
$(this).click();
}
});
}
});
$('.page-sidebar').on('click', 'li > a', function (e) {
if ($('body').hasClass('page-sidebar-closed') && $(this).parent('li').parent('.page-sidebar-menu').size() === 1) {
return;
}
var hasSubMenu = $(this).next().hasClass('sub-menu');
if ($(this).next().hasClass('sub-menu always-open')) {
return;
}
var parent = $(this).parent().parent();
var the = $(this);
var menu = $('.page-sidebar-menu');
var sub = $(this).next();
var autoScroll = menu.data("auto-scroll");
var slideSpeed = parseInt(menu.data("slide-speed"));
var keepExpand = menu.data("keep-expanded");
if (keepExpand !== true) {
parent.children('li.open').children('a').children('.arrow').removeClass('open');
parent.children('li.open').children('.sub-menu:not(.always-open)').slideUp(slideSpeed);
parent.children('li.open').removeClass('open');
}
var slideOffeset = -200;
if (sub.is(":visible")) {
$('.arrow', $(this)).removeClass("open");
$(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 if (hasSubMenu) {
$('.arrow', $(this)).addClass("open");
$(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
});
}
}
});
}
if (hasSubMenu == true || $(this).attr('href') == '#') {
e.preventDefault();
}
});
});