post-hider.js: further code cleanup; fix displaying on board pages

This commit is contained in:
czaks 2013-06-24 09:05:33 -04:00
parent 0cae0d70b8
commit d134d2ae22

View File

@ -30,20 +30,24 @@ function phPostHandle(element) {
else { element.removeClass("thread-hidden"); pomitted.show(); preplies.show(); pbody.show(); pimage.show(); pbutton.text("[]"); } else { element.removeClass("thread-hidden"); pomitted.show(); preplies.show(); pbody.show(); pimage.show(); pbutton.text("[]"); }
} }
function phHandleThread(index, element) {
// Get thread ID.
var pin = $(this).children("div.post.op").children("p.intro");
var tid = phGetOpID($(this));
if(tid != NaN) {
$("<a href='javascript:;' class='posthider'>[?]</a>").insertAfter(pin.children('a:last')).click(function(e) {
var eO = $(e.target);
var par = eO.parent().parent().parent();
phPostToggle(phGetOpBoard(par), phGetOpID(par));
phPostHandle(par);
return false;
});
phPostHandle($(this));
}
}
$(document).ready(function(){ $(document).ready(function(){
$('form[name="postcontrols"] > div[id^="thread"]').each(function(index, element){ if (active_page != "thread") {
// Get thread ID. $('form[name="postcontrols"] > div[id^="thread"]').each(phHandleThread);
var pin = $(this).children("div.post.op").children("p.intro"); }
var tid = phGetOpID($(this));
if(tid != NaN) {
$("<a href='javascript:;' class='posthider'>[?]</a>").insertAfter(pin.children('a:last')).click(function(e) {
var eO = $(e.target);
var par = eO.parent().parent().parent();
phPostToggle(phGetOpBoard(par), phGetOpID(par));
phPostHandle(par);
return false;
});
phPostHandle($(this));
}
});
}); });