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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 208k
  • Answers 208k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The code is doing exactly what you would expect -… May 12, 2026 at 9:31 pm
  • Editorial Team
    Editorial Team added an answer Define the composite key with String series and int userId,… May 12, 2026 at 9:31 pm
  • Editorial Team
    Editorial Team added an answer I think you're looking for this: class Test def initialize… May 12, 2026 at 9:31 pm

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
In order to apply a triggered animation to all ToolTip s in my app,
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.