1 line
8.7 KiB
JavaScript
1 line
8.7 KiB
JavaScript
|
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=$("<li class='add'><a href='"+l.url+l.add.url+"'><i class='fa fa-fw fa-"+l.add.icon+"'></i>"+l.add.label+"</a></li>");f.append(m)}$.each(l.list,function(r){var p="";var o=this.url.indexOf("/")===0?this.url:l.url+this.url;var q=$("<li><a style='white-space:nowrap' href='"+o+"'>"+p+this.label+"</a></li>");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=$("<div id='head_button'></div>").prependTo("#headline").show();b.each(function(){var e=$(this);var d=e.parent("a");var c;if(d.leng
|