praiadeseselle/wire/modules/Jquery/JqueryUI/panel.min.js

1 line
5.5 KiB
JavaScript
Raw Permalink Normal View History

2022-03-08 15:55:41 +01:00
var pwPanels={qty:0,init:function(){var a=window.location.href;if(a.indexOf("pw_panel=1")>-1){$(document).on("mouseover","a",function(){var b=$(this);var c=b.attr("target");if(typeof c=="undefined"||c.length==0){b.attr("target","_parent")}})}else{if(a.indexOf("pw_panel=2")>-1){}else{$(".pw-panel").each(function(){var b=$(this);pwPanels.addPanel(b)})}}},addPanel:function(a){var i=a.attr("data-href");var f=a.attr("data-panel-id");var b="pw-panel-container-"+(++pwPanels.qty);if(typeof i=="undefined"||!i.length){i=a.attr("href")}if(typeof i!="undefined"&&i.length){var d="";if(i.indexOf("#")>-1){var c=i.split("#");i=c[0];d="#"+c[1]}i+=(i.indexOf("?")>-1?"&":"?")+"modal=panel&pw_panel=";if(a!==null&&a.hasClass("pw-panel-links")){i+="2"}else{i+="1"}i+=d}var e=$("<i />").attr("class","pw-panel-icon fa fa-angle-double-left");var g=$("<small />").attr("class","ui-button-text").append(e);var h=$("<a />").attr("class","pw-panel-button pw-panel-button-closed ui-button ui-state-default").attr("href",i).on("click",pwPanels.buttonClickEvent).on("mouseover",pwPanels.buttonMouseoverEvent).on("mouseout",pwPanels.buttonMouseoutEvent).append(g);var j=$("<div />").attr("id",b).attr("class","pw-panel-container pw-panel-container-closed").append(h);$("body").append(j);if(typeof f!="undefined"&&f.length){$("#"+f).hide().addClass("pw-panel-element");j.addClass("pw-panel-container-element").attr("data-panel-id",f)}if(a!==null){pwPanels.initToggler(a,h,j)}else{j.addClass("pw-panel-left")}},initToggler:function(c,k,m){var f=c.hasClass("pw-panel-right")?"right":"left";var l=c.attr("data-tab-text");var i=c.attr("data-tab-icon");var g=c.attr("data-tab-offset");var b=c.attr("data-panel-width");var e=f=="right"?"left":"right";var d=1;m.addClass("pw-panel-tab pw-panel-"+f);m.attr("data-href",k.attr("href"));if(c.hasClass("pw-panel-reload")){m.addClass("pw-panel-reload")}if(typeof g!="undefined"){g=parseInt(g);if(g>-1){k.css("top",g+"px")}else{k.css("top","auto");k.css("bottom",Math.abs(g)+"px")}}if(typeof l!="undefined"&&l.length){var a=k.children(".ui-button-text");var j=$("<span />").text(l);a.html("<span>"+j.text()+"</span>");k.addClass("pw-panel-button-text");d=7}if(typeof i!="undefined"&&i.length){var h=$("<i />").addClass("fa fa-fw fa-"+i);var j=k.children(".ui-button-text");if(k.hasClass("pw-panel-button-text")){j.prepend(h)}else{j.empty().append(h);k.css(e,(-1*(k.outerWidth()))+"px")}}if(typeof b!="undefined"&&b.length){m.css("width",b);m.css(f,"-"+b)}if(f=="right"){}else{k.css("right",(-1*(d+k.height()))+"px")}if(!c.hasClass("pw-panel-tab")){k.addClass("pw-panel-button-hidden")}c.click(function(){k.click();return false}).on("mouseover",function(){k.mouseover()}).on("mouseout",function(){k.mouseout()})},initPanelContent:function(d){var b=d.find(".pw-panel-content");var a=d.attr("data-panel-id");if(b.length){return b}else{if(typeof a!="undefined"){var c=$("#"+a);if(c.length){b=$("<div />").addClass("pw-panel-content").css("overflow","auto");d.append(b);b.append(c);c.show();c.trigger("pw-panel-init")}}else{b=$("<iframe />").addClass("pw-panel-content").attr("src",d.attr("data-href"));d.append(b)}}return b},windowResizeEvent:function(){$(".pw-panel-container-init").each(function(){var c=$(this);if(c.hasClass("pw-panel-container-open")){return}var b=c.width();var a=(-1*b)+"px";if(c.hasClass("pw-panel-right")){c.css("right",a)}else{c.css("left",a)}})},buttonClickEvent:function(){var i=$(this);var k=i.closest(".pw-panel-container");var f=k.find(".pw-panel-content");var b=k.hasClass("pw-panel-container-open");var c=k.hasClass("pw-panel-container-loaded");var a=k.width();var e=k.hasClass("pw-panel-right")?"right":"left";var h=typeof jQuery.ui!="undefined";function d(){k.toggleClass("pw-panel-container-open pw-panel-container-closed");i.toggleClass("pw-panel-button-open pw-panel-button-closed")}if($(".pw-panel-container-init").length==0){$(window).resize(pwPanels.windowResizeEvent)}if(b){var j=(-1*a)+"px";if(h){if(e=="left"){k.animate({left:j},150,d)}else{k.animate({right:j},150,d)}}else{k.css(e,j);d()}$("body").css("overflow","");$("#pw-panel-shade").fad