var ProcessWireAdminTheme={init:function(){this.setupCloneButton();ProcessWireAdmin.init();this.setupSearch();this.setupDropdowns();this.setupSidebarNav();this.setupSideBarState();this.setupSideBarToggle();var b=$("body");var a=$("html");if(b.hasClass("hasWireTabs")&&$("ul.WireTabs").length==0){b.removeClass("hasWireTabs")}$("#content").removeClass("pw-fouc-fix");b.removeClass("pw-init").addClass("pw-ready");a.removeClass("pw-init").addClass("pw-ready");$("a.notice-remove","#notices").click(function(){$("#notices").slideUp("fast",function(){$(this).remove();return false})})},setupSidebarNav:function(){var a=window.location.toString();$(document).mouseup(function(g){var f=$("ul.quicklinks");if(!f.is(g.target)&&f.has(g.target).length===0){f.hide();$(".quicklink-open").removeClass("active");$("#main-nav .current").removeClass("no-arrow")}});$(document).keydown(function(i){var g=i.target.tagName.toLowerCase();var f=i.target.className.split(" ")[0];var h;if(g=="input"||g=="textarea"||f=="InputfieldCKEditorInline"){return}switch(i.which){case 37:h="open";break;case 39:h="closed";break;default:return}ProcessWireAdminTheme.setupSideBarState(true,h);i.preventDefault()});function e(){$("#main-nav > li > a.open:not(.hover-temp):not(.just-clicked)").each(function(){var g=$(this);var f=g.next("ul:visible");if(f.length>0){if(f.find(".quicklinks-open").length>0){f.find(".quicklink-close").click()}}})}var c=null,b=0;$("#main-nav a.parent").dblclick(function(f){f.preventDefault()}).click(function(){var f=$(this);f.addClass("just-clicked");b++;if(b===1){c=setTimeout(function(){e();f.toggleClass("open").next("ul").slideToggle(200,function(){f.removeClass("just-clicked")});b=0},200)}else{clearTimeout(c);b=0;window.location.href=f.attr("href");return true}return false});var d=null;$(".quicklink-open").click(function(j){e();var k=$(this);k.parent().addClass("quicklinks-open");k.toggleClass("active").parent().next("ul.quicklinks").toggle();k.parent().parent().siblings().find("ul.quicklinks").hide();k.parent().parent().siblings().find(".quicklink-open").removeClass("active").parent("a").removeClass("quicklinks-open");k.effect("pulsate",100);j.stopPropagation();$("#main-nav .current:not(.open)").addClass("no-arrow");var f=$(this).parent().next("ul.quicklinks");var i=f.attr("data-json");if(i.length>0&&!f.hasClass("json-loaded")){f.addClass("json-loaded");var h=f.find(".quicklinks-spinner");var g=h.attr("class");h.removeClass(g).addClass("fa fa-fw fa-spin fa-spinner");$.getJSON(i,function(l){if(l.add){var m=$("
  • "+l.add.label+"
  • ");f.append(m)}$.each(l.list,function(r){var p="";var o=this.url.indexOf("/")===0?this.url:l.url+this.url;var q=$("
  • "+p+this.label+"
  • ");if(typeof this.className!="undefined"&&this.className&&this.className.length){q.addClass(this.className)}f.append(q)});h.removeClass("fa-spin fa-spinner").addClass(g);if(l.icon.length>0){h.removeClass("fa-bolt").addClass("fa-"+l.icon)}})}return false}).mouseover(function(){var f=$(this);if(f.parent().hasClass("quicklinks-open")){return}f.addClass("hover-temp");clearTimeout(d);d=setTimeout(function(){if(f.parent().hasClass("quicklinks-open")){return}if(f.hasClass("hover-temp")){f.click()}},500)}).mouseout(function(){$(this).removeClass("hover-temp")});$(".quicklink-close").click(function(){$(this).parent().removeClass("quicklinks-open");$(this).closest("ul.quicklinks").hide().prev("a").removeClass("quicklinks-open");$(".quicklink-open").removeClass("active");$("#main-nav .current").removeClass("no-arrow");return false});$("#main-nav .parent").each(function(){var f=$(this).attr("href");if(a.match(f)){$(this).next("ul").show();$(this).addClass("open")}})},setupCloneButton:function(){if($("body").is(".modal")){return}var b=$("button.pw-head-button, button.head_button_clone");if(b.length==0||$.browser.msie){return}var a=$("
    ").prependTo("#headline").show();b.each(function(){var e=$(this);var d=e.parent("a");var c;if(d.length){c=e.parent("a").clone();a.append(c)}else{if(e.hasClass("head_button_clone")||e.hasClass("pw-head-button")){c=e.clone();c.attr("data-from_id",e.attr("id")).attr("id",e.attr("id")+"_copy");c.click(function(){$("#"+$(this).attr("data-from_id")).click();return false});a.prepend(c)}}})},setupSearch:function(){$.widget("custom.adminsearchautocomplete",$.ui.autocomplete,{_renderMenu:function(f,d){var g=this;var e="";f.attr("id","ProcessPageSearchAutocomplete");$.each(d,function(h,i){if(i.type!=e){$("
  • "+i.type+"
  • ").addClass("ui-widget-header").appendTo(f);e=i.type}g._renderItemData(f,i)})},_renderItem:function(f,g){if(g.label==g.template){g.template=""}var d=$("").text(g.label).css("margin-right","3px");if(g.unpublished){d.css("text-decoration","line-through")}if(g.hidden){d.css("opacity",0.7)}if(g.icon.length){var e=$("").addClass("fa fa-fw fa-"+g.icon).css("margin-right","2px");d.prepend(e)}var h=$("").attr("href",g.edit_url).attr("title",g.tip).append(d).append($("").text(g.template));if(g.edit_url=="#"||!g.edit_url.length){h.removeAttr("href")}return $("
  • ").append(h).appendTo(f)}});var c=$("#ProcessPageSearchQuery");var a=$("#ProcessPageSearchStatus");c.adminsearchautocomplete({minLength:2,position:{my:"right top",at:"right bottom"},search:function(d,e){a.html("")},source:function(f,d){var e=c.parents("form").attr("action")+"?q="+f.term;$.getJSON(e,function(h){var g=h.matches.length;if(g a").on("click",function(a){$(this).next("ul").toggleClass("open");$(this).parent().siblings().find("ul.open").removeClass("open");return false});$("#masthead li.pw-dropdown > ul li a").on("click",function(a){a.stopPropagation()});$(document).on("click",function(){$("#masthead li.pw-dropdown ul").removeClass("open")})},setupSideBarToggle:function(){$(".main-nav-toggle").on("click",function(){ProcessWireAdminTheme.setupSideBarState(true);return false})},setupSideBarState:function(j,c){if($("body").hasClass("id-23")||$("body").hasClass("modal")){return false}var e="pw_sidebar_state";var c=c||localStorage.getItem(e);var i=$(".main-nav-toggle");var a=$("#sidebar");var h=$("#main");var d=$("#masthead");var g=$("#branding");var f=$("#NotificationBug");var b=i.add(a).add(h).add(d).add(g).add(f);if(c===null&&$(window).width()>=690){localStorage.setItem(e,"open")}if(!j&&$(window).width()<690){localStorage.setItem(e,"closed");c="closed"}if(j==true){if(c=="open"){localStorage.setItem(e,"closed");b.addClass("closed")}else{if(c=="closed"){localStorage.setItem(e,"open");b.removeClass("closed")}}a.removeClass("hide");g.removeClass("hide");h.removeClass("full");d.removeClass("full");i.removeClass("full")}else{if(c=="closed"){b.addClass("closed");a.addClass("hide");g.addClass("hide");h.addClass("full");d.addClass("full");i.addClass("full")}}},browserCheck:function(){if($.browser.msie&&$.browser.version<8){$("#content .pw-container").html("

    ProcessWire does not support IE7 and below at this time. Please try again with a newer browser.

    ").show()}}};$(document).ready(function(){ProcessWireAdminTheme.init()});