"undefined"==typeof XWiki&&(XWiki={});
XWiki.Blog={initialize:function(){var b=$("blog_AddCategoryButton");b&&Event.observe(b,"click",XWiki.Blog.createBlogCategory.bindAsEventListener(b.form))},createBlogCategory:function(){var b=this.newCategoryName.value,e=encodeURI(b.replace(/'/g,"").replace(/"/g,"")),f=encodeURI(b),a=this.newCategoryParent.value,d=encodeURI(a.substring(0,a.indexOf("."))),h=encodeURI(a);new Ajax.Request("/xwiki/bin/save/Blog/__name__?ajax\x3d1\x26template\x3dBlog.CategoryTemplate\x26form_token\x3d1xvDXCpZXD6oBSk3QhPBpg".replace(/__name__/g,e)+
"\x26parent\x3d"+h+"\x26title\x3d"+f+"\x26Blog.CategoryClass_0_name\x3d"+f,{method:"get",onSuccess:XWiki.Blog.updateCategoryTree.bindAsEventListener(this,b,a,d),on1223:function(k){k.request.options.onSuccess(k)},on409:function(){alert("Target page already exists, please choose a different name")},on403:function(){alert("You are not allowed to create the target page")},on401:function(){alert("You have been logged out, please refresh and log in")},onFailure:function(){alert("blog.manageCategories.js.add.failed")}})},
updateCategoryTree:function(b,e,f,a){b=(b=$("blog_category_"+f))?b.up():$("blog_category_container");f=b.down("ul");f||(f=document.createElement("ul"),b.appendChild(f));var d=f.childElements(),h=!1,k="blog_category_"+a+"."+e,l=document.createElement("li"),g=document.createElement("label");g.id=k;l.appendChild(g);var c=document.createElement("input");c.type="checkbox";c.checked="checked";c.name="Blog.BlogPostClass_0_category";c.value=a+"."+e;g.appendChild(c);g.appendChild(document.createTextNode(" "+
e));g=document.createElement("option");g.id=k+"_option";g.value=a+"."+e;c=0;for(a=b;a&&a!=$("blog_category_container");)c++,a=a.up("li");g.appendChild(document.createTextNode("\x26nbsp;".unescapeHTML().times(2*c)+e));e=$("blog_category_selectBox");for(a=0;a<d.size();++a)if(d[a].down("label").id>k){f.insertBefore(l,d[a]);d=$(d[a].down("label").id+"_option");e.insertBefore(g,d);h=!0;break}if(!h){f.appendChild(l);a=b;for(var m;!m&&a;)m=a.next("li"),a=a.up("li");m?e.insertBefore(g,$(m.down("label").id+
"_option")):e.appendChild(g)}}};document.observe("xwiki:dom:loaded",XWiki.Blog.initialize);
require(["jquery"],function(b){b(document).ready(function(){var e={icon:'\x3cspan class\x3d"fa fa-unlock" aria-hidden\x3d"true"\x3e\x3c/span\x3e',comment:"Made entry visible",title:"This blog post is not visible to other users. Make it visible.",hiddenValue:"1",css:"blog-tool-show"},f={icon:'\x3cspan class\x3d"fa fa-lock" aria-hidden\x3d"true"\x3e\x3c/span\x3e',comment:"Hidden entry",title:"Hide this blog post from other users.",hiddenValue:"0",css:"blog-tool-hide"};b(".blog-tool-show,.blog-tool-hide").click(function(a){a.preventDefault();
var d=b(this),h=d.parents(".hentry");d.hide();var k=d.hasClass("blog-tool-hide")?"hide":"show",l="hide"==k?e:f,g=new XWiki.widgets.Notification("Changing the visibility","inprogress");b.ajax(d.attr("href")).done(function(){d.find("span.icon-manage").html(l.icon);var c=d.attr("href").replace(/&comment=(.*?)(&|$)/,"\x26comment\x3d"+encodeURIComponent(l.comment)+"$2");c=c.replace(/_hidden=./,"_hidden\x3d"+l.hiddenValue);d.attr("href",c);d.attr("title",l.title);d.attr("class",l.css);"hide"==k?(h.hasClass("single-article")||
h.addClass("hidden-article"),c=h.find("\x3ediv.warningmessage"),0<c.length?c.show():(c=b("\x3cdiv\x3e").addClass("box").addClass("warningmessage"),c.text("This blog post is hidden."),c.insertBefore(h.find(".entry-content")))):(h.removeClass("hidden-article"),h.find("\x3ediv.warningmessage").hide());new XWiki.widgets.Notification("The visibility of the blog entry has been successfully changed","done")}).fail(function(c,m,n){403==c.statusCode()?new XWiki.widgets.Notification("You are not allowed to create the target page",
"error"):401==c.statusCode()?new XWiki.widgets.Notification("You have been logged out, please refresh and log in","error"):new XWiki.widgets.Notification("Failed to change blog post visibility.","error")}).always(function(){g.hide();d.show()})}).each(function(){var a=b(this);a.attr("href",a.attr("href").replace(/xredirect=.*?(&|$)/,"ajax\x3d1$1"))})})});