/* This includes 4 files: bootstrap/usernames.js, bootstrap/popover.js, bootstrap/userfields.js, bootstrap/formfields.js */ var originalLeave=jQuery.fn.popover.Constructor.prototype.leave;function form_error_field_popover(e){var o=jQuery(e);if(o.hasClass("popovererror"))return!0;var r=jQuery('span.field_error[rel="'+o.attr("name")+'"]').html();if(""==r)return!0;var i=o.prop("tagName");if(o.popover("destroy"),"INPUT"==o.prop("tagName")&&o.hasClass("form_date_input"))try{$.datepicker._updateDatepicker($.datepicker._getInst(e))}catch(e){console.error("Unable to generate datepicker content using private methods _updateDatepicker() and _getInst()")}r&&o.popover({trigger:"manual",placement:function(){var e;if("INPUT"==o.prop("tagName")&&o.hasClass("form_date_input")){var r=jQuery(window),t=jQuery("#ui-datepicker-div");if(t.is(":visible"))e=t.offset().top>o.offset().top;else e=r.height()-(o.offset().top-r.scrollTop()+o.outerHeight())>=t.outerHeight()}return"SELECT"==i||"TEXTAREA"==i||"INPUT"==i&&e?"top":"bottom"},html:!0,content:''+r+""}),o.on("show.bs.popover",function(){o.addClass("popovererror")})}jQuery.fn.popover.Constructor.prototype.leave=function(e){var r,t,o=e instanceof this.constructor?e:jQuery(e.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);originalLeave.call(this,e),e.currentTarget&&(r=jQuery(e.currentTarget).siblings(".popover"),t=o.timeout,r.one("mouseenter",function(){clearTimeout(t),r.one("mouseleave",function(){jQuery.fn.popover.Constructor.prototype.leave.call(o,o)})}))},jQuery(document).ready(function(){var u=1;jQuery(document).on("mouseover","[rel^=bubbletip_]",function(){var p=jQuery(this),e="",r="";if(p.attr("rel").match("bubbletip_user_")){var t=p.attr("rel").replace(/bubbletip_user_(\d+).*/g,"$1");e="popover_cache_user_"+t,r="&userid="+t}else if(p.attr("rel").match("bubbletip_comment_")){var o=p.attr("rel").replace(/bubbletip_comment_(\d+).*/,"$1");e="popover_cache_comment_"+o,r="&commentid="+o}if(""!=e){p.attr("id","popoverlink"+u);var s={trigger:"hover",container:"body",placement:"top",html:!0,delay:{hide:400},template:'
'};if(0==jQuery("#"+e).length){jQuery("body").append('');var n=jQuery("#"+e);jQuery.ajax({type:"POST",url:htsrv_url+"anon_async.php",data:"action=get_user_bubbletip&blog="+blog_id+r,success:function(e){if(ajax_response_is_correct(e)){e=ajax_debug_clear(e),n.html(e);var r=n.find("img"),t=r.attr("height")+"px",o=r.attr("width")+"px";r.css("height",t),r.css("width",o);var i=!0;p.hasClass("hide_popover")&&(i=!1,p.removeClass("hide_popover"));var a=n.clone(!0);a.show(),s.content=a,p.popover(s),i&&p.popover("show"),p.attr("rel",p.attr("rel").replace(/bubbletip_(user_|comment_)[\d\s]+/g,""))}}})}else if(""!=jQuery("#"+e).html()){var i=p.attr("title");p.removeAttr("title");var a=jQuery("#"+e).clone(!0);a.show(),s.content=a,p.popover(s),p.popover("show"),p.attr("title",i),p.attr("rel",p.attr("rel").replace(/bubbletip_(user_|comment_)[\d\s]+/g,""))}u++}}),jQuery(document).on("mouseleave","[rel^=bubbletip_]",function(){jQuery(this).addClass("hide_popover")}),jQuery(document).on("mouseover",".popover",function(){jQuery(this).addClass("mouseover")}),jQuery(document).on("mouseleave",".popover",function(){jQuery(this).removeClass("mouseover"),jQuery(this).data("bs.popover").$element.popover("hide")}),jQuery(document).on("hide.bs.popover",function(e){jQuery(e.target).data("bs.popover").$tip.hasClass("mouseover")&&e.preventDefault()})}),jQuery(document).on("mouseover","[data-popover]",function(){if(jQuery(this).data("tooltip-init"))return!0;jQuery(this).attr("title",""),jQuery(this).find("span").removeAttr("title");var e=jQuery(this).data("popover"),r=jQuery(this).data("placement");"right"==(r=r||"right")&&jQuery("body").width()-jQuery(this).position().left<220?r="left":"top"==r&&jQuery("body").height()-jQuery(this).position().top<220&&(r="bottom"),jQuery(this).popover({trigger:"hover",placement:r,html:!0,content:e,template:'
'}),jQuery(this).popover("show"),jQuery(this).data("tooltip-init",1)}),jQuery(document).ready(function(){jQuery(document).on("focus","[rel^=ufdf_]",function(){var t=jQuery(this),e="";if(!t.hasClass("popoverfield")){var r=t.attr("rel").replace("ufdf_","");e="popover_cache_field_"+r}if(""!=e){var o={container:"body",trigger:"focus",placement:function(e,r){var t=jQuery(r),o=t.offset(),i=jQuery(window).width()-o.left-t.width();return i<290&&o.left<240?"bottom":i<290?"left":"right"},html:!0,template:'
'};if(0==jQuery("#"+e).length){jQuery("body").append('');var i=jQuery("#"+e);jQuery.ajax({type:"POST",url:htsrv_url+"anon_async.php",data:"action=get_field_bubbletip&field_ID="+r+"&b2evo_icons_type=fontawesome",success:function(e){if(ajax_response_is_correct(e)){e=ajax_debug_clear(e),i.html(e);var r=!0;t.hasClass("popoverfield")&&(r=!1,t.removeClass("popoverfield")),o.content=i.html(),t.popover(o),r&&t.popover("show")}t.addClass("popoverfield")}})}else""!=jQuery("#"+e).html()&&(o.content=jQuery("#"+e).html(),t.popover(o),t.popover("show"),t.addClass("popoverfield"));0}}),jQuery(document).on("blur","[rel^=ufdf_]",function(){jQuery(this).addClass("popoverfield")}),jQuery(document).on("click",".popover-userfield",function(){jQuery(this).next().find('span[class*="icon"]:first').click()})});var form_error_fields_selector="input.field_error[type=text], input.field_error[type=radio], span.checkbox_error input[type=checkbox], select.field_error, textarea.field_error, input.field_error[type=file]";jQuery(document).on("mouseover focus",form_error_fields_selector,function(){form_error_field_popover(this),0==jQuery(this).next("div.popover:visible").length&&jQuery(this).popover("show")}).on("mouseout mouseleave blur",form_error_fields_selector,function(){jQuery(this).is(":focus")||jQuery(this).popover("hide")});