Skip to content

Instantly share code, notes, and snippets.

@solidgoldpig
Last active July 28, 2022 09:42
Show Gist options
  • Save solidgoldpig/c6b3e49ae18288ab7abff28e59d18aac to your computer and use it in GitHub Desktop.
Save solidgoldpig/c6b3e49ae18288ab7abff28e59d18aac to your computer and use it in GitHub Desktop.
Make Twitter more bearable
// ==UserScript==
// @name Solidgoldpig Twitter
// @namespace http://solidgoldpig.com/tampermonkey/twitter
// @version 0.1
// @description Make Twitter more bearable
// @author tampermonkey@alex.solidgoldpig.com
// @match https://twitter.com/*
// @grant none
// ==/UserScript==
/* jshint ignore:start */
// data-testid="tweet"
(function () {
'use strict'
const siteCSS = `
body {
background: #ffffff !important;
}
.home-stream > .stream-items {
padding-bottom: 90vh !important;
min-height: 90vh !important;
}
[Xdata-testid="sidebarColumn"],
h2[aria-level="2"][role="heading"],
h2[aria-level="2"][role="heading"] + *,
section[aria-labelledby="accessible-list-2"][role="region"],
[aria-labelledby="accessible-list-3"],
[data-testid="UserCell"],
[data-testid="placementTracking"],
a[href~="/i/connect_people"],
a[href^="/i/"],
.promoted-tweet,
.wtf-module,
.trends,
.Footer {
display: none !important;
}
.stream-loading,
.stream-items.loading .stream-item,
.seen {
display: none !important;
}
`
const siteStyleSheet = document.createElement('style')
const siteStyleContent = document.createTextNode(siteCSS)
siteStyleSheet.appendChild(siteStyleContent)
document.querySelector('head').appendChild(siteStyleSheet)
console.log('RUNNING TWITTER TAMPERMONKEY SCRIPT');
// let jQuery
// window.addEventListener('load', () => {
// jQuery = window.jQuery
// }, false)
// window.hideTweets = function hideTweets() {
// jQuery('.js-stream-item').not('.seen').addClass('seen')
// }
// window.showTweets = function showTweets() {
// jQuery('.js-stream-item.seen').removeClass('seen')
// }
// window.reverseTweets = function reverseTweets() {
// const unseen = jQuery('.js-stream-item').not('.seen')
// const listdad = unseen.parent()
// listdad.prepend(unseen.get().reverse())
// }
// window.updateTweets = function updateTweets() {
// jQuery('.new-tweets-bar').trigger('click')
// }
window.updateTweetsAndReverse = function updateTweetsAndReverse() {
console.log('Upodating!')
// jQuery(document).scrollTop(0)
// window.hideTweets()
// jQuery('.stream-items').addClass('loading')
// window.updateTweets()
// setTimeout(function () {
// window.reverseTweets()
// jQuery('.stream-items').removeClass('loading')
// window.updateDockBadge()
// }, 1000)
}
// window.fluid.dockBadge = '';
// setTimeout(updateDockBadge, 1000);
// setInterval(updateDockBadge, 5000);
// window.updateDockBadge = function updateDockBadge() {
// return
// // if (!window.jQuery) { return; }
// // var items = 0; //jQuery('.js-stream-item').not('.seen').length || 0;
// // var unloadeditems = jQuery('.new-tweets-bar').attr('data-item-count');
// // if (unloadeditems) {
// // items += Number(unloadeditems);
// // }
// // items = items || '';
// // if (window.fluid.dockBadge !== items) {
// // window.fluid.dockBadge = items;
// // }
// }
if (window.Shortcut) {
window.Shortcut.add("Meta+Shift+u", window.updateTweetsAndReverse)
}
})()
@solidgoldpig
Copy link
Author

It used to

  • hide bits of the interface I didn't want to see
  • reverse the order of the tweets
  • hide tweets I'd seen

But now, next to nothing any more. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment