WRMCB=function(e){var c=console;if(c&&c.log&&c.error){c.log('Error running batched script.');c.error(e);}} ; try { /* module-key = 'confluence.web.resources:page-children', location = 'includes/js/page-children.js' */ define("confluence/page-children",["jquery","ajs","raphael","confluence/api/constants"],function(e,d,m,f){return function(c){var g,h,e=function(a){if(a.homePage){var b="Home page";return'\x3cspan class\x3d"child-display"\x3e\x3cspan class\x3d"icon content-type-home" title\x3d"'+b+'"\x3e'+b+':\x3c/span\x3e \x3ca href\x3d"'+f.CONTEXT_PATH+a.href+'"\x3e'+a.text+"\x3c/a\x3e\x3c/span\x3e"}return'\x3cspan class\x3d"child-display"\x3e\x3cspan class\x3d"icon content-type-page" title\x3d"Page"\x3ePage:\x3c/span\x3e \x3ca href\x3d"'+ f.CONTEXT_PATH+a.href+'"\x3e'+d.escapeHtml(a.text)+"\x3c/a\x3e\x3c/span\x3e"},n=function(a){var b=c("#page-children:not(.children-loaded)");l();if(a&&b.length)if(a.errorMessage)b.html("\x3cspan class\x3d'error'\x3e"+a.errorMessage+"\x3c/span\x3e");else{var d=[];c.each(a,function(a,b){d.push(e(b))});b.html(d.join(""));b.addClass("children-loaded")}},l=function(){h&&(h(),h=null);g.addClass("hidden")},k=function(a){d.safe.ajax({url:f.CONTEXT_PATH+"/json/pagechildrenstoresettings.action",type:"POST", data:{pageId:d.params.pageId,showChildren:a},success:function(){},error:function(a,c){d.log("Failed to store the user 'showChildren' user setting: "+c)}})},p=function(){var a=c("#page-children:not(.children-loaded)");a.length?(g=c("\x3cdiv class\x3d'throbber'\x3e\x3c/div\x3e"),a.append(g),h=m.spinner(g[0],10,"#666"),d.safe.ajax({url:f.CONTEXT_PATH+"/json/pagechildren.action",type:"POST",data:{pageId:d.params.pageId,showChildren:!0},success:n,error:function(b,c,e){b="Could not load child items."; l();a.html("\x3cspan class\x3d'error'\x3e"+b+"\x3c/span\x3e");d.log("Error retrieving child pages: "+c)}})):k(!0)};c("#children-section a.children-show-hide").each(function(){c(this).click(function(a){var b=c("#children-section");b.hasClass("children-showing")?(c("#page-children").hide(),k(!1),b.removeClass("children-showing").addClass("children-hidden")):(c("#page-children").show(),c("#children-section:not(.children-showing)").length?p():k(!0),b.removeClass("children-hidden").addClass("children-showing")); return d.stopEvent(a)})})}});require("confluence/module-exporter").safeRequire("confluence/page-children",function(e){require("ajs").toInit(e)}); }catch(e){WRMCB(e)};