Last active
October 14, 2016 18:18
-
-
Save fortserious/a7b0ab0b69f426150127 to your computer and use it in GitHub Desktop.
userscript: replace moments tab with me tab
This file contains hidden or 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 me tab | |
// @namespace www.rossdoran.com | |
// @version 0.5 | |
// @description me | |
// @match https://twitter.com/* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// @copyright ross doran 2015 | |
// ==/UserScript== | |
// "A life, Jimmy, you know what that is? It's the shit that happens while you're waiting for moments that never come." -- Lester Freamon | |
function killMoments() | |
{ | |
// Add me icon, remove lightning icon, change href of the parent to link to the name of the current user (located in the current-user li class, as the href of its first child), then sets the Icon's sibling span text to say "Me" | |
$(".Icon--lightning").addClass("Icon--me").removeClass("Icon--lightning").parent().attr("href","/" + $(".current-user").children().first().attr("href").substring(1)) | |
// Swap positions back | |
$(".Icon--notifications").parent().parent().remove().insertBefore(".js-moments-tab") | |
} | |
waitForKeyElements (".Icon--lightning", killMoments); | |
waitForKeyElements ("li.moments span.text", function() { $("li.moments span.text").text("Me") }); |
V1.5: Updated to swap positions back to correct the position-switching trick twitter did so people would actually click on the moments tabs
V whatever it doesn't matter: Changed text-switching line to its own function because twitter loads this after the icons so it wasn't getting changed in the first go
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
V1: Updated to properly utilize Jquery and update nomenclature from "Discover" to "Moments"