Skip to content

Instantly share code, notes, and snippets.

@jevakallio
Created April 27, 2017 09:28
Show Gist options
  • Save jevakallio/7d85179b71d354cbd8ff20de320b4ee4 to your computer and use it in GitHub Desktop.
Save jevakallio/7d85179b71d354cbd8ff20de320b4ee4 to your computer and use it in GitHub Desktop.
Tweet Presenter!
// paste this to chrome console on anybody's twitter page
// and it'll turn into an instant presentation :)
(function TweetPresent() {
const presenter = $(`<div id="tpd" style=" position: fixed; top: 0; left: 0; height: 100vh; width: 100vw; padding: 10vh 10vw; box-sizing: border-box; background-color: white; font-size: 5vw; text-align: center; z-index: 9999; display: flex; align-items: center; justify-content: center;"></div>`);
const tweets = $$(`div.tweet p.js-tweet-text`)
.map(el => el.innerHTML)
.map(t => ({t, s: Math.random()}))
.sort((a, b) => a.s > b.s ? -1 : 1)
.map(c => c.t);
$('div#tpd').remove();
$('body').append(presenter);
const present = tweet => presenter.html($('<div />').html(tweet));
presenter.on('click', () => present(tweets.pop()));
present(tweets.pop());
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment