Thursday, March 3, 2016

How to remove the Moments tab from Twitter

Twitter recently added the "Moments" tab to its header, causing other tabs to shift position.  Some users like the Moments tab, while others want to get rid of it.  With a couple of clicks, you can easily hide the Moments tab when you're using Twitter through your web browser.  (It won't work for the Twitter app, however.)

The JavaScript code below will remove the Moments tab from your Twitter header, transforming this:



into this:




You can save the JavaScript function as a bookmark and call it whatever you want -- deMoment, MomentKiller, JavaScript Twitter Moment Tab Removal Tool, etc. -- and when you log into Twitter, just click the bookmark once to hide the Moments tab.

Here's the code:

javascript: (function(){document.getElementsByClassName('moments')[0].style.display='none';})();

Saving it into a bookmark is easy.  In most browsers, you can just highlight the code and then drag and drop it onto the bookmarks bar.  (You can rename it once the bookmark is saved.)

When you run this function, the Moments tab will be removed from your Twitter header.  If you refresh the page, log out of Twitter and log back in, or click on certain Twitter links (such as Lists) the Moments tab will reappear.  If that happens, simply click the bookmark again to remove it.  As long as you stay on the "main" Twitter page -- including searching Twitter, sending or reading tweets, adding followers, and reading direct messages -- the Moments tab will remain gone.

This piece of JavaScript isn't like a plugin or browser extension; it doesn't continually run, so it won't affect your browser's performance in the least.  Each time you click the bookmark button, the code executes one time and ends.

UPDATE: This code is now available (in altered form) as the Chrome browser extension Mention It.  This extension removes the Moments tab from Twitter, and replaces it with a Mentions tab.  The extension runs automatically, so you don't have to click on it like you would with the bookmarklet described above.

No comments:

Post a Comment