Created
February 13, 2016 15:08
-
-
Save liveweird/77e86fcc6fabf3c05924 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Twitter Helper | |
// @namespace http://gebski.tech/ | |
// @version 0.1 | |
// @description Makes Twitter more approachable | |
// @author http://gebski.tech/ | |
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser-polyfill.min.js | |
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser.min.js | |
// @require https://code.jquery.com/jquery-latest.js | |
// @match https://twitter.com/ | |
// ==/UserScript== | |
/* jshint ignore:start */ | |
var inline_src = (<><![CDATA[ | |
/* jshint ignore:end */ | |
/* jshint esnext:true */ | |
$.fn.goTo = function() { | |
// $(this).scrollIntoView(); | |
$('html, body').animate({ | |
scrollTop: $(this).offset().top + 'px' | |
}, 'fast'); | |
return this; | |
} | |
var magic = $("<button id=\"magic-button-id\">Magic</button>"); | |
magic.css({"position": "absolute", "top": "30px", "left": "20px", "z-index": 100}); | |
magic.click(function () { | |
// mark element | |
var top_item_id = $("#stream-items-id li.stream-item").first().attr("id"); | |
var top_item = $("#" + top_item_id); | |
top_item.css({"background-color": "red"}); | |
// refresh twitter | |
var refresh = $("div.new-tweets-bar"); | |
if(typeof refresh ==='object' && refresh instanceof Array && !refresh.length) { | |
return; | |
} | |
refresh.click(); | |
// jump to marked | |
top_item.goTo(); | |
}); | |
var dashboard = $("div#doc"); | |
dashboard.children().prepend(magic); | |
/* jshint ignore:start */ | |
]]></>).toString(); | |
var c = babel.transform(inline_src); | |
eval(c.code); | |
/* jshint ignore:end */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment