Skip to content

Instantly share code, notes, and snippets.

@mdusher
Created July 15, 2016 01:13
Show Gist options
  • Save mdusher/1ceaf49c6af86f03505079b5ea6a04c1 to your computer and use it in GitHub Desktop.
Save mdusher/1ceaf49c6af86f03505079b5ea6a04c1 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name NewTweetClicker
// @version 0.1
// @description Clicks the new tweet bar automatically
// @author Michael Usher
// @match https://www.twitter.com/*
// @match https://twitter.com/*
// @grant none
// ==/UserScript==
/* jshint -W097 */
'use strict';
var $ = window.jQuery;
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
$(document).ready(function(){
var obs = new MutationObserver (clickNewTweetHandler);
var obsConfig = { childList: true, characterData: true, attributes: true, subtree: true };
var obsRoot = $('.stream-container');
obsRoot.each(function() { obs.observe(this, obsConfig); });
function clickNewTweetHandler(m) {
if ($('.new-tweets-bar').length > 0) { $('.new-tweets-bar').click() ; }
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment