Skip to content

Instantly share code, notes, and snippets.

@ceneon
Created July 14, 2011 05:44
Show Gist options
  • Save ceneon/1081999 to your computer and use it in GitHub Desktop.
Save ceneon/1081999 to your computer and use it in GitHub Desktop.
Fix Gmail "Preview" Theme with "Chat in Right Column" Lab.
// Styles needed to fix layout
.pp{ margin-left: 0px !important; margin-right:0px !important;}
.q0CeU{ margin-right:0px !important}
// Execute this in the inspector window or the address bar, or bookmark it if you can
javascript:i=document.getElementById("canvas_frame").contentWindow.document;j=i.getElementsByClassName("T0 pp");for(k=0;k<j.length;k++)if(j.item(k).getElementsByClassName("pw").item(0).innerHTML=="Chat")j.item(k).style.margin='0';i.getElementsByClassName("nH q0CeU z").item(0).style.marginRight='0';void 0
@deeptoaster
Copy link

i = document.getElementById('canvas_frame').contentWindow.document.getElementsByClassName('T0 pp'); for (j = 0; j < i.length; j ++) if (i.item(j).getElementsByClassName('pw').item(0).innerHTML == 'Chat') i.item(j).style.marginLeft = '0';

There we go.

@ceneon
Copy link
Author

ceneon commented Aug 9, 2011

The last one fixes it a little for me.. but there is still some right margin in the mail list.

This works for me (your code + my code):

i = document.getElementById('canvas_frame').contentWindow.document.getElementsByClassName('T0 pp'); for (j = 0; j < i.length; j ++) if (i.item(j).getElementsByClassName('pw').item(0).innerHTML == 'Chat') i.item(j).style.marginLeft = '0';
document.getElementById('canvas_frame').contentWindow.document.getElementsByClassName("nH q0CeU z")[0].style.marginRight="0";

It's really weird trying to fix Gmail...

@deeptoaster
Copy link

Done. Tell people to bookmark this:

javascript:i=document.getElementById("canvas_frame").contentWindow.document;j=i.getElementsByClassName("T0 pp");for(k=0;k<j.length;k++)if(j.item(k).getElementsByClassName("pw").item(0).innerHTML=="Chat")j.item(k).style.margin='0';i.getElementsByClassName("nH q0CeU z").item(0).style.marginRight='0';void 0

Personally I actually don't mind the margin-right in the message list, though.

@deeptoaster
Copy link

No need anymore. It's been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment