6

See the updates in the answer below; also check out the commit history for additional changes.

About

The new widgets can clutter the homepage for those of us who are not interested in them.

I created a simple script that hides the widgets. Although I could not find a good way to restore it to its original look, I think this is much better (Thanks to @VLAZ for their help).

I am looking forward to any suggestions to make this better.

Installation (updated version based on my answer)

Click to install with a script manager. N.B. I have only tested this with Tampermonkey on Firefox.

Repository

Here is the source code for this userscript; source code repo

2
  • Happy coincidence or not, I like that it also removes the "interesting posts for you" header, as we all know that the word "interesting" is grossly wrong. Alternatively, if it could change the word "interesting" to "irrelevant" that might make it accurate.
    – Thom A
    Commented Oct 31 at 15:03
  • @ThomA not a coincidence. I could also remove the "Welcome back" message, but not without taking away the Ask question button, which now thinking about it, maybe it's a sacrifice worth making. p.s. playing with this idea to make something better, maybe...
    – M--
    Commented Oct 31 at 15:06

1 Answer 1

3

I modified canon's answer on the MSO post and made a little more functional script than what I have above:

  • This hides the widgets...
  • but keeps the watched tags widget (without removing any other elements such as blog posts).
  • Replaces the welcome message with the "suggested posts...",
  • without removing "Ask Question" button.

// ==UserScript==
// @name Hide Homepage Widgets
// @namespace https://github.com/MdoubleDash
// @version 2.0
// @description Removes the new widgets on Stack Overflow's homepage
// @author @canon, MDoubleDash (@M--)
// @contributor @VLAZ
// @match https://stackoverflow.com/
// @downloadURL https://github.com/MdoubleDash/SOS_Userscripts/raw/main/Hide%20Homepage%20Widgets.user.js
// @updateURL https://github.com/MdoubleDash/SOS_Userscripts/raw/main/Hide%20Homepage%20Widgets.user.js
// @grant none
// ==/UserScript==

// (https://meta.stackoverflow.com/a/432018)
(function() {
  const widgetsContainer = document.getElementById("widgets-container");
  const blogWidget = document.querySelector('.s-sidebarwidget:has(a[href^="https://stackoverflow.blog/"]');
  const welcomeMessage = document.querySelector('.d-flex.g8');
  const postsMessage = document.querySelector('.d-flex.fd-column.mb16');

  if (!(widgetsContainer)) return;
  const [tagModal,tagWidget] = widgetsContainer.querySelectorAll(".widgets>:nth-child(n+4)");
  const [tagHeader,tagContent] = tagWidget.children;

  blogWidget.before(tagModal, tagWidget);
  widgetsContainer.remove();

  $('.d-flex.fd-column.mb16').find(".fs-title.fw-bold").text("Suggested posts for you");
  postsMessage.remove();
  welcomeMessage.before(postsMessage);
  welcomeMessage.remove();


  // fix display by borrowing class salad from adjacent sidebar widget...
  tagWidget.className = "s-sidebarwidget s-anchors s-anchors__grayscale mb16";
  tagHeader.className = "d-flex fc-black-600 pt16 pl16 fs-body2 fw-bold";
  tagContent.className = "s-sidebarwidget--item d-flex px16";
})();

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .