Skip to content

Instantly share code, notes, and snippets.

@saintjava
Created December 9, 2011 19:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saintjava/1452997 to your computer and use it in GitHub Desktop.
Save saintjava/1452997 to your computer and use it in GitHub Desktop.
Greasemonkey script to make Twitter's dashboard column the right-hand column.
// ==UserScript==
// @name Twitter - Move dashboard to right.
// @namespace com.codebycoffee.greasemonkey
// @description Moves the twitter dashboard to the right, so the timeline is on the left.
// @include https://twitter.com
// @include http://twitter.com
// @include http://twitter.com/*
// @include https://twitter.com/*
// @include http://www.twitter.com/*
// @include https://www.twitter.com/*
// ==/UserScript==
// Checks the DOM and updates styles for the target elements
function gm_reorient(){
try{
var el = document.getElementsByClassName('dashboard')[0];
el.style.cssFloat = "right";
el = document.getElementsByClassName('content-main')[0];
el.style.cssFloat = "left";
// Twitter uses jQuery. Listen for hash changes so we can update the dom
// after a user has changed views.
if (typeof jQuery != 'undefined') {
jQuery(window).bind('hashchange', gm_reorient);
};
} catch(e){
return false;
}
window.removeEventListener('DOMNodeInserted', gm_reorient);
return true;
}
// Try right away.
// Some pages load the dom late so the first attempt may fail.
// Listen for changes in the dom and continue to try until success.
if (!gm_reorient()) window.addEventListener('DOMNodeInserted', gm_reorient, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment