var ProcessWireAdminTheme={init:function(){var $button=$("#head_button > button.pw-dropdown-toggle").hide();this.setupCloneButton();ProcessWireAdmin.init();this.setupSearch();this.setupMobile();var $body=$("body");if($body.hasClass("hasWireTabs")&&$("ul.WireTabs").length==0)$body.removeClass("hasWireTabs");$("#content").removeClass("pw-fouc-fix");$body.removeClass("pw-init").addClass("pw-ready");if($button.length>0)$button.show()},setupCloneButton:function(){if($("body").is(".modal"))return;var $buttons=$("button.pw-head-button, button.head_button_clone");if($buttons.length==0)return;var $head=$("#head_button");if($head.length==0)$head=$("
").prependTo("#breadcrumbs .pw-container");$buttons.each(function(){var $t=$(this);var $a=$t.parent("a");var $button;if($a.length>0){$button=$t.parent("a").clone(true);$head.prepend($button)}else if($t.hasClass("pw-head-button")||$t.hasClass("head_button_clone")){$button=$t.clone(true);$button.attr("data-from_id",$t.attr("id")).attr("id",$t.attr("id")+"_copy");$button.on("click",function(){$("#"+$(this).attr("data-from_id")).trigger("click");return false});$head.prepend($button)}});$head.show()},setupSearch:function(){$.widget("custom.adminsearchautocomplete",$.ui.autocomplete,{_renderMenu:function(ul,items){var that=this;var currentType="";ul.attr("id","ProcessPageSearchAutocomplete");$.each(items,function(index,item){if(item.type!=currentType){$("
  • "+item.type+"
  • ").addClass("ui-widget-header").appendTo(ul);currentType=item.type}that._renderItemData(ul,item)})},_renderItem:function(ul,item){if(item.label==item.template)item.template="";var $label=$("").text(item.label).css("margin-right","3px");if(item.unpublished)$label.css("text-decoration","line-through");if(item.hidden)$label.addClass("ui-priority-secondary");if(typeof item.icon!="undefined"&&item.icon.length){var $icon=$("").addClass("fa fa-fw fa-"+item.icon).css("margin-right","2px");$label.prepend($icon)}var $a=$("").attr("href",item.edit_url).attr("title",item.tip).append($label).append($("").text(item.template));if(item.edit_url=="#"||!item.edit_url.length)$a.removeAttr("href");return $("
  • ").append($a).appendTo(ul)}});var $input=$("#ProcessPageSearchQuery");var $status=$("#ProcessPageSearchStatus");$input.adminsearchautocomplete({minLength:2,position:{my:"right top",at:"right bottom"},search:function(event,ui){$status.html("")},open:function(event,ui){$("#topnav").hide()},close:function(event,ui){$("#topnav").show()},source:function(request,response){var url=$input.parents("form").attr("action")+"?q="+request.term;$.getJSON(url,function(data){var len=data.matches.length;if(len50){if(!$body.hasClass("collapse-topnav")){$body.addClass("collapse-topnav");collapsedTopnavAtBodyWidth=$body.width()}}else if(collapsedTopnavAtBodyWidth>0){var width=$body.width();if($body.hasClass("collapse-topnav")&&width>collapsedTopnavAtBodyWidth){$body.removeClass("collapse-topnav");collapsedTopnavAtBodyWidth=0}}$topnav.children(".collapse-topnav-menu").children("a").on("click",function(){if($(this).is(".hover")){$(this).trigger("mouseleave")}else{$(this).trigger("mouseenter")}return false});var $wiretabs=$(".WireTabs");if($wiretabs.length<1)return;$wiretabs.each(function(){var $tabs=$(this);var height=$tabs.height();if(height>65){if(!$body.hasClass("collapse-wiretabs")){$body.addClass("collapse-wiretabs");collapsedTabsAtBodyWidth=$body.width()}}else if(collapsedTabsAtBodyWidth>0){var width=$body.width();if($body.hasClass("collapse-wiretabs")&&width>collapsedTabsAtBodyWidth){$body.removeClass("collapse-wiretabs");collapsedTabsAtBodyWidth=0}}})};windowResize();$(window).on("resize",windowResize)}};$(document).ready(function(){ProcessWireAdminTheme.init();$("a.notice-remove","#notices").on("click",function(){$("#notices").slideUp("fast",function(){$(this).remove()});return false})});