Skip to content

Instantly share code, notes, and snippets.

@cef62
Forked from jevakallio/TweetPresenter.js
Created April 27, 2017 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cef62/b18eba742ab18936543f993ad586b412 to your computer and use it in GitHub Desktop.
Save cef62/b18eba742ab18936543f993ad586b412 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