soup.io: Display hidden elements

Shows hidden reactions, reposts, icons and dates on soup.io pages

  1. // ==UserScript==
  2. // @name soup.io: Display hidden elements
  3. // @namespace http://xcvbnm.org/
  4. // @author Nordern
  5. // @description Shows hidden reactions, reposts, icons and dates on soup.io pages
  6. // @version 4.1
  7. // @match http://*.soup.io/*
  8. // @match https://*.soup.io/*
  9. // @license public domain
  10. // ==/UserScript==
  11. /*
  12. * Available on github under: https://github.com/edave64/souplements/blob/master/showHiddenElements.js
  13. * Using the infinite scrolling support template: https://github.com/edave64/souplements/blob/master/infiniteScrollingTemplate.js
  14. */
  15. (function () {
  16. function customCode () {
  17. [].forEach.call(
  18. document.querySelectorAll('.hide-reposted-by,.icons.hidden,.date.hidden,.hide-tags'),
  19. function (ele) {
  20. ele.classList.remove('hide-reposted-by');
  21. ele.classList.remove('hide-tags');
  22. ele.classList.remove('hidden');
  23. }
  24. );
  25. }
  26.  
  27. // Reduces calls to customCode by limiting it to execute once per javascript activity and stops it from calling
  28. // itself.
  29. var _runner = null;
  30. function runDelayed () {
  31. if (_runner === null) {
  32. _runner = setTimeout(function () {
  33. try {
  34. customCode();
  35. } finally {
  36. _runner = null;
  37. }
  38. }, 0);
  39. }
  40. }
  41. function register () {
  42. customCode();
  43. new MutationObserver(runDelayed).observe(
  44. document.getElementById('contentcontainer'), {
  45. childList: true,
  46. subtree: true
  47. }
  48. );
  49. }
  50. // Is the soup page already loaded? This allows the custom code to run as both a bookmarklet and a userscript.
  51. if (document.getElementById('contentcontainer')) {
  52. register();
  53. } else {
  54. document.addEventListener("load", register);
  55. }
  56. }());