/*
* XenForo inline_mod.min.js
* Copyright 2010-2019 XenForo Ltd.
* Released under the XenForo License Agreement: http://xenforo.com/license-agreement
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(b,g,f){b instanceof String&&(b=String(b));for(var h=b.length,a=0;a<h;a++){var c=b[a];if(g.call(f,c,a,b))return{i:a,v:c}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,g,f){b!=Array.prototype&&b!=Object.prototype&&(b[g]=f.value)};
$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(b,g,f,h){if(g){f=$jscomp.global;b=b.split(".");for(h=0;h<b.length-1;h++){var a=b[h];a in f||(f[a]={});f=f[a]}b=b[b.length-1];h=f[b];g=g(h);g!=h&&null!=g&&$jscomp.defineProperty(f,b,{configurable:!0,writable:!0,value:g})}};
$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(b,f){return $jscomp.findInternal(this,b,f).v}},"es6","es3");
!function(b,g,f,h){XenForo.InlineModForm=function(a){this.__construct(a)};XenForo.InlineModForm.prototype={__construct:function(a){a.is("form")&&a[0].reset();this.$form=a;this.$form.data("InlineModForm",this);this.$checkAll=this.$form.find("#ModerationCheck").click(b.context(this,"checkAll"));var c=b(this.$form.data("controls")),d=c.closest(".InlineMod");c.find(".SelectionCount").click(b.context(this,"nonCheckboxShowOverlay"));var e=b(".SelectionCountContainer");b("#InlineModOverlay").length||(c.length&&
c.show().appendTo("body").wrap('<form id="InlineModOverlay" />'),e.length&&c.find(".SelectionCount").clone(!0).appendTo(e).attr("href","#").addClass("cloned"),this.$totals=c.length?b(".InlineModCheckedTotal"):b([]),d.hasClass("Hide")&&d.remove(),this.cookieName=!1,this.selectedIds=[],this.overlay=this.lastCheck=null,a.data("cookiename")&&(this.cookieName="inlinemod_"+a.data("cookiename"),this.updateSelectedIdsFromCookie()),b(f).one("XenForoActivationComplete",b.context(this,"setState")))},updateSelectedIdsFromCookie:function(){if(!this.cookieName)return[];
var a=this.selectedIds;this.selectedIds=(this.cookieValue=b.getCookie(this.cookieName))?this.cookieValue.split(","):[];return{original:a,selected:this.selectedIds,isDifferent:a!==this.selectedIds}},setState:function(){var a=this.selectedIds.length;this.$totals.closest(".cloned")[a?"addClass":"removeClass"]("itemsChecked");this.$totals.text(a)},recalculateSelected:function(){var a=this.selectedIds;this.$form.find("input:checkbox.InlineModCheck").each(function(){var c=b(this),d=c.data("XenForo.InlineModItem"),
e=c.prop("checked");d&&(a&&0<=b.inArray(c.val(),a)?e||(c.prop("checked",!0),d.setStyle()):e&&(c.prop("checked",!1),d.setStyle()))})},setSelectedIdState:function(a,c){this.updateSelectedIdsFromCookie().isDifferent&&setTimeout(b.context(this,"recalculateSelected"),0);var d=b.inArray(a,this.selectedIds);if(c){if(0<=d)return;this.selectedIds.push(a);this.selectedIds.sort(function(a,b){return a-b})}else{if(0>d)return;this.selectedIds.splice(d,1)}this.setState();this.cookieName&&(this.selectedIds.length?
b.setCookie(this.cookieName,this.selectedIds.join(",")):b.deleteCookie(this.cookieName))},checkAll:function(a){this.$form.find("input:checkbox.InlineModCheck").prop("checked",a.target.checked).trigger("change");a.target.checked||this.overlay.close();a.stopImmediatePropagation()},clickNextPrev:function(a){var c=this.$form.find("input:checkbox.InlineModCheck"),d=this.lastCheck,e=null;c.each(function(c,f){if(f==d)return e=b(a.target).hasClass("ClickPrev")?c-1:c+1,!1});if(null===e||e>=c.length)e=0;c.eq(e).get(0).focus();
b(this.lastCheck).length&&b(XenForo.getPageScrollTagName()).animate({scrollTop:c.eq(e).offset().top-b(this.lastCheck).offset().top+b(XenForo.getPageScrollTagName()).scrollTop()},XenForo.speed.normal);this.positionOverlay(c.eq(e).get(0))},createOverlay:function(){var a=b("#InlineModOverlay"),c=a.find("#ModerationSelect");a.children().show();a.children("#InlineModControls").css("display","block");a.overlay({closeOnClick:!1,fixed:!1,close:".OverlayCloser"});c.change(b.context(this,"chooseAction"));a.find("input:submit").click(b.context(this,
"chooseAction"));a.find(".ClickNext, .ClickPrev").click(b.context(this,"clickNextPrev"));return this.overlay=a.data("overlay")},positionOverlay:function(a){if(a.checked||this.$form.find("input:checkbox:checked.InlineModCheck").length){console.info("Position overlay next to %o",a);this.overlay||this.createOverlay();var c=this.overlay,d=b(a).offset(),e=d.left;d=d.top-15;e=XenForo.isRTL()?e-(c.getOverlay().outerWidth()+5):e+17;if(c.getOverlay().outerWidth()+e>b(g).width()||0>e)e=0,d+=34;c.isOpened()?
c.getOverlay().animate({left:e,top:d},this.lastCheck&&!XenForo.isTouchBrowser()?XenForo.speed.normal:0,"easeOutBack"):(c.getConf().left=e-b(XenForo.getPageScrollTagName()).scrollLeft(),c.getConf().top=d-b(XenForo.getPageScrollTagName()).scrollTop(),c.load())}else this.overlay&&this.overlay.isOpened()&&this.overlay.close();this.lastCheck=a},nonCheckboxShowOverlay:function(a){a.preventDefault();if(!b(a.target).parents("#InlineModOverlay").length){this.overlay||this.createOverlay();this.overlay.load();
a=b(a.target).coords();var c=this.overlay.getOverlay().coords();c=XenForo.isRTL()?a.left:Math.max(0,a.left+a.width-c.width);if(this.overlay.getOverlay().outerWidth()+c>b(g).width()||0>c)c=0;this.overlay.getOverlay().css({left:c,top:a.top+a.height+5});delete this.lastCheck}},chooseAction:function(a){a.preventDefault();var c=b(a.target);c=c.is(":submit")&&c.attr("name")?c.attr("name"):b("#ModerationSelect").val();if(""==c)return this.overlay.close(),!1;if(this.running)return!1;var d=c+"PreAction";if("function"==
typeof this[d])this[d](a);else this.execAction(c)},resetActionMenu:function(){this.overlay.getOverlay().get(0).reset()},execAction:function(a){this.running=!0;XenForo.ajax(this.$form.attr("action"),this.$form.serialize()+"&a="+a,b.context(function(b,c){this.running=!1;this.resetActionMenu();if(XenForo.hasResponseError(b))return!1;if(XenForo.hasTemplateHtml(b)){var d={};d.title=b.title||b.h1;d.noCache=!0;new XenForo.ExtLoader(b,function(){console.info("show overlay");XenForo.createOverlay("",b.templateHtml,
d).load()})}else if(b._redirectTarget){console.log("Inline moderation, %s complete.",a);var e=a+"PostAction";if("function"==typeof this[e])this[e](b,c);else XenForo.redirect(b._redirectTarget)}},this));var c=a+"MidAction";if("function"==typeof this[c])this[c](a)},closeOverlayPreAction:function(a){this.resetActionMenu();this.overlay.close()},deselectPreAction:function(a){this.$form.find("input:checkbox.InlineModCheck:checked").prop("checked",!1).trigger("change");this.selectedIds=[];this.setState();
this.cookieName&&b.deleteCookie(this.cookieName);this.$checkAll.prop("checked",!1);this.resetActionMenu();this.overlay.close()}};XenForo.InlineModItem=function(a){this.__construct(a)};XenForo.InlineModItem.prototype={__construct:function(a){this.$form=a.closest("form");this.$ctrl=a;a.attr("title")&&a.attr("title",XenForo.htmlspecialchars(a.attr("title")));!XenForo.isTouchBrowser()&&a.attr("title")&&this.$ctrl.tooltip(XenForo.configureTooltipRtl({effect:"fade",fadeInSpeed:XenForo.speed.xfast,offset:[-10,
-20],predelay:b.browser.msie?0:100,position:"top right",tipClass:"xenTooltip inlineModCheckTip",onBeforeShow:b.context(this,"beforeTooltip")}));this.arrowAppended=!1;this.$target=b(a.data("target"));if(this.$form.data("InlineModForm")){var c=this.$form.data("InlineModForm");c.selectedIds.length&&0<=b.inArray(a.val(),c.selectedIds)&&a.prop("checked",!0)}this.$ctrl.bind({change:b.context(this,"setState"),click:b.context(this,"positionOverlay")});this.setStyle()},setState:function(a){this.setStyle();
(a=this.$form.data("InlineModForm"))&&a.setSelectedIdState(this.$ctrl.val(),this.$ctrl.prop("checked"))},setStyle:function(){this.$ctrl.is(":checked")?this.$target.addClass("InlineModChecked"):this.$target.removeClass("InlineModChecked")},positionOverlay:function(a){if(this.$ctrl.data("target")){var b=this.$form.data("InlineModForm");b&&(this.$ctrl.data("tooltip")&&this.$ctrl.data("tooltip").hide(),b.positionOverlay(a.target))}},beforeTooltip:function(a){if(a.target.checked||this.$form.find("input:checkbox:checked.InlineModCheck").length)return!1;
this.arrowAppended||(this.$ctrl.data("tooltip").getTip().append('<span class="arrow" />'),this.arrowAppended=!0)}};XenForo.register("form.InlineModForm","XenForo.InlineModForm");XenForo.register("input:checkbox.InlineModCheck","XenForo.InlineModItem")}(jQuery,this,document);