Committer: dpetrov
LJSUP-6869: send thread depth with every request; updated comments in thread_expander.ex.jsU trunk/htdocs/js/commentmanage.js U trunk/htdocs/js/thread_expander.ex.js
Modified: trunk/htdocs/js/commentmanage.js =================================================================== --- trunk/htdocs/js/commentmanage.js 2010-10-14 01:51:01 UTC (rev 17560) +++ trunk/htdocs/js/commentmanage.js 2010-10-14 03:43:04 UTC (rev 17561) @@ -186,13 +186,13 @@ function removeComment (ditemid, killChildren, isS1) { if(isS1){ - var threadId = dItemid; + var threadId = ditemid; getThreadJSON(threadId, function(result) { for( var i = 0; i < result.length; ++i ){ - if( LJ_cmtinfo[ result[i].thread ].full ){ - jQuery("#ljcmtxt" + result[i].thread).html( result[i].html ); - } + jQuery("#ljcmtxt" + result[i].thread).html( result[i].html ); + if( result[i].thread in ExpanderEx.Collection) + ExpanderEx.Collection[ result[i].thread ] = result[i].html; } }); } @@ -557,7 +557,8 @@ params = [ 'journal=' + Site.currentJournal, 'itemid=' + postid, - 'thread=' + threadId + 'thread=' + threadId, + 'depth=' + LJ_cmtinfo[ threadId ].depth ]; if( getSingle) params.push( 'single=1' ); Modified: trunk/htdocs/js/thread_expander.ex.js =================================================================== --- trunk/htdocs/js/thread_expander.ex.js 2010-10-14 01:51:01 UTC (rev 17560) +++ trunk/htdocs/js/thread_expander.ex.js 2010-10-14 03:43:04 UTC (rev 17561) @@ -1,3 +1,8 @@ +/* + * ExpanderEx object is used in s1 style comment pages and provides + * ajax functionality to expand comments instead of loading iframe page as it is + * in old Expander + */ ExpanderEx = function(){ this.__caller__; // <a> HTML element from where ExpanderEx was called this.url; // full url of thread to be expanded @@ -91,30 +96,8 @@ var children = LJ_cmtinfo[ threadId ].rc; for( var i = 0; i < children.length; ++i ) this.collapseThread( children[ i ] ); - - //do not call the code, because we do not know folding logic in all cases - //this.updateParentState(); } -ExpanderEx.prototype.updateParentState = function() -{ - //if all children were collapsed manually, then we have to change parent - //comment state to collapsed - var parentId = LJ_cmtinfo[ this.id ].parent; - if(!parentId) - return; - - var allCollapsed = true, - children = LJ_cmtinfo[ parentId ].rc; - for( var i = 0; i < children.length; ++i ) - if( LJ_cmtinfo[ children[ i ] ].expanded == 1 ){ - allCollapsed = false; - break; - } - - allCollapsed && this.collapseBlock( parentId ); -} - ExpanderEx.prototype.collapseBlock = function( id ) { var expander = this; @@ -172,6 +155,8 @@ return true; } +//toggle visibility of expand and collapse links, if server returns +//html with both of them ( with every ajax request) ExpanderEx.prepareCommentBlock = function(html, id, showExpand){ var block = jQuery("<div>" + html + "</div>"), selector = '';