HabrSanitizer icon indicating copy to clipboard operation
HabrSanitizer copied to clipboard

"MegaPost" not blocked

Open Drag13 opened this issue 4 years ago • 1 comments

If post is mega-post - it will not be blocked

image

See

$('.post .preview-data__head a')[0].href

Drag13 avatar Dec 25 '20 10:12 Drag13

  • Switch from article to .post selectors

visibleArticle: article:not(.${hiddenArticleClassName}),

Rework the check method:

function belongsToBlog(article, blogName) {
        if (article == null) {
            return false;
        }

        const href = article.querySelector(selectors.company)?.href?.toLowerCase() ?? '';
        const megaPostHref = article.querySelector(selectors.mega_post)?.href?.toLowerCase() ?? '';

        return [href, megaPostHref].some(
            (link) => link.endsWith(`/company/${blogName}/`) || link.endsWith(`/company/${blogName}`)
        );
    }

Drag13 avatar Mar 08 '21 11:03 Drag13