Auto-downvote Medium.com on Reddit

Automatically downvotes all seen Medium articles

  1. // ==UserScript==
  2. // @name Auto-downvote Medium.com on Reddit
  3. // @description Automatically downvotes all seen Medium articles
  4. // @lastupdated 2020-10-08
  5. // @version 1.0.1
  6. // @namespace skeeto
  7. // @license Public Domain
  8. // @include https://old.reddit.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. const BANNED = new Set([
  13. 'blog.softwaremill.com',
  14. 'freecodecamp.org',
  15. 'medium.com',
  16. 'thenextweb.com'
  17. ])
  18.  
  19. function banned(domain) {
  20. return BANNED.has(domain) ||
  21. /\.medium\.com$/.exec(domain) ||
  22. /^medium\./.exec(domain);
  23. }
  24.  
  25. for (let link of document.querySelectorAll('.thing.link')) {
  26. let domain = link.querySelector('.domain > a').textContent
  27. if (banned(domain)) {
  28. let downvote = link.querySelector('.down')
  29. if (downvote) {
  30. setTimeout(function() {
  31. downvote.click()
  32. }, 250)
  33. }
  34. }
  35. }