/*
 =======================================================================*\
|| ###################################################################### ||
|| # vBulletin 6.2.3
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2026 MH Sub I, LLC dba vBulletin. All Rights Reserved.  # ||
|| # This file may not be redistributed in whole or significant part.   # ||
|| # ----------------- VBULLETIN IS NOT FREE SOFTWARE ----------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html   # ||
|| ###################################################################### ||
\*========================================================================*/
(function(d){function h(){var a=document.getElementById("filterkey").value,b=document.getElementById("filterop_"+a),c=!1;b&&(c=b.value);"default"!=a&&l(a,c,1)}function l(a,b,c){var f="&"+a;b&&(f+="["+b+"]");0<c?(b=document.getElementById("filtervalue_"+a).value,f+="="+b):f="";if("default"!=e){document.getElementById("removefilter_page_").setAttribute("data-value",1);var e=document.getElementsByName("filter");b=e.length;filterString="";for(c=0;c<b;c++)e[c].getAttribute("data-key")!=a?(filterString+=
"&"+e[c].getAttribute("data-key"),0<e[c].getAttribute("data-useopkey")&&(filterString+="["+e[c].getAttribute("data-opkey")+"]"),filterString+="="+e[c].getAttribute("data-value")):(filterString+=f,f="");filterString+=f;vBRedirect("admincp/cms.php?do=contentlist"+filterString)}}function m(a){var b=document.getElementsByName(a+"list"),c=b.length;if(subjectSelect=document.getElementById("filtervalue_"+a))for(subjectSelect.remove(0),i=0;i<c;i++)subjectItem=document.createElement("option"),subjectItem.text=
b[i].value,subjectItem.value=b[i].getAttribute("data-id"),subjectSelect.add(subjectItem)}function n(){var a=document.getElementById("cpform"),b=document.createElement("input");b.type="hidden";b.name="action_override";b.value="savedisplayorder";a.appendChild(b);document.getElementById("cpform").submit()}function p(a){if("addcategory"==a)var b="addcategory";else b=document.getElementById("singlecategory_"+a),b=b.options[b.selectedIndex].value;var c="admincp/cms.php?";switch(b){case "editcategory":c+=
"do=editcategory&nodeid="+a+"&type=category&gobackto=categorylist";break;case "addchildcategory":c+="do=addcategory&parentid="+a;break;case "addcategory":c+="do=addcategory";break;case "deletecategory":c+="do=delete&nodeid="+a+"&type=category&gobackto=categorylist";break;default:return}vBRedirect(c)}d(()=>{m("author");m("tag");d(".js-cms-update-filter").off("change").on("change",a=>{var b=document.getElementById("filterkey").value,c="filtervalue_"+b,f=document.getElementsByName("filtervalue");a=f.length;
for(var e=0;e<a;e++)f[e].id!=c?d(f[e]).addClass("hide"):d(f[e]).removeClass("hide");b="filterop_"+b;c=document.getElementsByName("filterop");a=c.length;for(e=0;e<a;e++)c[e].id!=b?d(c[e]).addClass("hide"):d(c[e]).removeClass("hide")});d(".js-cms-apply-filter").off("click").on("click",a=>{a=d(a.currentTarget);l(a.data("filterKey"),a.data("filterOp"),a.data("filterDir"))});d(".js-cms-gofilter--keyboard").off("keydown").on("keydown",a=>{if(13==a.keyCode)return h(),!1});d(".js-cms-gofilter").off("change").on("change",
a=>h());d(".js-cms-gofilter--click").off("click").on("click",a=>h());d(".js-cms-savedisplayorder").off("click").on("click",a=>n());d(".js-cms-savedisplayorder--keyboard").off("keydown").on("keydown",a=>{if(13==a.keyCode)return n(),!1});d(".js-cms-showtags").off("click").on("click",a=>{var b=d(a.currentTarget);a=b.data("id");b=b.data("dir");if(0==b){for(var c=document.getElementsByName("filter"),f=c.length,e="",k="&tag="+a,g=0;g<f;g++)"removefilter_tag_"!=c[g].id?(e+="&"+c[g].getAttribute("data-key"),
0<c[g].getAttribute("data-useopkey")&&(e+="["+c[g].getAttribute("data-opkey")+"]"),e+="="+c[g].getAttribute("data-value")):(e+=k,k="");vBRedirect("admincp/cms.php?do=contentlist"+(e+k))}c=document.getElementById("tagcount_"+a);a=document.getElementById("tag_"+a);0<b&&(d(c).addClass("hide"),d(a).removeClass("hide"));0>b&&(d(c).removeClass("hide"),d(a).addClass("hide"));return!1});d(".js-cms-contentaction").off("click").on("click",a=>{a=d(a.currentTarget);var b=a.data("nodeid");switch(a.data("action")){case "editcontent":url=
document.getElementById("edit_content_"+b).getAttribute("data-url");separator=-1!==url.indexOf("?")?"&":"?";-1==url.indexOf("edit=1")&&(url=url+separator+"edit=1");window.open(url);break;case "deletecontent":gobackto=window.location.href,gobackto=gobackto.replace(/^.*?do=/i,""),gobackto=encodeURIComponent(gobackto),vBRedirect("admincp/cms.php?do=delete&nodeid="+b+"&type=article&uriencoded=1&gobackto="+gobackto)}});d(".js-cms-categoryaction").off("click").on("click",a=>{a=d(a.currentTarget);return p(a.data("nodeid"))});
d(".js-cms-categoryaction--change").off("change").on("change",a=>{a=d(a.currentTarget);return p(a.data("nodeid"))});d(".js-cms-select-node").off("change").on("change",a=>{var b=d(a.currentTarget).data("nodeid");b="select_"+b;a=document.getElementById(b).checked;var c=document.getElementsByTagName("input"),f=c.length;if("select_all"==b)for(b=0;b<f;b++)"select_all"!=c[b].id&&"checkbox"==c[b].type&&"select_"==c[b].id.substring(0,7)&&(c[b].checked=a);else{checkallBox=document.getElementById("select_all");
checkallBoxChecked=checkallBox.checked;allchecked=a;anychecked=!1;for(b=0;b<f;b++)"select_all"!=c[b].id&&"checkbox"==c[b].type&&"select_"==c[b].id.substring(0,7)&&(c[b].checked?anychecked||(anychecked=!0):allchecked=!1);allchecked?checkallBox.checked=!0:anychecked&&checkallBoxChecked?checkallBox.indeterminate=!0:(checkallBox.indeterminate=!1,checkallBox.checked=!1)}});d("#filtervalue_date").datepicker({dateFormat:"yy-mm-dd"});d(".js-cms-paginationhell").off("change").on("change",a=>{a=d(a.currentTarget);
let b=parseInt(document.getElementById("contentperpage").value,10),c=a.data("page"),f=a.data("perpage");a=("admincp/cms.php?do="+a.data("filterQueryStr")).replace("&page="+c+"&perpage="+f,"&page="+Math.ceil((f*(c-1)+1)/b)+"&perpage="+b);vBRedirect(a)})})})(jQuery);
