Don't mess with my "use subreddit style" toggle (Old Reddit/RES required)

This script always shows RES' "use subreddit style" checkbox in the right of the logout link even if the sub intentionally hides it from the side bar (need RES extension installed)

  1. // ==UserScript==
  2. // @name Don't mess with my "use subreddit style" toggle (Old Reddit/RES required)
  3. // @author warireku
  4. // @description This script always shows RES' "use subreddit style" checkbox in the right of the logout link even if the sub intentionally hides it from the side bar (need RES extension installed)
  5. // @include https://old.reddit.com/r/*
  6. // @license CC0 1.0 Universal (No Rights Reserved)
  7. // @version 0.1
  8. // @grant none
  9. // @namespace https://greasyfork.org/users/237709
  10. // ==/UserScript==
  11.  
  12. //runs when page is fully loaded
  13. window.addEventListener('load', function() {
  14. var styleBox = document.getElementById("res-style-checkbox");
  15. //if the res element exists
  16. if(styleBox !== null){
  17. styleBox.style.cssText = "display:inline !important; visibility: visible !important";
  18.  
  19. var styleForm = document.getElementsByClassName("res-sr-style-toggle");
  20. var separator = document.getElementsByClassName("separator")[0];
  21. separator.innerHTML = "|";
  22. for(var i=0;i<styleForm.length;i++){
  23. styleForm[i].style.cssText = "display:contents !important; visibility: visible !important; position:absolute !important;";
  24. document.getElementById("header-bottom-right").appendChild(separator);
  25. document.getElementById("header-bottom-right").appendChild(styleForm[i]);
  26. }
  27. }
  28. }, false);