(function($) {
    $(document.body).ready(function () {
        if($(".postcontent").html()) {
            $(".postcontent").each(function () {
                var filtered = filterText($(this).html());
                $(this).html(filtered);
            });
        }
        if($(".threadmeta").html()) {
            $(".threadmeta").each(function () {
                var filtered = filterText($(this).html());
                $(this).html(filtered);
            });
        }
        if($("div.threadinfo").html()) {
            $("div.threadinfo").each(function () {
                var filtered = filterText($(this).attr("title"));
                $(this).attr("title",filtered);
            });
        }
    });
})(jQuery)

function filterText(sText) {
    var reBadWords = /fuck|nigger|\basshole\b|bitch|\btwat\b|\bbullshit\b|\bshithead\b|\bshit\b|cunt|\bfag\b|\bfaggot\b|\bqueer\b|\bpussy\b|\bpussies\b|\bcock\b/gi;
    return sText.replace(reBadWords, function (sMatch) {
        return sMatch.replace(/./g, "*");
    });
}
