|
|
!function(a,b,c,d){a.fn.popup=function(e){var f,g=a(this),h=a(c),i=g.selector||"",j=(new Date).getTime(),k=[],l=arguments[0],m="string"==typeof l,n=[].slice.call(arguments,1);return g.each(function(){var c,g=a.isPlainObject(e)?a.extend(!0,{},a.fn.popup.settings,e):a.extend({},a.fn.popup.settings),o=g.selector,p=g.className,q=g.error,r=g.metadata,s=g.namespace,t="."+g.namespace,u="module-"+s,v=a(this),w=a(g.context),x=g.target?a(g.target):v,y=a(b),z=g.popup?a(g.popup):g.inline?x.next(g.selector.popup):y.children(g.selector.popup).last(),A=g.popup?z.offsetParent():g.inline?x.offsetParent():y,B=0,C=this,D=v.data(u);c={initialize:function(){c.debug("Initializing module",v),"click"==g.on?v.on("click",c.toggle):c.get.startEvent()&&v.on(c.get.startEvent()+t,c.event.start).on(c.get.endEvent()+t,c.event.end),g.target&&c.debug("Target set to element",x),y.on("resize"+t,c.event.resize),c.exists()?g.hoverable&&c.bind.popup():c.create(),c.instantiate()},instantiate:function(){c.verbose("Storing instance of module",c),D=c,v.data(u,D)},refresh:function(){g.popup?(z=a(g.popup),A=z.offsetParent()):g.inline?(z=x.next(o.popup),A=x.offsetParent()):z=y.children(o.popup).last()},destroy:function(){c.debug("Destroying previous module"),z.remove(),v.off(t).removeData(u)},event:{start:function(){var b=a.isPlainObject(g.delay)?g.delay.show:g.delay;clearTimeout(c.hideTimer),c.showTimer=setTimeout(function(){c.is.hidden()&&c.show()},b)},end:function(){var b=a.isPlainObject(g.delay)?g.delay.hide:g.delay;clearTimeout(c.showTimer),c.hideTimer=setTimeout(function(){c.is.visible()&&c.hide()},b)},resize:function(){c.is.visible()&&c.set.position()}},create:function(){c.debug("Creating pop-up html");var b=v.data(r.html)||g.html,e=v.data(r.variation)||g.variation,f=v.data(r.title)||g.title,h=v.data(r.content)||v.attr("title")||g.content;b||h||f?(b||(b=g.template({title:f,content:h})),z=a("<div/>").addClass(p.popup).addClass(e).html(b),e&&z.addClass(e),g.inline?(c.verbose("Inserting popup element inline",z),z.insertAfter(v)):(c.verbose("Appending popup element to body",z),z.appendTo(w)),g.hoverable&&c.cache===d&&c.bind.popup(),a.proxy(g.onCreate,z)()):c.error(q.content,C)},toggle:function(){c.debug("Toggling pop-up"),c.is.hidden()?(c.debug("Popup is hidden, showing pop-up"),c.unbind.close(),c.hideAll(),c.show()):(c.debug("Popup is visible, hiding pop-up"),c.hide())},show:function(a){a=a||function(){},c.debug("Showing pop-up",g.transition),g.preserve||g.popup||c.refresh(),c.exists()||c.create(),c.set.position()&&(c.save.conditions(),c.animate.show(a))},hide:function(a){a=a||function(){},v.removeClass(p.visible),c.unbind.close(),c.is.visible()&&(c.restore.conditions(),c.animate.hide(a))},hideAll:function(){a(o.popup).filter(":visible").popup("hide")},hideGracefully:function(b){b&&0===a(b.target).closest(o.popup).size()?(c.debug("Click occurred outside popup hiding popup"),c.hide()):c.debug("Click was inside popup, keeping popup open")},exists:function(){return g.inline?0!==z.size():z.parent(w).size()},remove:function(){c.debug("Removing popup"),z.remove()},save:{conditions:function(){c.cache={title:v.attr("title")},c.cache.title&&v.removeAttr("title"),c.verbose("Saving original attributes",c.cache.title)}},restore:{conditions:function(){return c.cache&&c.cache.title&&v.attr("title",c.cache.title),c.verbose("Restoring original attributes",c.cache.title),!0}},animate:{show:function(b){b=b||function(){},v.addClass(p.visible),g.transition&&a.fn.transition!==d&&v.transition("is supported")?z.transition(g.transition+" in",g.duration,function(){c.bind.close(),a.proxy(b,C)()}):z.stop().fadeIn(g.duration,g.easing,function(){c.bind.close(),a.proxy(b,C)()}),a.proxy(g.onShow,C)()},hide:function(b){b=b||function(){},c.debug("Hiding pop-up"),g.transition&&a.fn.transition!==d&&v.transition("is supported")?z.transition(g.transition+" out",g.duration,function(){c.reset(),b()}):z.stop().fadeOut(g.duration,g.easing,function(){c.reset(),b()}),a.proxy(g.onHide,C)()}},get:{startEvent:function(){return"hover"==g.on?"mouseenter":"focus"==g.on?"focus":!1},endEvent:function(){return"h
|