astro-mail/public/assets/js/jquery.webui-popover.js

1 line
17 KiB
JavaScript
Raw Permalink Normal View History

2024-11-14 10:24:23 +00:00
!function(t,e,i){"use strict";var o;o=function(i){var o="webuiPopover",n="webui-popover",s="webui.popover",h={placement:"auto",container:null,width:"auto",height:"auto",trigger:"click",style:"",selector:!1,delay:{show:null,hide:300},async:{type:"GET",before:null,success:null,error:null},cache:!0,multi:!1,arrow:!0,title:"",content:"",closeable:!1,padding:!0,url:"",type:"html",direction:"",animation:null,template:'<div class="webui-popover"><div class="webui-arrow"></div><div class="webui-popover-inner"><a href="#" class="close"></a><h3 class="webui-popover-title"></h3><div class="webui-popover-content"><i class="icon-refresh"></i> <p>&nbsp;</p></div></div></div>',backdrop:!1,dismissible:!0,onShow:null,onHide:null,abortXHR:!0,autoHide:!1,offsetTop:0,offsetLeft:0,iframeOptions:{frameborder:"0",allowtransparency:"true",id:"",name:"",scrolling:"",onload:"",height:"",width:""},hideEmpty:!1},r=n+"-rtl",a=[],l=i('<div class="webui-popover-backdrop"></div>'),c=0,p=!1,f=i(e),d=function(t,e){return isNaN(t)?e||0:Number(t)},g=function(t){return t.data("plugin_"+o)},u=function(){for(var t=null,e=0;e<a.length;e++)(t=g(a[e]))&&t.hide(!0);f.trigger("hiddenAll."+s)},m=function(t){for(var e=null,i=0;i<a.length;i++)(e=g(a[i]))&&e.id!==t.id&&e.hide(!0);f.trigger("hiddenAll."+s)},v="ontouchstart"in e.documentElement&&/Mobi/.test(navigator.userAgent),y=function(t){var e={x:0,y:0};if("touchstart"===t.type||"touchmove"===t.type||"touchend"===t.type||"touchcancel"===t.type){var i=t.originalEvent.touches[0]||t.originalEvent.changedTouches[0];e.x=i.pageX,e.y=i.pageY}else("mousedown"===t.type||"mouseup"===t.type||"click"===t.type)&&(e.x=t.pageX,e.y=t.pageY);return e};function $(t,e){return this.$element=i(t),e&&("string"===i.type(e.delay)||"number"===i.type(e.delay))&&(e.delay={show:e.delay,hide:e.delay}),this.options=i.extend({},h,e),this._defaults=h,this._name=o,this._targetclick=!1,this.init(),a.push(this.$element),this}$.prototype={init:function(){if(this.$element[0]instanceof e.constructor&&!this.options.selector)throw Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");"manual"!==this.getTrigger()&&(v?this.$element.off("touchend",this.options.selector).on("touchend",this.options.selector,i.proxy(this.toggle,this)):"click"===this.getTrigger()?this.$element.off("click",this.options.selector).on("click",this.options.selector,i.proxy(this.toggle,this)):"hover"===this.getTrigger()&&this.$element.off("mouseenter mouseleave click",this.options.selector).on("mouseenter",this.options.selector,i.proxy(this.mouseenterHandler,this)).on("mouseleave",this.options.selector,i.proxy(this.mouseleaveHandler,this))),this._poped=!1,this._inited=!0,this._opened=!1,this._idSeed=c,this.id=o+this._idSeed,this.options.container=i(this.options.container||e.body).first(),this.options.backdrop&&l.appendTo(this.options.container).hide(),c++,"sticky"===this.getTrigger()&&this.show(),this.options.selector&&(this._options=i.extend({},this.options,{selector:""}))},destroy:function(){for(var t=-1,e=0;e<a.length;e++)if(a[e]===this.$element){t=e;break}a.splice(t,1),this.hide(),this.$element.data("plugin_"+o,null),"click"===this.getTrigger()?this.$element.off("click"):"hover"===this.getTrigger()&&this.$element.off("mouseenter mouseleave"),this.$target&&this.$target.remove()},getDelegateOptions:function(){var t={};return this._options&&i.each(this._options,function(e,i){h[e]!==i&&(t[e]=i)}),t},hide:function(t,e){if((t||"sticky"!==this.getTrigger())&&this._opened){e&&(e.preventDefault(),e.stopPropagation()),this.xhr&&!0===this.options.abortXHR&&(this.xhr.abort(),this.xhr=null);var o=i.Event("hide."+s);if(this.$element.trigger(o,[this.$target]),this.$target){this.$target.removeClass("in").addClass(this.getHideAnimation());var n=this;setTimeout(function(){n.$target.hide(),n.getCache()||n.$target.remove()},n.getHideDelay())}this.options.backdrop&&l.hide(),this._opened=!1,this.$element.trigger("hidden."+s,[this.$target]),this.options.onHide&&this.options.onHide(this.$target)}},resetAutoHide:function(){var t=this,e=t.getAutoHide()