gDb.ordered_comment_ids.scope.indexOf(b)){return 1;}return 0;});}this.showComments(e,[0,30],true);},this,null);},showComments:function(f,d,e){checkForOpenedDialog(null,function(){this._q.add({fn:CY.bind(this.setPreventClickOn,this)});this._showComments(f,d[1],e);this._animateTo(d[1]);this._q.add({fn:CY.bind(this.setPreventClickOff,this)});this._q.run();},this,null);},openComment:function(e){this._q.add({fn:CY.bind(this.setPreventClickOn,this)});var d=gIComments.getTopPosition()[1];this._q.add({fn:function(){gIComments.open(e.commentId);gIComments.refresh(e.commentId);}});this._animateTo(d);this._q.add({fn:CY.bind(this.setPreventClickOff,this)});this._q.run();},closeComment:function(b){checkForOpenedDialog(b,function(){this._q.add({fn:CY.bind(this.setPreventClickOn,this)});var a=gIComments.getTopPosition()[1];this._q.add({fn:function(){var d=gDb.getComment(b.commentId);gIComments.close(b.commentId);if(d.reply_to_id!=null){gIComments.refresh(d.reply_to_id);}}});this._animateTo(a);this._q.add({fn:CY.bind(this.setPreventClickOff,this)});this._q.run();},this,null);},activate:function(b){gIComments.activate(b.commentId);}};readyForAction=function(){return !gSync._iPreventClick;};gToc=null;instanciateToc=function(){gToc={tocId:CY.guid(),tocTitleId:CY.guid(),closeBtnId:CY.guid(),empty:false};var r={};r.headerContent='';var t=getElementsByTagNames("h2,h3,h4,h5,h6",document.getElementById("maincontainer"));var m=document.createElement("div");if(t.length>=2){for(var o=0;o]*>/ig,"");n.className="page indent"+t[o].nodeName;m.appendChild(n);var l=t[o].id||"link"+o;n.href="#"+l;t[o].id=l;}}else{m.innerHTML="";gToc.empty=true;}r.bodyContent=m.innerHTML;var s=gLayout.getTopICommentsWidth();var p=new CY.Overlay({zIndex:3,shim:false,visible:false,headerContent:r.headerContent,bodyContent:r.bodyContent,xy:[3,30],width:s});p.get("contentBox").addClass("c-toc");p.get("contentBox").set("id","the-toc");p.render("#leftcolumn");CY.get("#"+gToc.tocTitleId).set("innerHTML",gettext("Table of contents"));gToc.overlay=p;var i=null;i=new CY.Anim({node:p.get("boundingBox"),duration:0.3,easing:CY.Easing.easeOut});gToc.animationHide=i;i.set("to",{opacity:0});gToc["animationHide-handle"]=i.on("end",onTocHideAnimEnd,gToc);var q=null;q=new CY.Anim({node:p.get("boundingBox"),duration:0.3,easing:CY.Easing.easeOut});gToc.animationShow=q;q.set("to",{opacity:1});gToc["animationShow-handle"]=q.on("end",onTocShowAnimEnd,gToc);getElementsByClassName("c-toc")[0].style.width=s+"px";};toggleTocFn=function(){if(isTocVisible()){hideToc();}else{showToc();}};hideToc=function(){gToc.overlay.hide();};onTocHideAnimEnd=function(){this.overlay.hide();gSync.resume();};onTocShowAnimEnd=function(){gSync.resume();};showToc=function(){removeFormErrMsg(gToc.tocId);gIComments.hide();gToc.overlay.show();};isTocVisible=function(){if(gToc!=null){return gToc.overlay.get("visible");}return false;};function getElementsByTagNames(l,k){if(!k){var k=document;}var j=l.split(",");var m=new Array();for(var n=0;n0){checkForOpenedDialog(null,function(){gSync.showComments(a,[f.pageX,f.pageY],false);});}}}}};gLastScrollTime=null;checkForAlignement=function(){var a=(new Date()).getTime();if((gLastScrollTime!=null)&&(a-gLastScrollTime)>200){positionICommentForm();gLastScrollTime=null;}};onFrameScroll=function(){gLastScrollTime=(new Date()).getTime();};browse=function(a,b){gSync.browse(a,b);};initialConnect=function(){CY.on("mouseup",onTextMouseUp,"#textcontainer");gTimer=CY.Lang.later(200,this,checkForAlignement,[],true);CY.on("scroll",onFrameScroll,window,this,true);CY.on("resize",onFrameScroll,window,this,true);};preventLinksInText=function(){var a=function(g){var c=g.target;var d=null;while(c!=null&&d==null){c=c.get("parentNode");d=c.get("href");}if(c!=null&&d!=null){var b=window.location.href;var f=b.indexOf("#");if(f!=-1){b=b.substring(0,f);}if(d.indexOf(b)==-1){window.open(c.get("href"));g.preventDefault();}}};CY.all("#textcontainer a").on("click",a);};onDomReady=function(b){preventLinksInText();var a=new CY.AsyncQueue();a.add({fn:function(){if(gLayout.isInComentSite()){parent.toInitialSize();}if(sv_withComments){instanciateICommentForm();}instanciateToc();},timeout:5},{fn:function(){gGETValues=CY.JSON.parse(sv_get_params);CY.get("#maincontainer").setStyle("display","block");CY.get("#textcontainer").setStyle("display","block");var e=(sv_withComments)?gPrefs.get("layout","comments_col_width"):0;var d=sliderValToPx(e);gLayout.setLeftColumnWidth(d);if(gLayout.isInFrame()){parent.f_initFrame();parent.f_layoutFrames();if(sv_withComments){parent.f_fillTopToolbar();if(hasPerm("can_create_comment")){parent.$("#add_comment_btn").removeClass("initially_hidden");}parent.f_fillFilterTab();parent.f_fillPreferencesTab();var c=CY.JSON.parse(sv_filter_data);parent.f_updateFilterData(c);parent.f_setFilterValue(gGETValues);}parent.f_fillTextPreferencesTab();}if(gLayout.isInComentSite()){parent.$("#c_fullscreen_btn").show();}else{parent.$("#c_fullscreen_btn").hide();}if(gToc.empty){parent.$("#c_toc_btn").hide();}},timeout:5},{fn:function(){if(sv_withComments){reinit(gGETValues);initialConnect();}},timeout:5},{fn:function(){if(gLayout.isInFrame()){parent.f_interfaceUnfreeze();parent.f_removeLoadingMsg();}if("comment_id_key" in gGETValues){var e=gGETValues.comment_id_key;var g=gDb.getCommentByIdKey(e);if(g!=null){var f=gDb.getPath(g);var c=f[f.length-1];var d=gDb.getCommentByIdKey(e);if("comment_op" in gGETValues&&gGETValues.comment_op=="reply"){gSync.showFocusSingleComment(c,d,true);}else{gSync.showFocusSingleComment(c,d,false);}}}if("comments_auto_display" in gGETValues){gSync.showAllComments();}}});a.run();};
\ No newline at end of file