Admin Forum:JS code to lock old blogs

I'd like to know if there's a way I can tweak this code to lock only blogs sorted in a given category:


 * by: Joey Ahmadi

$(function { if (wgNamespaceNumber == 500 && $('#article-comments-ul li').size > 1) { var then = $('#article-comments-ul > .SpeechBubble:first .permalink').attr('href'); then = new String(then.match(/\d{8}/)); var monthnames = ['January','February','March','April','May','June','July', 'August','September','October','November','December']; var year = then.match(/^\d{4}/); var month = then.substring(4,6); month--; month= monthnames[month]; var day = then.match(/\d{2}$/); then = new Date(month+''+day+', '+year); var old = parseInt(now - then); old = Math.floor(old/(1000*60*60*24)); if (old > 30) { $('#article-comm').attr('disabled','disabled').text('This blog post hasn\'t been commented on for over 30 days. There is no need to comment.'); $('#article-comm-submit').attr('disabled','disabled'); $('.article-comm-reply').remove; } } });

For example, only blogs categorized in "Blog posts". ―  T hailog  14:37, March 2, 2012 (UTC)


 * Looks like you would only have to modify the if-clause that contains everything else:


 * Pecoes 15:54, March 2, 2012 (UTC)

Hmm, it still locks [http://youngjustice.wikia.com/wiki/User_blog:Summer.bradshaw/My_thoughts_on_Targets:_Beware_spoilers! blogs] not categorized there... Am I doing something wrong? ―  T hailog  17:56, March 2, 2012 (UTC)


 * Maybe. Are you sure you've added the new bit in the right place? -- Pecoes 18:31, March 2, 2012 (UTC)


 * I thought the { /* ... */ } bit was supposed to stay. Fail. It works now, thanks! What if I want to add more categories? Will  work? ―  T  hailog  20:13, March 2, 2012 (UTC)


 * I was afraid you'd ask me that. That's slightly more complicated.


 * Try this:


 * Nope. :( ―  T hailog  21:12, March 2, 2012 (UTC)