[dw-free] allow AJAX unscreen/freeze of comments that have been expanded
[commit: http://hg.dwscoalition.org/dw-free/rev/fc38e09ec178]
http://bugs.dwscoalition.org/show_bug.cgi?id=2139
Make things automatically work for expanded comments (jQuery beta)
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2139
Make things automatically work for expanded comments (jQuery beta)
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- htdocs/js/jquery.commentmanage.js
- htdocs/js/jquery.threadexpander.js
-------------------------------------------------------------------------------- diff -r 79e083120192 -r fc38e09ec178 htdocs/js/jquery.commentmanage.js --- a/htdocs/js/jquery.commentmanage.js Thu May 12 16:59:21 2011 +0800 +++ b/htdocs/js/jquery.commentmanage.js Thu May 12 17:02:54 2011 +0800 @@ -1,4 +1,23 @@ (function($) { +$.fn.commentmanagesetup = function() { + if ( $.isEmptyObject(window.LJ_cmtinfo) ) return; + this.each(function() { + $('a', this) + .filter("[href^='"+Site.siteroot+"/talkscreen']") + .moderate({ + journal: LJ_cmtinfo.journal, + form_auth: LJ_cmtinfo.form_auth + }) + .end() + .filter("[href^='"+Site.siteroot+"/delcomment']") + .delcomment({ + journal: LJ_cmtinfo.journal, + form_auth: LJ_cmtinfo.form_auth, + cmtinfo: LJ_cmtinfo + }) + }); +}; + $.widget("dw.moderate", { options: { journal: undefined, @@ -255,19 +274,10 @@ })(jQuery); jQuery(function($) { - if ( ! $.isEmptyObject( window.LJ_cmtinfo ) ) { - $('a') - .filter("[href^='"+Site.siteroot+"/talkscreen']") - .moderate({ - journal: LJ_cmtinfo.journal, - form_auth: LJ_cmtinfo.form_auth - }) - .end() - .filter("[href^='"+Site.siteroot+"/delcomment']") - .delcomment({ - journal: LJ_cmtinfo.journal, - form_auth: LJ_cmtinfo.form_auth, - cmtinfo: LJ_cmtinfo - }) - } + $(document).commentmanagesetup(); + $(document.body).delegate("*","updatedcontent.comment", function(e) { + e.stopPropagation(); + $(this).commentmanagesetup(); + }); + }); diff -r 79e083120192 -r fc38e09ec178 htdocs/js/jquery.threadexpander.js --- a/htdocs/js/jquery.threadexpander.js Thu May 12 16:59:21 2011 +0800 +++ b/htdocs/js/jquery.threadexpander.js Thu May 12 17:02:54 2011 +0800 @@ -76,7 +76,8 @@ var oldWidth = getS1SpacerObject(cmtElement).width(); getS1SpacerObject(newComment).width(oldWidth); } - cmtElement.html($(newComment).html()); + cmtElement.html($(newComment).html()) + .trigger( "updatedcontent.comment" ); LJ[cmtId].full = true; if (! isS1) { setFull(cmtElement, true); --------------------------------------------------------------------------------