12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052 |
- "use strict";
- var app = {
- app: false,
- isloaded: false,
- header: false,
- footer: false,
- settings: {
- navDetectAuto: true,
- navHorizontalDetectAuto: true,
- screen_md: 992,
- sidepanelMobileHeight: 400,
- sidebarMobileHeight: 400
- },
- accordion_settings: {titleHeight: 50, noResize: false},
-
- init: function(){
- this.app = $(".app");
- this.header = $(".app > .app-header").length > 0 ? $(".app > .app-header") : false;
- this.footer = $(".app > .app-footer").length > 0 ? $(".app > .app-footer") : false;
- },
- layout: function(){
-
- // sidebars media
- app.layoutSidebars();
- // end
-
- // check header position
- if($(".app-content > .app-header").length === 1)
- $(".app-container").addClass("app-header-inside-content");
- // end
-
- // params for app-container
- $(".app-container").each(function(){
- var app_content = $(this).find(".app-content");
-
- $(this).find(".app-sidebar").each(function(){
-
- if($(this).hasClass("dir-left")){
- app_content.addClass("app-sidebar-left");
- }
-
- if($(this).hasClass("dir-right"))
- app_content.addClass("app-sidebar-right");
-
- });
- });
- // end of params
-
- // sidebar actions
- $(".app-sidebar-left-closed .app-sidebar, .app-sidebar-right-closed .app-sidebar").css("display","none");
-
- $("[data-sidebar-toggle]").on("click",function(){
- var app_sidebar = $($(this).data("sidebar-toggle")),
- app_sidebar_direction = app_sidebar.hasClass("dir-left") ? 'left' : 'right',
- app_container = app_sidebar.parent(".app-container");
-
- if(app_container.hasClass("app-sidebar-"+app_sidebar_direction+"-closed")){
- app_sidebar.css("display","block");
- setTimeout(function(){
- app_container.removeClass("app-sidebar-"+app_sidebar_direction+"-closed");
- },10);
-
- }else{
- app_sidebar.css("display","none");
- app_container.addClass("app-sidebar-"+app_sidebar_direction+"-closed");
- }
- //app_container.toggleClass("app-sidebar-"+app_sidebar_direction+"-closed");
- //app_sidebar.toggleClass("app-sidebar-open"); ??? WTF?
-
- $(window).resize();
-
- return false;
- });
- $("[data-sidebar-minimize]").on("click",function(){
-
- if($(window).width() < app.settings.screen_md) return false;
-
- var app_sidebar = $($(this).data("sidebar-minimize")),
- app_sidebar_direction = app_sidebar.hasClass("dir-left") ? 'left' : 'right',
- app_container = app_sidebar.parent(".app-container"),
- toggle_class = "app-sidebar-"+app_sidebar_direction+"-minimized";
-
- app_container.removeClass("app-sidebar-"+app_sidebar_direction+"-closed");
- app_sidebar.css("display","block");
-
- if(app_container.hasClass(toggle_class)){
- app_container.removeClass(toggle_class);
- app_sidebar.removeClass("app-navigation-minimized").find("li.open").removeClass("open");
- app_sidebar.removeAttr("data-minimized").removeData("minimized");
-
- if(app_sidebar.hasClass("scroll"))
- app_sidebar.mCustomScrollbar("update");
- }else{
- app_container.addClass(toggle_class);
- app_sidebar.addClass("app-navigation-minimized").find("li.open").removeClass("open");
- app_sidebar.removeAttr("data-minimized").removeData("minimized");
-
- if(app_sidebar.hasClass("scroll"))
- app_sidebar.mCustomScrollbar("disable",true);
- }
-
- // fix after resize
- $(window).resize();
-
- return false;
- });
-
- // sidepanel
-
-
- $("[data-sidepanel-toggle]").on("click",function(){
- var app_sidepanel = $($(this).data('sidepanel-toggle'));
-
- if($(".app").hasClass("app-sidepanel-open")){
- // close sidepanel
- $(".app").removeClass("app-sidepanel-open");
-
- // remove overlay if needs
- if(app_sidepanel.data("overlay") === 'show'){
- app.hideOverlay();
- }
-
- }else{
- // open sidepanel
- $(".app").addClass("app-sidepanel-open");
-
- // show overlay if needs
- if(app_sidepanel.data("overlay") === 'show'){
- app.showOverlay(function(){
- $(".app-overlay").on("click",function(){
- $(".app").removeClass("app-sidepanel-open");
- app.hideOverlay();
- });
- });
- }
- }
-
- // fix after resize
- $(window).resize();
-
- return false;
- });
- // end sidepanel actions
-
- // separated content actions
- $("[data-separate-toggle-panel]").on("click",function(){
- $($(this).data("separate-toggle-panel")).toggleClass("open");
- });
- },
- layoutSidebars: function(){
-
- // control sidebar media
- if($(window).width() < app.settings.screen_md){
- if($(".app-container").hasClass("app-sidebar-left-minimized")){
- $(".app-container").removeClass("app-sidebar-left-minimized");
- $(".app-sidebar.dir-left").removeClass("app-navigation-minimized");
- $(".app-sidebar.dir-left").attr("data-minimized","minimized");
- }
- if($(".app-container").hasClass("app-sidebar-right-minimized")){
- $(".app-container").removeClass("app-sidebar-right-minimized");
- $(".app-sidebar.dir-right").removeClass("app-navigation-minimized");
- $(".app-sidebar.dir-right").attr("data-minimized","minimized");
- }
- }else{
- if($(".app-sidebar.dir-left").data("minimized") === "minimized"){
- $(".app-container").addClass("app-sidebar-left-minimized");
- $(".app-sidebar.dir-left").addClass("app-navigation-minimized");
- $(".app-sidebar.dir-left").mCustomScrollbar("disable",true);
- }
- if($(".app-sidebar.dir-right").data("minimized") === "minimized"){
- $(".app-container").addClass("app-sidebar-right-minimized");
- $(".app-sidebar.dir-right").addClass("app-navigation-minimized");
- $(".app-sidebar.dir-right").mCustomScrollbar("disable",true);
- }
- }
- // end
-
- },
- navigation: function(){
-
- // set openable navigation items
- $(".app-navigation nav > ul").find("ul").parent("li").addClass("openable");
-
- // set open element if it's avail
- if(app.settings.navDetectAuto && !$(".app-navigation").hasClass("app-navigation-minimized")){
- var path = window.location.pathname,
- pathArray = path.split("/"),
- page = pathArray[pathArray.length - 1];
-
- $(".app-navigation a[href='"+page+"']").addClass("active").parents(".openable").addClass("open");
- }
-
- // add open handler
- $(".app-navigation .openable > a").on("click",function(e){
- e.stopPropagation();
-
- var element = $(this).parent(".openable");
-
- if(element.hasClass("open")){
- element.removeClass("open");
- element.find("li.open").removeClass("open");
- }else{
-
- if(element.parents(".app-navigation").hasClass("app-navigation-minimized") || element.parents(".app-navigation").data("type") === "close-other"){
- element.parent("ul").find("> li").not(element).removeClass("open");
- }
- //element.parents(".app-navigation").css("height","auto"); // Tell me why?
- element.addClass("open");
-
- setTimeout(function(){
- $(".app-navigation").mCustomScrollbar('scrollTo',element);
- },200);
- }
-
- // fix after resize
-
- if($(".app-navigation").hasClass("scroll")){
- $(".app-navigation").mCustomScrollbar("update");
- }else{
- $(window).resize();
- }
-
- return false;
- });
-
- // horizontal navigation handler
- $(".app-navigation-horizontal nav > ul > li > ul").each(function(){
- $(this).parent("li").addClass("openable");
- });
-
- // set open element if it's avail
- if(app.settings.navHorizontalDetectAuto){
- var path = window.location.pathname,
- pathArray = path.split("/"),
- page = pathArray[pathArray.length - 1];
-
- $(".app-navigation-horizontal a[href='"+page+"']").parent("li").addClass("active").parents(".openable").addClass("active");
- }
-
- $(".app-navigation-horizontal .openable > a").on("click",function(e){
- e.stopPropagation();
-
- var nav = $(this).parents(".app-navigation-horizontal");
- nav.find(".openable").removeClass("active");
-
- $(this).parent(".openable").addClass("active");
-
- return false;
- });
- // end horizontal navigation handler
- },
- navigationMobile: function(){
-
- /* Mobile navigation handler */
- if($(".app-navigation-moblie-wrapper").length > 0){
- $("[data-navigation-mobile-toggle]").on("click",function(e){
- e.stopPropagation();
- $(".app").toggleClass("app-navigation-moblie-open");
-
- return false;
- });
- $(".app .app-navigation-mobile").on("click",function(e){
- e.stopPropagation();
- });
- $(".app .app-content").on("click",function(){
- $(".app").removeClass("app-navigation-moblie-open");
- });
- }
- /* end Mobile navigation handler */
-
- /* header navigation handler */
- if($(".app-header-navigation").length > 0){
-
- $("[data-header-navigation-toggle]").on("click",function(){
- $(".app-header-navigation").toggleClass("show");
- return false;
- });
-
- $(".app-header-navigation li > a").on("click",function(){
- var pli = $(this).parent("li");
-
- if(pli.find("ul").length > 0 || pli.find(".app-header-navigation-megamenu").length > 0){
- pli.toggleClass("open");
-
- return false;
- }
- });
-
- }
- /* end header navigation handler */
-
- /* navigation vertical handler */
- if($(".app-navigation-horizontal").length > 0){
- $("[data-navigation-horizontal-toggle]").on("click",function(){
- $(".app-navigation-horizontal").toggleClass("show");
-
- return false;
- });
- }
- /* end navigation vertical handler */
- },
- spy: function(){
-
- app.layoutSidebars();
-
- // return height to default
- if($(".app-content .container-full-size").length > 0){
- $(".app-content .container-full-size").removeAttr("style");
- }
- if($(".block-flying").length > 0){
- $(".block-flying").removeAttr("style");
- $(".block-flying .block-flying-content").removeAttr("style");
- }
- // end of...
-
- var winHeight = $(window).height(),
- offsetHeight = this._getHeaderHeight() + this._getFooterHeight() + this._getCustomOffset(),
- navFixed = $(".app-container .app-sidebar.app-navigation-fixed").length > 0 ? true : false,
- sidebars = $(".app-container .app-sidebar"),
- content = $(".app-container .app-content"),
- sidepanel = $(".app-sidepanel").length > 0 ? $(".app-sidepanel") : false;
-
- sidebars.css({"height":"auto"});
-
- var contentHeight = app._getTotalHeight(content.children()),
- sidebarHeight = this._getMaxHeight(sidebars);
-
- if($(window).width() > app.settings.screen_md){
-
- if(contentHeight >= sidebarHeight && sidebarHeight !== 0){
-
- if(sidebarHeight === 0 && (contentHeight+offsetHeight) < winHeight){
- content.height(winHeight - offsetHeight);
- }else{
- if((contentHeight + offsetHeight) <= winHeight){
- content.height(winHeight - offsetHeight);
- contentHeight = content.height();
- }
- }
- sidebars.height(contentHeight);
- }else{
-
- if((contentHeight + offsetHeight) <= winHeight){
- content.height(winHeight - offsetHeight);
- }
- if((sidebarHeight + offsetHeight) <= winHeight){
- sidebars.height(winHeight - offsetHeight);
- }
- }
- sidebars.each(function(){
- if($(this).attr("data-control-height") === 'true'){
- $(this).height(sidebarHeight);
- }
- });
-
- if($("[data-separate-control-height]").length > 0){
- var contentHeight = $(".app-container").height() - app._getTotalHeight($(".app-content > div").not(".app-content-separate"));
- $("[data-separate-control-height]").height(contentHeight);
- }
-
-
- if(navFixed){
- var nav = $(".app-container .app-sidebar.app-navigation-fixed");
-
- if(app.footer){
- nav.addClass("app-navigation-fixed-absolute");
-
- nav.height($(".app").height() - app.footer.height());
- }else
- nav.height(winHeight);
- }
- if(sidepanel) sidepanel.height(winHeight);
- }else{
- if($("[data-separate-control-height]").length > 0){
- $("[data-separate-control-height]").css({"height":"auto"});
- }
-
- sidebars.each(function(){
- if($(this).attr("data-control-height") === 'true'){
- $(this).height(app.settings.sidebarMobileHeight);
- }else{
- $(this).css({"height":"auto"});
- }
- });
-
- if(sidepanel)
- sidepanel.height($(window).height());
- //sidepanel.height(app.settings.sidepanelMobileHeight);
- }
-
- if($(".app-content .container-full-size").length > 0){
- $(".app-content .container-full-size").height(winHeight - $(".app-content .app-header").height() - 1);
- }
-
- if($(".block-flying").length > 0){
- $(".block-flying").height($(".block-flying").height());
- $(".block-flying .block-flying-content").height($(".block-flying").height() - app._getTotalHeight($(".block-flying > div").not(".block-flying-content")));
-
- if($(window).width() < app.settings.screen_md){
- $(".block-flying").width($(".app-container").width() - 30);
- }
-
- }
-
- return false;
- },
-
- /* block predefined functions */
- block: {
- delete: function(elm, fn){
- elm = $(elm);
-
- elm.fadeOut(200,function(){
- $(this).remove();
- });
-
- if(typeof fn === "function") fn();
-
- app.spy();
-
- return false;
- },
- toggle: function(elm, fn){
- elm = $(elm);
-
- elm.toggleClass("block-toggled");
-
- if(typeof fn === "function") fn();
-
- app.spy();
-
- return false;
- },
- expand: function(elm, fn){
- elm = $(elm);
-
- elm.toggleClass("block-expanded");
-
- if(typeof fn === "function") fn();
-
- return false;
- },
- loading: {
- start: function(elm){
- $(elm).append("<div class=\"block-loading-layer\"><div class=\"app-spinner loading loading-primary\"></div></div>");
- return true;
- },
- finish: function(elm){
- $(elm).find(".block-loading-layer").remove();
- return true;
- }
- }
- },
- panel: {
- delete: function(elm, fn){
- elm = $(elm);
-
- elm.fadeOut(200,function(){
- $(this).remove();
- });
-
- if(typeof fn === "function") fn();
-
- app.spy();
-
- return false;
- },
- toggle: function(elm, fn){
- elm = $(elm);
-
- elm.toggleClass("panel-toggled");
-
- if(typeof fn === "function") fn();
-
- app.spy();
-
- return false;
- },
- expand: function(elm, fn){
- elm = $(elm);
-
- elm.toggleClass("panel-expanded");
-
- if(typeof fn === "function") fn();
-
- return false;
- }
- },
- /* end block predefined functions */
-
- /* resizable layout */
- resizableLayout: function(){
-
- if($(".app-content-resizable").length === 0) return false;
-
- var minWidth = 300,
- wrapper = $(".app-content-resizable"),
- columns = wrapper.children(".app-content-resizable-column");
-
- $(".app-content-resizable-column").not(":last-child").resizable({
- handles: "e",
- minWidth: minWidth,
- start: function(e, ui) {
- columns.each(function(){
- $(this).width($(this).width());
- });
- },
- resize: function(e, ui){
-
- var next = $(this).next(".app-content-resizable-column"),
- otherElements = $(".app-content-resizable-column").not(next).not($(this)),
- otherWidth = app._getMaxWidth(otherElements),
- newWidth = wrapper.width() - otherWidth - ui.size.width;
-
- if(newWidth < minWidth){
- newWidth = minWidth;
-
- $(this).width(wrapper.width() - otherWidth - minWidth);
- next.width(newWidth);
-
- return false;
- }
-
- next.width(newWidth);
- },
- stop: function(e, ui) {
-
- columns.each(function(){
- $(this).width( Math.round(($(this).width() / wrapper.width()) * 100) + "%" );
- });
-
- }
- });//.on('resize', function (e) {
- //e.stopPropagation();
- //});
- },
- /* end resizable layout */
-
- /* features */
- features: {
- gallery: {
- init: function(){
- this.controlHeight();
-
- $(".app-feature-gallery").on("click","> li:first",function(){
- var gallery = $(this).parents(".app-feature-gallery");
- $(this).appendTo(gallery);
- });
- },
- controlHeight: function(){
- $(".app-feature-gallery").each(function(){
- var felm = $(this).find("> li:first");
- $(this).height(app._getTotalHeight(felm.children()));
- });
- }
- },
- preview: {
- init: function(){
- var preview = $("#preview"),
- dialog = preview.find(".modal-dialog"),
- content = preview.find(".modal-body");
-
- $(".preview").on("click",function(){
- content.html("");
- dialog.removeClass("modal-lg modal-sm modal-fw");
-
- if($(this).data("preview-image"))
- content.append(app.features.preview.build.image($(this).data("preview-image")));
-
- if($(this).data("preview-video"))
- content.append(app.features.preview.build.video($(this).data("preview-video")));
-
- if($(this).data("preview-href")){
- content.html(app.features.preview.build.href($(this).data("preview-href")));
- app_plugins.loaded();
- }
-
- if($(this).data("preview-size"))
- dialog.addClass($(this).data("preview-size"));
-
- if($(this).data("preview-title") && $(this).data("preview-description"))
- content.prepend(app.features.preview.build.text($(this).data("preview-title"),$(this).data("preview-description")));
-
- preview.modal("show");
-
- return false;
- });
-
- preview.on('hidden.bs.modal',function(){
- content.html("");
- });
-
- },
- build: {
- image: function(src){
- return $("<img>").attr("src",src).addClass("img-responsive");
- },
- video: function(src){
- return $("<div class=\"app-preview-video\"><iframe src=\""+src+"\" width=\"100%\" frameborder=\"0\" allowfullscreen></iframe></div>");
- },
- href: function(path){
-
- var result = null;
-
- $.ajax({url: path,type: 'get',dataType: 'html',async: false,
- success: function(data) {
- result = data;
- }
- });
-
- return result;
- },
- text: function(title,description){
- return $("<div></div>").addClass("app-heading app-heading-small app-heading-condensed").append( $("<div></div>").addClass("title").html("<h5>"+title+"</h5><p>"+description+"</p>") );
- }
- }
- }
- },
- /* end features */
-
- /* accordion feature */
- accordion: function(){
-
- if($(".app-accordion").length > 0){
-
- $(".app-accordion").each(function(){
- var app_accordion = $(this);
-
- app_accordion.find(".item").each(function(){
- var app_accordion_item = $(this);
-
- if(!app_accordion.data("type"))
- app_accordion.addClass("app-accordion-simple");
-
- app_accordion_item.find(".heading").on("click",function(){
-
- if(app_accordion_item.hasClass("open"))
- app_accordion_item.removeClass("open").removeAttr("style");
- else
- app_accordion_item.addClass("open");
-
-
- if(app_accordion.data("open") === "close-other"){
- app_accordion.find(".item").not(app_accordion_item).removeClass("open").removeAttr("style");
- }
-
- if(app_accordion.data("type") === "full-height"){
- app.accordionFullHeight(app_accordion);
- }
-
- });
- });
-
- });
-
- }
-
- },
- accordionFullHeight: function(accordion){
- if(accordion.hasClass("app-accordion-simple")) return false;
-
- var wrapper = accordion.parent("div"),
- items = accordion.find(".item"),
- itemsCount = items.length,
- openItemsCount = items.filter(".open").length;
-
- accordion.height(wrapper.height());
-
- var items = items.filter(".open");
- items.removeAttr("style");
-
- var freeHeight = wrapper.height() - (itemsCount - openItemsCount) * app.accordion_settings.titleHeight;
- var height = Math.floor(freeHeight / openItemsCount);
-
- items.each(function(){
- $(this).height(height);
- $(this).find(".content").height(height - app.accordion_settings.titleHeight);
- });
- },
- accordionFullHeightSpy: function(){
- $(".app-accordion").each(function(){
- app.accordionFullHeight($(this));
- });
- },
- accordionFullHeightResize: function(){
- $(".app-accordion").removeAttr("style").find(".item.open").removeAttr("style");
-
- delayBeforeFire(function(){
- app.accordionFullHeightSpy();
- },200);
- },
- /* end accordion feature */
-
- /* content tabs */
- contentTabs: function(){
-
- if($(".app-content-tabs").length > 0){
-
- $(".app-content-tabs a .close-tab").on("click",function(e){
- e.stopPropagation();
-
- var act = $(this).parents(".app-content-tabs");
-
- $($(this).parent("a").attr("href")).remove();
- $(this).parents("li").remove();
-
- act.find("li:first > a").trigger("click");
- });
-
- $(".app-content-tabs a").on("click",function(){
- $(".app-content-tabs a, .app-content-tab").removeClass("active");
- $(this).addClass("active");
- $($(this).attr("href")).addClass("active");
-
- return false;
- });
-
- }
-
- },
- /* end content tabs */
-
- /* features */
- showOverlay: function(func){
- $(".app-overlay").addClass("show");
- if(typeof func === "function") func();
- },
- hideOverlay: function(){
- $(".app-overlay").removeClass("show");
- },
- formsFile: function(){
-
- $("input.file").each(function(){
- var if_title = typeof $(this).attr("title") === "undefined" ? "Browse" : $(this).attr("title");
- var if_class = $(this).attr("class").replace("file","");
- if_class = if_class === "" ? " btn-default" : if_class;
- if_class = $(this).is(":disabled") ? if_class+" disabled" : if_class;
- $(this).wrap("<a href=\"#\" class=\"file-input btn"+if_class+"\"></a>").parent("a").append(if_title);
- $(this).parent("a").after("<span class=\"file-input-name\"></span>");
- });
- $("input.file").on("change",function(){
-
- var files = $(this)[0].files,
- text = "",
- divider = files.length > 1 ? divider = ", " : "";
-
- for (var i = 0; i < files.length; i++)
- text += files[i].name.split('/').pop().split('\\').pop() + (i !== (files.length - 1) ? divider : "");
-
- $(this).parent("a").next(".file-input-name").html(text);
- });
-
- },
- misc: function(){
- /* avoid dropdown close inside header */
- $(document).on('click', '.app-header .dropdown-menu', function (e) {
- e.stopPropagation();
- });
- /* end */
-
- /* fix height after shown */
- $(".panel-collapse").on("shown.bs.collapse", function(){
- $(window).resize();
- });
- /* end */
-
- /* fix height after alert hidden */
- $(".alert-dismissible").on("closed.bs.alert", function(){
- $(window).resize();
- });
- /* end */
-
- /* fix height after tab shown */
- $("a[data-toggle='tab']").on("shown.bs.tab", function(){
- $(window).resize();
- });
- /* end */
-
- /* icon preview */
- $(".icons-preview > li").on("click",function(){
-
- var icon = $(this).find(".name").html();
-
- $("#modal-icon-preview .modal-icon-preview-name").html(icon);
- $("#modal-icon-preview .modal-icon-preview-span").val("<span class=\""+icon+"\"></span>");
- $("#modal-icon-preview .modal-icon-preview-value").val(icon);
- $("#modal-icon-preview .modal-icon-preview-icon span").removeAttr("class").addClass(icon);
-
- $("#modal-icon-preview").modal("show");
- });
-
- $(".modal-icon-preview-value, .modal-icon-preview-span").on("click",function(){
- $(this).select();
- });
- /* end icon preview */
-
- /* lock screen */
- $(".app-lock .app-lock-user").on("click",function(){
- $(".app-lock").addClass("app-lock-open");
- $(".app-lock .app-lock-form").show().addClass("animated bounceIn");
- $(".app-lock .app-lock-form .form-control").focus();
- });
- /* ./lock screen */
-
- // New selector case insensivity
- $.expr[':'].containsi = function(a, i, m) {
- return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
- };
- },
- doc_nav: function(){
-
- var wH = $(window).height(),
- nav = $(".doc_fix_nav"),
- pdw = nav.parent("div").width() - 27;
-
- if(nav.length > 0){
- nav.width(pdw);
-
- if(nav.height() > wH){
- nav.height(wH - 60);
- nav.mCustomScrollbar({axis:"y", autoHideScrollbar: true, scrollInertia: 200, advanced: {autoScrollOnFocus: false}});
- }
-
- $(window).scroll(function(){
- var wp = $(window).scrollTop();
- var point = $(document).height() - 397 - nav.outerHeight(true);
- if(wp > 175){
- nav.addClass("fixed");
- if(wp > point)
- nav.addClass("stack");
- else
- nav.removeClass("stack");
- }else{
- nav.removeClass("fixed");
- }
- });
-
- }
-
- },
- loading: function(action,options){
- var settings = $.extend({
- state: '',
- value: [0,0],
- position: '',
- speed: 20,
- complete: null
- },options);
- if(action == 'show' || action == 'update'){
-
- if(action == 'show'){
- $(".app-loading").remove();
- var loading = '<div class="app-loading '+settings.position+'">\n\
- <div class="app-loading-progress'+(settings.state != '' ? ' app-loading-'+settings.state: '')+'" style="width:'+settings.value[0]+'%;"></div>\n\
- </div>';
- $('body').append(loading);
- }
-
- var i = $.isArray(settings.value) ? settings.value[0] : $(".app-loading .app-loading-progress").width();
- var to = $.isArray(settings.value) ? settings.value[1] : settings.value;
-
- var timer = setInterval(function(){
- $(".app-loading .app-loading-progress").css('width',i+'%'); i++;
-
- if(i > to){
- clearInterval(timer);
- if($.isFunction(settings.complete)){
- settings.complete.call(this);
- }
- }
- }, settings.speed);
- }
- if(action == 'destroy'){
- $(".app-loading").remove();
- }
-
- },
- statusbar: {
- init: function(){
-
- $(".app-statusbar-open, .app-statusbar-close").on("click",function () {
- app.statusbar.open($(this).attr('href'));
- return false;
- });
-
- },
- open: function(id){
- $(".app-statusbar").hide();
- if($(id).is(":hidden")) $(id).fadeIn();
- }
- },
- search: function(){
-
- $(".app-header-search").on("click",function(){
- $(".app-header-search > input").focus();
- });
-
- },
- /* table checkall */
- checkAll: function(){
- $("table .checkall").on("change", function(){
- var state = $(this).is(":checked") ? true : false;
- var tbody = $(this).parents("table").find("tbody");
- tbody.find("tr").each(function(){
- $(this).find("input:checkbox").prop("checked",state).attr("checked",state);
- });
- });
- },
- /* eof table checkall */
- _getTotalHeight: function(elm){
- var totalHeight = 0;
-
- elm.each(function(){
- totalHeight += $(this).outerHeight(true);
- });
-
- return totalHeight;
- },
- _getMaxHeight: function(elm){
- var maxHeight = 0;
-
- elm.each(function(){
- maxHeight = $(this).height() > maxHeight ? $(this).height() : maxHeight;
- });
-
- return maxHeight;
- },
- _getMaxWidth: function(elm){
- var maxWidth = 0;
-
- elm.each(function(){
- maxWidth = $(this).width() > maxWidth ? $(this).width() : maxWidth;
- });
-
- return maxWidth;
- },
- _getHeaderHeight: function(){
- return this.header ? this.header.outerHeight(true) : 0;
- },
- _getFooterHeight: function(){
- return this.footer ? this.footer.outerHeight(true) : 0;
- },
- _getCustomOffset: function(){
- return this.app.data("offset-height") ? this.app.data("offset-height") : 0;
- },
- _delayBeforeFire: function(){
- var timer = 0;
-
- return function (callback, ms) {
- clearTimeout(timer);
- timer = setTimeout(callback, ms);
- };
- },
- _toggleClass: function(container,cl){
- $(container).toggleClass(cl);
-
- // spy height changes
- app.spy();
-
- return false;
- },
- _addClass: function(container,cl){
- $(container).addClass(cl);
-
- // spy height changes
- app.spy();
-
- return false;
- },
- _removeClass: function(container,cl){
- $(container).removeClass(cl);
-
- // spy height changes
- app.spy();
-
- return false;
- },
- loaded: function(){
- app.spy();
-
- app.app.addClass("app-loaded");
- app.accordion();
- app.accordionFullHeightSpy();
-
- setTimeout(function(){
- $("body").scrollTop(0);
- },500);
-
- app.isloaded = true;
- }
- };
- $(function(){
-
- app.init();
- app.layout();
- app.resizableLayout();
-
- app.navigation();
- app.navigationMobile();
- app.contentTabs();
- app.formsFile();
- app.checkAll();
-
- app.features.gallery.init();
- app.features.preview.init();
- app.statusbar.init();
-
- app.search();
-
- app.misc();
- app.doc_nav();
- });
- $(window).resize(function(){
-
- delayBeforeFire(function(){
- app.accordionFullHeightResize();
- app.features.gallery.controlHeight();
- app.spy();
- },100);
-
- });
- var delayBeforeFire = (function(){
- var timer = 0;
-
- return function (callback, ms) {
- clearTimeout(timer);
- timer = setTimeout(callback, ms);
- };
- })();
|