/*
Author : Dreamguys
Template Name: Kanakku - Bootstrap Admin Template
Version : 1.0
*/
(function($) {
"use strict";
// Variables declarations
var $wrapper = $('.main-wrapper');
var $pageWrapper = $('.page-wrapper');
var $slimScrolls = $('.slimscroll');
// Sidebar
var Sidemenu = function () {
this.$menuItem = $('#sidebar-menu a');
};
function init() {
var $this = Sidemenu;
$('#sidebar-menu a').on('click', function (e) {
if ($(this).parent().hasClass('submenu')) {
e.preventDefault();
}
if (!$(this).hasClass('subdrop')) {
$('ul', $(this).parents('ul:first')).slideUp(350);
$('a', $(this).parents('ul:first')).removeClass('subdrop');
$(this).next('ul').slideDown(350);
$(this).addClass('subdrop');
} else if ($(this).hasClass('subdrop')) {
$(this).removeClass('subdrop');
$(this).next('ul').slideUp(350);
}
});
$('#sidebar-menu ul.sidebar-vertical li.submenu a.active').parents('li:last').children('a:first').addClass('active').trigger('click');
}
// image file upload cover-image image
if($('#cover-image').length > 0) {
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#cover-image').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#cover_upload").change(function(){
readURL(this);
});
}
// Sidebar popup overlay
if($('.popup-toggle').length > 0) {
$(".popup-toggle").click(function(){
$(".toggle-sidebar").addClass("open-filter");
$("body").addClass("filter-opened");
});
$(".sidebar-closes").click(function(){
$(".toggle-sidebar").removeClass("open-filter");
$("body").removeClass("filter-opened");
});
}
if($('.win-maximize').length > 0) {
$('.win-maximize').on('click', function(e){
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen();
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
}
}
})
}
// View all Show hide One
if($('.viewall-One').length > 0) {
$(document).ready(function () {
$(".viewall-One").hide();
$(".viewall-button-One").click(function () {
$(this).text($(this).text() === "Close All" ? "View All" : "Close All");
$(".viewall-One").slideToggle(900);
});
});
}
// View all Show hide Two
if($('.viewall-Two').length > 0) {
$(document).ready(function () {
$(".viewall-Two").hide();
$(".viewall-button-Two").click(function () {
$(this).text($(this).text() === "Close All" ? "View All" : "Close All");
$(".viewall-Two").slideToggle(900);
});
});
}
// image file upload image
if($('#blah').length > 0) {
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#blah').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#avatar_upload").change(function(){
readURL(this);
});
}
$(document).ready(function(){
$('#image_sign').change(function(){
$("#frames").html('');
for (var i = 0; i < $(this)[0].files.length; i++) {
$("#frames").append('');
}
});
$('#image_sign2').change(function(){
$("#frames2").html('');
for (var i = 0; i < $(this)[0].files.length; i++) {
$("#frames2").append('
');
}
});
});
// Sidebar Initiate
init();
// Mobile menu sidebar overlay
$('body').append('