melvinsalas

Disabling Bear's upvote-button

I've noticed that some people are obsessed with the vote button on Bearblog; some love it, while others hate it. Personally, I don't mind it.

However, I was curious about how it works and if it can be disabled, so I looked into it without success in the options. It seems to be somewhat embedded in the system, so we need to find another way to disable it.

The typical method is to hide it, but that doesn't prevent some playful soul from clicking it. So, I found another solution:

<script>
document.addEventListener("DOMContentLoaded", () => {
  const remove = () =>
    document.querySelectorAll('[class*="upvote-button"],[id*="upvote-button"],upvote-button')
      .forEach(el => el.remove());

  remove();
  if (window.upvoteButton) window.upvoteButton = () => false;

  new MutationObserver(remove).observe(document.body, { childList: true, subtree: true });
});
</script>

This script consists of foursteps:

  1. Wait for the web page to load
  2. Remove all elements named upvote-button
  3. Disable the functions that allow clicking
  4. Prevent new ones from being created dynamically

The best place to put this is in Settings > Directives; it doesn't matter which one you choose.

That's it! I hope this helps!

#2025