-
Notifications
You must be signed in to change notification settings - Fork 0
/
wb.panel.min.js
7 lines (7 loc) · 2.94 KB
/
wb.panel.min.js
1
2
3
4
5
6
7
/* jQuery Panel Plugin for WYSIWYG Web Builder 17 - Copyright Pablo Software solutions 2022 - http://www.wysiwygwebbuilder.com */
(function(b){b.fn.panel=function(e){return this.each(function(){b.panel(this,e)})};b.panel=function(e,a){var c={animate:!0,animationDuration:200,animationEasing:"swing",dismissible:!0,display:"push",overlay:!1,position:"left",toggle:!1};$obj=b(e);a&&(c=b.extend(c,a));c.id=$obj.attr("id");c.trigger="";if(c.toggle)c.trigger="#"+c.id;else{var g=b("a[href='#"+c.id+"']");0!=g.length&&(c.trigger="#"+g.first().attr("id"))}var f=c.id+"_panel";(g=$obj.attr("href"))||(g="#"+$obj.attr("id"));0==b("#container").length&&
"overlay"!=c.display&&b("body").wrapInner('<div id="container" style="position:relative;margin:0" />');var d=b("<div />");d.attr("id",f);d.css("display","none");d.data("panel",c);1==c.overlay&&(f=b("<div />"),f.attr("id",$obj.attr("id")+"_overlay"),f.attr("class","panel_overlay"),b("body").append(f),f.click(function(a){b.panel.hide(d)}));b(g).appendTo(d).show();b("body").append(d);""!=c.trigger&&b(c.trigger).click(function(a){a.preventDefault();a.stopPropagation();d.is(":visible")?b.panel.hide(d):
b.panel.show(d)});b(document).bind("click keyup",function(a){("keyup"!=a.type||27==a.keyCode)&&d.is(":visible")&&d.data("panel").dismissible&&b.panel.hide(d)});d.click(function(a){a.stopPropagation()})};b.panel.show=function(e){var a=e.data("panel"),c=e.outerWidth(!0),g=e.outerHeight(!0),f={},d={};if(!e.is(":visible")&&!a.isBusy){a.isBusy=!0;""!=a.trigger&&b(a.trigger).addClass("open");a.overlay&&b(".panel_overlay").fadeIn();"left"==a.position?(e.css({left:"-"+c+"px",right:"auto"}),f["margin-left"]=
"+="+c,d.left="+="+c):"top"==a.position?(e.css({top:"-"+g+"px",bottom:"auto"}),f["margin-top"]="+="+g,d.top="+="+g):"bottom"==a.position?(e.css({top:"auto",bottom:"-"+g+"px"}),f["margin-top"]="-="+g,d.bottom="+="+g):(e.css({left:"auto",right:"-"+c+"px"}),f["margin-left"]="-="+c,d.right="+="+c);var h=0;"absolute"==e.css("position")&&(h=b(document.body).outerHeight(!0));a.animate?("overlay"!=a.display&&b("body").animate(f,a.animationDuration,a.animationEasing),e.show().animate(d,a.animationDuration,
a.animationEasing,function(){a.isBusy=!1;0!=h&&e.height(h)})):("overlay"!=a.display&&b("body").css(f),e.show().css(d),a.isBusy=!1,0!=h&&e.height(h))}};b.panel.hide=function(e){var a=e.data("panel"),c=e.outerWidth(!0),g=e.outerHeight(!0),f={},d={};e.is(":hidden")||a.isBusy||(a.isBusy=!0,""!=a.trigger&&b(a.trigger).removeClass("open"),a.overlay&&b(".panel_overlay").fadeOut(),"left"==a.position?(f["margin-left"]="-="+c,d.left="-="+c):"top"==a.position?(f["margin-top"]="-="+g,d.top="-="+g):"bottom"==
a.position?(f["margin-top"]="+="+g,d.bottom="-="+g):(f["margin-left"]="+="+c,d.right="-="+c),a.animate?(e.animate(d,a.animationDuration,a.animationEasing,function(){e.hide();a.isBusy=!1}),"overlay"!=a.display&&b("body").animate(f,a.animationDuration,a.animationEasing)):("overlay"!=a.display&&b("body").css(f),e.css(d).hide(),a.isBusy=!1))}})(jQuery);