StackExchange Tweaks

Minor visual tweaks to StackExchange (remove the new sidebar from Q/A pages, for classic look)

As of 2019-08-21. See the latest version.

  1. // ==UserScript==
  2. // @name StackExchange Tweaks
  3. // @namespace SET
  4. // @description Minor visual tweaks to StackExchange (remove the new sidebar from Q/A pages, for classic look)
  5. // @version 1.0.13
  6. // @license MIT
  7. // @include https://stackoverflow.com/*
  8. // @include https://superuser.com/*
  9. // @include https://serverfault.com/*
  10. // @include https://*.stackexchange.com/*
  11. // @include https://askubuntu.com/*
  12. // @include https://mathoverflow.net/*
  13. // @grant GM_addStyle
  14. // ==/UserScript==
  15.  
  16. // ==Options==
  17.  
  18. // Swap the positions of the notifications block and the username/stats block
  19. // in the header
  20. //
  21. // This pushes the user profile off towards the corner, and brings the action
  22. // buttons closer to the center
  23. //
  24. var swapProfileAndButtons = true;
  25.  
  26. // Hide the 2018 sidebar when we are on question pages (reduces visual noise)
  27. //
  28. var hideSidebarOnQuestionPages = true;
  29.  
  30. // If you don't like things to be 3D when they don't need to be
  31. //
  32. var noShadows = true;
  33.  
  34. // Lighten the new stats above the question, if you find them distracting
  35. //
  36. var deemphasiseStats = true;
  37.  
  38. // ==/Options==
  39.  
  40. if (swapProfileAndButtons) {
  41. //var secondaryNav = document.querySelector('.secondary-nav')
  42. //secondaryNav.parentNode.insertBefore(secondaryNav, secondaryNav.parentNode.firstChild)
  43. var profileElementInner = document.querySelector('.my-profile');
  44. if (profileElementInner) {
  45. var profileElementContainer = profileElementInner.parentNode;
  46. profileElementContainer.parentNode.appendChild(profileElementContainer);
  47. } else {
  48. console.warn("Could not find .my-profile element");
  49. }
  50. }
  51.  
  52. if (hideSidebarOnQuestionPages) {
  53. if (document.location.pathname.match(/^\/(q|questions)\//)) {
  54. GM_addStyle('#left-sidebar { display: none; }');
  55. if (document.location.hostname.match(/^(stackoverflow.com|(politics|physics|earthscience).stackexchange.com)$/)) {
  56. GM_addStyle('#content { border-left: none; }');
  57. }
  58. }
  59. }
  60.  
  61. if (noShadows) {
  62. // The "Featured on Meta" box on the right, above "Related" and "Hot Network Questions"
  63. GM_addStyle('.s-sidebarwidget { box-shadow: none; }');
  64. }
  65.  
  66. if (deemphasiseStats) {
  67. // There isn't a clear ID or class for the stats, so I used this monstrosity
  68. GM_addStyle('#question-header + .grid.fw-wrap.bb { opacity: 0.7; font-size: 0.9em; }');
  69. }