";var j=''+l.bodyContent+"
";gEditICommentHost.overlay.setStdModContent(CY.WidgetStdMod.HEADER,CY.Node.create(g),CY.WidgetStdMod.AFTER);gEditICommentHost.overlay.setStdModContent(CY.WidgetStdMod.BODY,CY.Node.create(j),CY.WidgetStdMod.AFTER);CY.get("#"+gEdit.ids.formTitleId).set("innerHTML",gettext("Edit comment"));var i=gDb.getComment(gEditICommentHost.commentId);CY.get("#"+gEdit.ids.editCommentId).set("value",i.id);CY.get("#"+gEdit.ids.keyId).set("value",i.key);CY.get("#"+gEdit.ids.changeScopeInputId+" input").set("checked",false);if(i.reply_to_id!=null){CY.get("#"+gEdit.ids.changeScopeInputId).addClass("displaynone");}changeScopeFormClick();CY.get("#"+gEdit.ids.nameInputId).set("value",i.name);CY.get("#"+gEdit.ids.emailInputId).set("value",i.email);if(i.logged_author){CY.get("#"+gEdit.ids.nameInputId).setAttribute("disabled",true);CY.get("#"+gEdit.ids.emailInputId).setAttribute("disabled",true);}CY.get("#"+gEdit.ids.titleInputId).set("value",i.title);CY.get("#"+gEdit.ids.contentInputId).set("value",i.content);CY.get("#"+gEdit.ids.tagsInputId).set("value",i.tags);CY.get("#"+gEdit.ids.formatInputId).set("value",gConf.defaultCommentFormat);var k=gLayout.getTopICommentsWidth();changeFormFieldsWidth(gEdit.ids.formId,k);gEdit.handlers.addBtnId=CY.on("click",onEditSaveClick,"#"+gEdit.ids.addBtnId);gEdit.handlers.cancelBtnId=CY.on("click",onEditCancelClick,"#"+gEdit.ids.cancelBtnId);gEdit.handlers.changeScope=CY.on("click",onChangeScopeClick,"#"+gEdit.ids.changeScopeInputId);};onEditSaveClick=function(b){if(readyForAction()){gSync.editComment();}};onEditCancelClick=function(b){if(readyForAction()){gSync.cancelEdit();}};onChangeScopeClick=function(){if(readyForAction()){gSync.changeScopeFormClick();}else{var d=CY.get("#"+gEdit.ids.changeScopeInputId+" input");var c=d.get("checked");d.set("checked",!c);}};changeScopeFormClick=function(){var b=CY.get("#"+gEdit.ids.currentSelId);if(CY.get("#"+gEdit.ids.changeScopeInputId+" input").get("checked")){b.removeClass("displaynone");}else{b.addClass("displaynone");}};cancelEditForm=function(){if(gEditICommentHost!=null){for(var c in gEdit.handlers){if(gEdit.handlers[c]!=null){gEdit.handlers[c].detach();gEdit.handlers[c]=null;}}var d=gEditICommentHost.overlay.get("contentBox").query(".icomment-edit-body");d.get("parentNode").removeChild(d);d=gEditICommentHost.overlay.get("contentBox").query(".icomment-edit-header");d.get("parentNode").removeChild(d);gEditICommentHost.showContent();gEditICommentHost=null;}};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){this._animateTo(f);}}},_showFocusSingleComment:function(g,h,e){if(g!=null){var f=0;if(g.start_wrapper!=-1){f=CY.get(".c-id-"+g.id).getY();}else{f=CY.get("document").get("scrollTop");}this._showComments([g.id],f,false);if(g.replies.length>0||e){this._animateToAndFocus(f,h.id,e);}}},showSingleComment:function(b){this._q.add({fn:CY.bind(this.setPreventClickOn,this)});this._showSingleComment(b);this._q.add({fn:CY.bind(this.setPreventClickOff,this)});this._q.run();},showFocusSingleComment:function(f,d,e){this._q.add({fn:CY.bind(this.setPreventClickOn,this)});this._showFocusSingleComment(f,d,e);this._q.add({fn:CY.bind(this.setPreventClickOff,this)});this._q.run();},browse:function(e,d){var f=gIComments.browse(e,d);if(f!=null){this.showSingleComment(f);}},_showComments:function(f,d,e){this._q.add({fn:function(){gShowingAllComments=e;gIComments.hide();hideToc();var c=CY.Array.map(f,function(h){return gDb.getComment(h);});var a=gDb.getThreads(c);gIComments.fetch(a);if(f.length>0){if(e){CY.get("document").set("scrollTop",0);}else{gIComments.activate(f[0]);var b=CY.get(".c-id-"+f[0]);if(b&&!b.inViewportRegion()){b.scrollIntoView(true);}}}gIComments.setPosition([gConf.iCommentLeftPadding,d]);gIComments.show();}});},_animateTo:function(b){this._q.add({fn:function(){gIComments.setAnimationToPositions(b);}},{id:"animationRun",autoContinue:false,fn:CY.bind(gIComments.runAnimations,gIComments)});},_animateToAndFocus:function(e,f,d){this._q.add({fn:function(){gIComments.setAnimationToPositionsAndFocus(e,f,d);}},{id:"animationRun",autoContinue:false,fn:CY.bind(gIComments.runAnimations,gIComments)});},_animateToTop:function(){var b=gIComments.getTopPosition();if(b!=null){this._animateTo(b[1]);}},animateToTop:function(){this._q.add({fn:CY.bind(this.setPreventClickOn,this)});this._animateToTop();this._q.add({fn:CY.bind(this.setPreventClickOff,this)});this._q.run();},showAllComments:function(){checkForOpenedDialog(null,function(){gShowingAllComments=true;var b=CY.Array.map(gDb.comments,function(a){return a.id;});if(parent.$("#browse_by").val()=="scope"){b.sort(function(a,e){if(gDb.ordered_comment_ids.scope.indexOf(a)gDb.ordered_comment_ids.scope.indexOf(e)){return 1;}return 0;});}this.showComments(b,[0,30],true);},this,null);},showScopeRemovedComments:function(){checkForOpenedDialog(null,function(){gShowingAllComments=true;var c=CY.Array.filter(gDb.comments,function(a){return(a.start_wrapper==-1);});var d=CY.Array.map(c,function(a){return a.id;});if(parent.$("#browse_by").val()=="scope"){d.sort(function(a,b){if(gDb.ordered_comment_ids.scope.indexOf(a)gDb.ordered_comment_ids.scope.indexOf(b)){return 1;}return 0;});}this.showComments(d,[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(d){this._q.add({fn:CY.bind(this.setPreventClickOn,this)});var c=gIComments.getTopPosition()[1];this._q.add({fn:function(){gIComments.open(d.commentId);gIComments.refresh(d.commentId);}});this._animateTo(c);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;};gNewReplyHost=null;gNewReply=null;instanciateNewReplyForm=function(j){if(gNewReply==null){gNewReply={val:{name:gPrefs.get("user","name"),email:gPrefs.get("user","email"),title:"",content:"",tags:""},ids:{name:gPrefs.get("user","name"),email:gPrefs.get("user","email"),title:"",content:"",tags:"",formId:CY.guid(),nameInputId:CY.guid(),emailInputId:CY.guid(),titleInputId:CY.guid(),contentInputId:CY.guid(),keyInputId:CY.guid(),formatInputId:CY.guid(),tagsInputId:CY.guid(),parentCommentId:CY.guid(),addBtnId:CY.guid(),cancelBtnId:CY.guid()},handlers:{}};}gNewReplyHost=j;var q='
";var n=gFormHtml.formStart.replace("###",gNewReply.ids.formId);if(!sv_loggedIn){n=n+gFormHtml.nameInput.replace("###",gNewReply.ids.nameInputId)+gFormHtml.emailInput.replace("###",gNewReply.ids.emailInputId);}n=n+gFormHtml.titleInput.replace("###",gNewReply.ids.titleInputId)+gFormHtml.contentInput.replace("###",gNewReply.ids.contentInputId)+gFormHtml.tagsInput.replace("###",gNewReply.ids.tagsInputId);n=n+gFormHtml.hidden.replace("###",gNewReply.ids.keyInputId).replace("???","comment_key");n=n+gFormHtml.hidden.replace("###",gNewReply.ids.formatInputId).replace("???","format");n=n+gFormHtml.hidden.replace("###",gNewReply.ids.parentCommentId).replace("???","reply_to_id");var k=gFormHtml.btns.replace("###",gNewReply.ids.addBtnId).replace("???",gNewReply.ids.cancelBtnId);gNewReplyHost.overlay.setStdModContent(CY.WidgetStdMod.FOOTER,q+n+k);var p=gNewReplyHost.overlay.getStdModNode(CY.WidgetStdMod.FOOTER);var m=gDb.getComment(j.commentId);var r="Re: ";var l=(gNewReply.val.title==""||gNewReply.val.title.substring(0,r.length)==r)?r+m.title:gNewReply.val.title;if(!sv_loggedIn){p.query(".n_name").set("value",gNewReply.val.name);p.query(".n_email").set("value",gNewReply.val.email);}p.query(".n_title").set("value",l);p.query(".n_content").set("value",gNewReply.val.content);p.query(".n_tags").set("value",gNewReply.val.tags);p.query("#"+gNewReply.ids.parentCommentId).set("value",j.commentId);p.query("#"+gNewReply.ids.formatInputId).set("value",gConf.defaultCommentFormat);gNewReplyHost.overlay.get("contentBox").query(".c-reply").addClass("displaynone");gNewReply.handlers.addBtnId=CY.on("click",onAddNewReplyClick,"#"+gNewReply.ids.addBtnId);gNewReply.handlers.cancelBtnId=CY.on("click",onCancelNewReplyClick,"#"+gNewReply.ids.cancelBtnId);var o=gLayout.getTopICommentsWidth();changeFormFieldsWidth(gNewReply.ids.formId,o);CY.get("#"+gNewReply.ids.contentInputId).focus();};cleanNewReplyForm=function(){if(gNewReplyHost!=null){var b=gNewReplyHost.overlay.getStdModNode(CY.WidgetStdMod.FOOTER);b.queryAll(".comment_input").set("value","");}};cancelNewReplyForm=function(){if(gNewReplyHost!=null){for(var c in gNewReply.handlers){if(gNewReply.handlers[c]!=null){gNewReply.handlers[c].detach();gNewReply.handlers[c]=null;}}gNewReplyHost.overlay.get("contentBox").query(".c-reply").removeClass("displaynone");var d=gNewReplyHost.overlay.getStdModNode(CY.WidgetStdMod.FOOTER);if(!sv_loggedIn){gNewReply.val.name=d.query(".n_name").get("value");gNewReply.val.email=d.query(".n_email").get("value");}gNewReply.val.title=d.query(".n_title").get("value");gNewReply.val.content=d.query(".n_content").get("value");gNewReply.val.tags=d.query(".n_tags").get("value");d.set("innerHTML","");gNewReplyHost=null;}};onAddNewReplyClick=function(){if(!sv_loggedIn){var c=CY.get("#"+gNewReply.ids.nameInputId).get("value");gPrefs.persist("user","name",c);var d=CY.get("#"+gNewReply.ids.emailInputId).get("value");gPrefs.persist("user","email",d);}gSync.saveComment(gNewReply.ids.formId);};onCancelNewReplyClick=function(){gSync.cancelReply();};gICommentForm=null;instanciateICommentForm=function(){gICommentForm={position:[CY.WidgetPositionExt.TL,CY.WidgetPositionExt.TL],formId:CY.guid(),formTitleId:CY.guid(),titleInputId:CY.guid(),contentInputId:CY.guid(),tagsInputId:CY.guid(),formatInputId:CY.guid(),startWrapperInputId:CY.guid(),endWrapperInputId:CY.guid(),startOffsetInputId:CY.guid(),endOffsetInputId:CY.guid(),selectionPlaceId:CY.guid(),keyId:CY.guid(),currentSelId:CY.guid(),currentSelIdI:CY.guid(),addBtnId:CY.guid(),cancelBtnId:CY.guid(),closeBtnId:CY.guid()};if(!sv_loggedIn){gICommentForm.nameInputId=CY.guid();gICommentForm.emailInputId=CY.guid();}var j=getHtml(gICommentForm);var h=gLayout.getTopICommentsWidth();var f=new CY.Overlay({zIndex:3,shim:false,visible:false,headerContent:j.headerContent,bodyContent:j.bodyContent,xy:[10,10],width:h});f.get("contentBox").addClass("c-newcomment");f.render("#leftcolumn");if(!sv_loggedIn){CY.get("#"+gICommentForm.nameInputId).set("value",gPrefs.get("user","name"));CY.get("#"+gICommentForm.emailInputId).set("value",gPrefs.get("user","email"));}CY.get("#"+gICommentForm.formTitleId).set("innerHTML",gettext("New comment"));CY.get("#"+gICommentForm.formatInputId).set("value",gConf.defaultCommentFormat);CY.on("click",onSubmitICommentFormClick,"#"+gICommentForm.addBtnId);CY.on("click",onCancelICommentFormClick,"#"+gICommentForm.cancelBtnId);CY.on("click",onCancelICommentFormClick,"#"+gICommentForm.closeBtnId);gICommentForm.overlay=f;var i=null;i=new CY.Anim({node:f.get("boundingBox"),duration:0.3,easing:CY.Easing.easeOut});gICommentForm.animationHide=i;i.set("to",{opacity:0});gICommentForm["animationHide-handle"]=i.on("end",onICommentFormHideAnimEnd,gICommentForm);var g=null;g=new CY.Anim({node:f.get("boundingBox"),duration:0.3,easing:CY.Easing.easeOut});gICommentForm.animationShow=g;g.set("to",{opacity:1});gICommentForm["animationShow-handle"]=g.on("end",onICommentFormShowAnimEnd,gICommentForm);changeFormFieldsWidth(gICommentForm.formId,h);};cleanICommentForm=function(){CY.get("#"+gICommentForm.currentSelIdI).set("innerHTML",gNoSelectionYet);var b=gICommentForm.overlay.getStdModNode(CY.WidgetStdMod.BODY);b.queryAll(".comment_input").set("value","");CY.get("#"+gICommentForm.formatInputId).set("value",gConf.defaultCommentFormat);if(!sv_loggedIn){b.queryAll(".user_input").set("value","");}};onICommentFormHideAnimEnd=function(){this.overlay.hide();gSync.resume();};onICommentFormShowAnimEnd=function(){gSync.resume();};onSubmitICommentFormClick=function(){if(!sv_loggedIn){var c=CY.get("#"+gICommentForm.nameInputId).get("value");gPrefs.persist("user","name",c);var d=CY.get("#"+gICommentForm.emailInputId).get("value");gPrefs.persist("user","email",d);}gSync.saveComment(gICommentForm.formId);};onCancelICommentFormClick=function(){gSync.cancelICommentForm();};_updateICommentFormSelection=function(j,h,f,g){var i=CY.Node.get("#"+j.currentSelIdI);if(i!=null){i.set("innerHTML",h);}i=CY.get("#"+j.startWrapperInputId);if(i!=null){i.set("value",f.elt.id.substring("sv_".length));}i=CY.get("#"+j.startOffsetInputId);if(i!=null){i.set("value",f.offset);}i=CY.get("#"+j.endWrapperInputId);if(i!=null){i.set("value",g.elt.id.substring("sv_".length));}i=CY.get("#"+j.endOffsetInputId);if(i!=null){i.set("value",g.offset);}};updateICommentFormSelection=function(k){var j=(k==null)?"":k.text;if(j!=""){var m=j;var q=100;if(j.length>q){var r=j.substring(0,(j.substring(0,q/2)).lastIndexOf(" "));var o=j.substring(j.length-q/2);var p=o.substring(o.indexOf(" "));m=r+" ... "+p;}var n=_convertSelectionFromCCToCS(k.start);var l=_convertSelectionFromCCToCS(k.end);_updateICommentFormSelection(gICommentForm,m,n,l);if(gEdit!=null){_updateICommentFormSelection(gEdit.ids,m,n,l);}positionICommentForm();}};showICommentForm=function(){removeFormErrMsg(gICommentForm.formId);if(!sv_loggedIn){if(CY.get("#"+gICommentForm.nameInputId).get("value")==""){CY.get("#"+gICommentForm.nameInputId).set("value",gPrefs.get("user","name"));}if(CY.get("#"+gICommentForm.emailInputId).get("value")==""){CY.get("#"+gICommentForm.emailInputId).set("value",gPrefs.get("user","email"));}}gIComments.hide();hideToc();positionICommentForm();gICommentForm.overlay.show();CY.get("#"+gICommentForm.titleInputId).focus();};isICommentFormVisible=function(){if(gICommentForm!=null){return gICommentForm.overlay.get("visible");}return false;};positionICommentForm=function(){if(gICommentForm!=null){var f=gICommentForm.overlay;var g=f.get("boundingBox");var j=g.get("offsetHeight");var h=g.get("winHeight");var i=gICommentForm.position;if(j>h){i=[CY.WidgetPositionExt.BL,CY.WidgetPositionExt.BL];}f.set("align",{points:i});if(j<=h){f.set("y",f.get("y")+30);}g.setX(g.getX()+gConf.iCommentLeftPadding);}};hasPerm=function(b){return(-1!=CY.Array.indexOf(sv_user_permissions,b));};IComments=function(){this._c=[];this._a=[];this._nbEndedAnim=0;this._topActiveCommentDbId=null;};IComments.prototype={init:function(a){for(var b=0;b0){b.showReadRepliesLnk();}else{b.hideReadRepliesLnk();}},remove:function(a){this._remove(this._getChildren(a));},close:function(a){CY.Array.each(this._getChildren(a),function(b){b.hide();});},open:function(a){CY.Array.each(this._getChildren(a),function(b){b.show();});},fetch:function(b){for(var a=0;a=f){this._a.push(c.setAnimationToPosition([k,h],f,b));}else{this._a.push(c.setAnimationToPosition([k,h]));}h+=c.getHeight();}}},_initAnimations:function(){this._a=[];this._nbEndedAnim=0;},runAnimations:function(){if(this._a.length==0){gSync.resetAutoContinue("animationRun");}else{CY.each(this._a,function(a){a.run();});}},whenAnimationsEnd:function(){gSync.resume();},whenAnimationsEndFocus:function(){gGETValues=CY.JSON.parse(sv_get_params);if("comment_id_key" in gGETValues){var b=gGETValues.comment_id_key;var a=gDb.getCommentByIdKey(b);if(a!=null){gIComments.getIComment(a.id).overlay.focus();}}gSync.resume();},whenAnimationsEndReply:function(){gGETValues=CY.JSON.parse(sv_get_params);if("comment_id_key" in gGETValues){var b=gGETValues.comment_id_key;var a=gDb.getCommentByIdKey(b);if(a!=null){gSync.showReplyForm(gIComments.getIComment(a.id));}}gSync.resume();},animationsEnded:function(){return((this._a.length==0)||(this._a.length==this._nbEndedAnim));},signalAnimationEnd:function(){this._nbEndedAnim++;},isTopActive:function(a){return((a!=null)&&(this._topActiveCommentDbId==a));},isAnyActive:function(){return(this._topActiveCommentDbId!=null);},activate:function(f){if(this._topActiveCommentDbId!=null){this.deactivate();}var e=gDb.getComment(f);var b=gDb.getPath(e);var a=b[b.length-1];var c=this._getChildren(a.id);CY.Array.each(c,function(g){g.activate();});this._topActiveCommentDbId=a.id;if(gLayout.isInFrame()){var d=gDb.browsingIndex(this._topActiveCommentDbId);parent.$("#browse_by option").each(function(){var g=1+d[this.value];parent.$("#c_browse_indx_"+this.value).html(""+g);});}showScope(a.id);},deactivate:function(){if(this._topActiveCommentDbId!=null){parent.$("#browse_by option").each(function(){parent.$("#c_browse_indx_"+this.value).html("-");});hideScopeAnyway();var a=this._getChildren(this._topActiveCommentDbId);CY.Array.each(a,function(b){b.deactivate();});this._topActiveCommentDbId=null;}},activateVisibleNext:function(){if(this._topActiveCommentDbId!=null){for(var d=0;d<2;d++){var f=(d==0)?0:this._c.length-1;var a=false;for(var e=f;(e>=0)&&e<=(this._c.length-1);){var c=this._c[e];if(c.commentId!=null&&c.isVisible()){a=a||(gDb.isChild(c.commentId,this._topActiveCommentDbId));if(a&&(!gDb.isChild(c.commentId,this._topActiveCommentDbId))){this.activate(c.commentId);return true;}}e=(d==0)?e+1:e-1;}}}return false;},browse:function(b,c){var a=c;if((c=="prev")&&!this.isAnyActive()){a="last";}if((c=="next")&&!this.isAnyActive()){a="first";}return gDb.browse(b,a,this._topActiveCommentDbId);}};CY=null;gPrefs=null;gLayout=null;gDb=null;gIComments=null;gSync=null;gGETValues=null;gConf={iCommentLeftPadding:4,iCommentThreadPadding:12,defaultCommentFormat:"markdown",sliderFixedMin:0.9,sliderFixedMax:0.1,iCommentsInitAlloc:2,defaultPrefs:{text:{style:"text-modern-style"},user:{name:"",email:""},general:{animduration:"0.4"},comments:{threadpad:"1"},layout:{comments_col_width:"25"}}};if(sv_custom_font){gTextStyles={custom:gettext("custom"),modern:gettext("modern"),classic:gettext("classic"),code:gettext("code")};}else{gTextStyles={modern:gettext("modern"),classic:gettext("classic"),code:gettext("code")};}YUI({base:sv_media_url+"/js/lib/yui/"+c_yui_base+"/build/",timeout:10000}).use("text-modern-style","cookie","json","overlay","io-form","async-queue","event-mouseenter","anim","collection",function(a){CY=a;gPrefs=new Preferences();gPrefs.init();gLayout=new Layout();gLayout.init();if(sv_withComments){gDb=new Db();gDb.init();gIComments=new IComments();gIComments.init();}gSync=new Sync();gSync.init();CY.on("domready",onDomReady,this);});_reinit=function(a){gIComments.hide();gDb.initComments(a.commentIds);unpaintAllComments();renderCommentScopes();updateFilterResultsCount(a.nbDiscussions,a.nbComments,a.nbReplies);};reinit=function(b){var a=gDb.computeFilterResults(b);_reinit(a);};hideAll=function(){_reinit({commentIds:[],nbDiscussions:0,nbComments:0,nbReplies:0});};updateFilterResultsCount=function(f,a,b){var e=gDb.getCommentsAndRepliesCounts(true);var g=e[0],d=e[1];var c=(a!=0||b!=0)&&(g!=a||d!=b);if(gLayout.isInFrame()){parent.f_updateFilterCountDetailed(c);parent.f_updateFilterCountResult(f,a,b,g,d);}};updateResetFilterResultsCount=function(){var c=gDb.getCommentsAndRepliesCounts(false);var a=c[0],b=c[1];var d=a;updateFilterResultsCount(d,a,b);};renderCommentScopes=function(){for(var a=0;a0){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();};c_persistPreference=function(b,a,c){gPrefs.persist(b,a,c);};c_readDefaultPreference=function(b,a){return gConf.defaultPrefs[b][a];};c_readPreference=function(b,a){return gPrefs.get(b,a);};c_resetPreferences=function(a){gPrefs.reset(a);};c_applyTextStyle=function(a){CY.use(a);};sliderValToPx=function(d){var a=CY.DOM.winWidth();if(gLayout.isInFrame()){a=parent.$(parent).width();}var b=d/100;b=Math.min(b,gConf.sliderFixedMin);b=Math.max(b,gConf.sliderFixedMax);var c=b*a;return Math.floor(c);};c_setCommentsColWidth=function(c){var a=sliderValToPx(c);gLayout.setLeftColumnWidth(a);var b=gLayout.getTopICommentsWidthFromWidth(a);gIComments.setWidth(b);gICommentForm.overlay.get("boundingBox").setStyle("width",b+"px");changeFormFieldsWidth(gICommentForm.formId,b);document.getElementById("the-toc").style.width=b+"px";if(gNewReply){changeFormFieldsWidth(gNewReply.ids["formId"],b);}if(gEdit){changeFormFieldsWidth(gEdit.ids["formId"],b);}};
\ No newline at end of file