(function(){var moduleFactory=function($){var module=this;$.require().stylesheet("ajaxPopover/default").done(function(){var exports=function(){$.fn.ajaxPopover=function(popoverOptions){var elements=this,defaultOptions={trigger:"click",beforeAjax:'<div class="ajaxPopover loading"></div>'},options=$.extend({},defaultOptions,popoverOptions);return $.each(elements,function(i,element){element=$(element);if(typeof popoverOptions=="string"){popoverOptions==="toggle"&&(element.data("popover")===undefined?popoverOptions="show":popoverOptions=element.data("popover").$tip.hasClass("in")?"hide":"show"),element.popover(popoverOptions).trigger("ajaxPopover"+$.String.capitalize(popoverOptions));return}var originalContent=options.content||element.data("content")||"";options.content=options.beforeAjax,options.ajax===undefined&&element.data("ajax")!==undefined&&(options.ajax=function(){return eval(element.data("ajax"))});if(options.ajax!==undefined){var trigger=options.trigger==="manual"?"ajaxPopoverShow":options.trigger;element.one(trigger,function(){var e=options.ajax;$.isFunction(e)&&(e=options.ajax()),typeof e=="string"&&(options.content=e,rePopover(element,options)),$.isDeferred(e)&&e.done(function(e){options.content=e,rePopover(element,options)}).fail(function(e){options.content=typeof e!="string"||e===""?'<div class="ajaxPopover error">Failed loading.</div>':e,rePopover(element,options)})})}element.popover(options)}),elements};var rePopover=function(e,t){$(e).popover("destroy").data("popover",null).popover(t).popover("show")}};exports(),module.resolveWith(exports)})};dispatch("ajaxPopover").containing(moduleFactory).to("Foundry/2.1 Modules")})();