/*!
* remark (http://getbootstrapadmin.com/remark)
* Copyright 2016 amazingsurge
* Licensed under the Themeforest Standard Licenses
*/
$.components.register("panel",{api:function(){$(document).on("click.site.panel",'[data-toggle="panel-fullscreen"]',function(e){e.preventDefault();var $this=$(this),$panel=$this.closest(".panel"),api=$panel.data("panel-api");api.toggleFullscreen()}),$(document).on("click.site.panel",'[data-toggle="panel-collapse"]',function(e){e.preventDefault();var $this=$(this),$panel=$this.closest(".panel"),api=$panel.data("panel-api");api.toggleContent()}),$(document).on("click.site.panel",'[data-toggle="panel-close"]',function(e){e.preventDefault();var $this=$(this),$panel=$this.closest(".panel"),api=$panel.data("panel-api");api.close()}),$(document).on("click.site.panel",'[data-toggle="panel-refresh"]',function(e){e.preventDefault();var $this=$(this),$panel=$this.closest(".panel"),api=$panel.data("panel-api"),callback=$this.data("loadCallback");$.isFunction(window[callback])?api.load(window[callback]):api.load()})},init:function(context){$(".panel",context).each(function(){var $loading,$this=$(this),isFullscreen=!1,isClose=!1,isCollapse=!1,isLoading=!1,$fullscreen=$this.find('[data-toggle="panel-fullscreen"]'),$collapse=$this.find('[data-toggle="panel-collapse"]'),self=this;$this.hasClass("is-collapse")&&(isCollapse=!0);var api={load:function(callback){var type=$this.data("load-type");type||(type="blue-only"),$loading=$('
'),$loading.appendTo($this),$this.addClass("is-loading"),$this.trigger("loading.uikit.panel"),isLoading=!0,$.isFunction(callback)&&callback.call(self,this.done)},done:function(){isLoading===!0&&($loading.remove(),$this.removeClass("is-loading"),$this.trigger("loading.done.uikit.panel"))},toggleContent:function(){isCollapse?this.showContent():this.hideContent()},showContent:function(){isCollapse!==!1&&($this.removeClass("is-collapse"),$collapse.hasClass("md-plus")&&$collapse.removeClass("md-plus").addClass("md-minus"),$this.trigger("shown.uikit.panel"),isCollapse=!1)},hideContent:function(){isCollapse!==!0&&($this.addClass("is-collapse"),$collapse.hasClass("md-minus")&&$collapse.removeClass("md-minus").addClass("md-plus"),$this.trigger("hidden.uikit.panel"),isCollapse=!0)},toggleFullscreen:function(){isFullscreen?this.leaveFullscreen():this.enterFullscreen()},enterFullscreen:function(){isFullscreen!==!0&&($this.addClass("is-fullscreen"),$fullscreen.hasClass("md-fullscreen")&&$fullscreen.removeClass("md-fullscreen").addClass("md-fullscreen-exit"),$this.trigger("enter.fullscreen.uikit.panel"),isFullscreen=!0)},leaveFullscreen:function(){isFullscreen!==!1&&($this.removeClass("is-fullscreen"),$fullscreen.hasClass("md-fullscreen-exit")&&$fullscreen.removeClass("md-fullscreen-exit").addClass("md-fullscreen"),$this.trigger("leave.fullscreen.uikit.panel"),isFullscreen=!1)},toggle:function(){isClose?this.open():this.close()},open:function(){isClose!==!1&&($this.removeClass("is-close"),$this.trigger("open.uikit.panel"),isClose=!1)},close:function(){isClose!==!0&&($this.addClass("is-close"),$this.trigger("close.uikit.panel"),isClose=!0)}};$this.data("panel-api",api)})}});