StackExchange Tweaks

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

Versión del día 14/08/2019. Echa un vistazo a la versión más reciente.

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