1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-02 22:45:02 +03:00

навигация по комментариям

This commit is contained in:
Mzhelskiy Maxim 2009-03-29 12:02:35 +00:00
parent 680201a7b2
commit 0bca992257
4 changed files with 37 additions and 9 deletions

View file

@ -91,6 +91,10 @@
<li><a href="javascript:lsCmtTree.toggleCommentForm({$aComment.obj->getId()});" class="reply-link">{$aLang.comment_answer}</a></li>
{/if}
<li><a href="#comment{$aComment.obj->getId()}" class="imglink link"></a></li>
{if $aComment.obj->getPid()}
<li class="goto-comment-parent"><a href="#comment{$aComment.obj->getPid()}" onclick="return lsCmtTree.goToParentComment($(this));" title="Ответ на">↑</a></li>
{/if}
<li class="goto-comment-child hidden"><a href="#" onclick="return lsCmtTree.goToChildComment(this);" title="Обратно к ответу">↓</a></li>
{if !$aComment.obj->getDelete() and $oUserCurrent and $oUserCurrent->isAdministrator()}
<li><a href="#" class="delete" onclick="lsCmtTree.toggleComment(this,{$aComment.obj->getId()}); return false;">{$aLang.comment_delete}</a></li>
{/if}

View file

@ -24,7 +24,11 @@
<ul>
<li class="date">{date_format date=$oComment->getDate()}</li>
<li><a href="javascript:lsCmtTree.toggleCommentForm({$oComment->getId()});" class="reply-link">Ответить</a></li>
<li><a href="#comment{$oComment->getId()}" class="imglink link"></a></li>
<li><a href="#comment{$oComment->getId()}" class="imglink link"></a></li>
{if $oComment->getPid()}
<li class="goto-comment-parent"><a href="#comment{$oComment->getPid()}" onclick="return lsCmtTree.goToParentComment($(this));" title="Ответ на">↑</a></li>
{/if}
<li class="goto-comment-child hidden"><a href="#" onclick="return lsCmtTree.goToChildComment(this);" title="Обратно к ответу">↓</a></li>
</ul>
</div>

View file

@ -470,6 +470,8 @@ select { width: 99%; }
.comment .info ul li { float: left; font-size: 10px; margin-right: 10px; }
.comment .info ul li.date { color: #999; font-size: 10px; padding-right: 20px; }
.comment .info a.imglink { display: block; width: 9px; height: 11px; text-decoration: none; position: relative; top: 3px; }
.comment .info ul li.goto-comment-parent a { text-decoration: none; border-bottom: 1px dotted #79B1D4; font-family: tahoma;}
.comment .info ul li.goto-comment-child a { text-decoration: none; border-bottom: 1px dotted #79B1D4; font-family: tahoma;}
.comment .info a.link { background: url(../images/icons.gif) no-repeat scroll -10px -230px; }
.comment .info a.link:hover { background: url(../images/icons.gif) no-repeat scroll 0px -230px; }
.comment .info a.favorite { background: url(../images/icons.gif) no-repeat scroll -40px -40px; }
@ -765,7 +767,7 @@ table.admin_page td { /* IE: */ border-left: expression(previousSibling == nul
table.admin_page img {margin: 0px !important;;}
.hidden {display: none;}

View file

@ -22,6 +22,7 @@ var lsCmtTreeClass = new Class({
this.aCommentNew=[];
this.iCurrentShowFormComment=0;
this.countNewComment=0;
this.docScroller = new Fx.Scroll(document.getDocument());
this.hideCommentForm(this.iCurrentShowFormComment);
},
@ -180,7 +181,7 @@ var lsCmtTreeClass = new Class({
});
if (selfIdComment && $('comment_id_'+selfIdComment)) {
docScroller.toElement($('comment_id_'+selfIdComment));
thisObj.docScroller.toElement($('comment_id_'+selfIdComment));
}
}
},
@ -212,14 +213,14 @@ var lsCmtTreeClass = new Class({
var offsetY=0;
//для скролла в центр
//offsetY=-window.getSize().y/2;
docScroller.setOptions({
this.docScroller.setOptions({
duration:500,
offset: {
'x': 0,
'y': offsetY
}
});
docScroller.toElement($('comment_id_'+this.aCommentNew[0]));
this.docScroller.toElement($('comment_id_'+this.aCommentNew[0]));
}
this.aCommentNew.erase(this.aCommentNew[0]);
}
@ -327,12 +328,30 @@ var lsCmtTreeClass = new Class({
preview: function() {
ajaxTextPreview('form_comment_text',false,'comment_preview_'+this.iCurrentShowFormComment);
}
},
goToParentComment: function(obj) {
var idCmt = obj.href.substr(obj.href.indexOf('#')+8);
var objCmtParent=$('comment_id_'+idCmt);
var objCmt=obj.getParent('div.comment');
objCmtParent.getElement('.goto-comment-child').removeClass('hidden');
objCmtParent.getElement('.goto-comment-child a').href = '#comment' + objCmt.id.substr(11);
this.docScroller.toElement(objCmtParent);
return false;
},
goToChildComment: function(obj) {
var idCmt = obj.href.substr(obj.href.indexOf('#')+8);
var objCmtChild=$('comment_id_'+idCmt);
var objCmt=obj.getParent('div.comment');
objCmt.getElement('.goto-comment-child').addClass('hidden');
this.docScroller.toElement(objCmtChild);
return false;
}
});
var lsCmtTree;
var docScroller;
var formCommentSlide;
window.addEvent('domready', function() {
@ -345,8 +364,7 @@ window.addEvent('domready', function() {
closeImg: 'folding'
}
});
docScroller = new Fx.Scroll(document.getDocument());
// formCommentSlide = new Fx.Slide('form_comment2');
});