Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 433759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:12:21+00:00 2026-05-12T20:12:21+00:00

I’m on my way to creating a greasemonkey script for gmail. The first thing

  • 0

I’m on my way to creating a greasemonkey script for gmail.

The first thing I want to play with is reducing the size of ‘main’ pane. This is where either the list of emails are or where the email message is being displayed.

Using Firebug, I can find two separate instances of a <div class="nH nn" style="width: 1013px;"> tag. One changes the width of the background of the relevant pane, the other changes the width of the messages contained in the pane. Using Firebug I can change the width values in each of these tags to have the middle pane take up half the available space, for example.

How should I do this using Greasemonkey?
Is the gmailAPI the way to go?
The GmailGreasemonkeyApi wiki doesn’t give much description for each method. Would gmail.getMastheadElement() maybe be it?

Or would more of a standard DOM transverse approach be better than dealing with the API? If so, I’m not sure how to target those particular divs. They’re only using the classes “nH nn” for identification, which seem to be reused multiple times throughout the gmail code.

Thanks.

UPDATE:
Wish we could put code in replies to answers… here’s the thing that I’m trying. Where is this going wrong?

window.addEventListener('load', function() {
  if (unsafeWindow.gmonkey) {
    unsafeWindow.gmonkey.load('1.0', function(gmail) {

      gmail.getActiveViewElement().style.width = "500px";

    });
  }
}, true);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T20:12:22+00:00Added an answer on May 12, 2026 at 8:12 pm

    gmail greasemonkey api is the way to go.

    gmail.getActiveViewElement (along with gmail.getActiveViewType) seems to be what you are looking for.

    Edit: Responding to your comment – I have never tried this before but I typed the following in my firebug console (when gmail was open and gm enabled) and it worked perfectly (reduced the width of the conversations view).

    gmonkey.load("1.0", function() { 
        var gmail = gmonkey.get("1.0");
        gmail.getActiveViewElement().style.width = "500px";
    });
    

    Also, you can visually inspect what element is returned by the functions if you console.log the element. When you hover over the result in console, Firebug highlights it in the html document.

    Edit 2 : The following worked for me.

    window.addEventListener('load', function() {
      if (unsafeWindow.gmonkey) {
        unsafeWindow.gmonkey.load('1.0', function(gmail) {
          setTimeout(function() {gmail.getActiveViewElement().style.width = "500px";},0);
        });
      }
    }, true);
    

    Now I have no idea why a setTimeout helps here. Maybe gmail does a lot of its own dom manipulation stuff on window.load burying your change. Here’s a related SO discussion on that!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.