Gmail - Hide Selected Label

By jmerz Last update Nov 25, 2009 — Installed 409 times.

Works, but then fails when new messages arrive

in
Subscribe to Works, but then fails when new messages arrive 8 posts, 3 voices



H S User

Hi JMerz,

First up thanks for the script - its a daft annoyance that's been stuck in and I was hoping a labs feature would resolve it but no such luck so far....

Secondly theres a bit of a problem in that the script does initially clear the extra label link in the thread view for the currently viewed label, but when a new message comes in it 'unloads' and fails to remove it. Is there a way to maintain it when new message comes in?

Thanks!

 
jmerz Script's Author

Hi HS, Glad to hear that it comes in handy and sorry to hear that it's not entirely working. I'm afraid I'm not immediately sure of a solution, since the labels actually do stay gone upon receiving new emails for me. I've got a couple of rather broad ideas that could explain the what's going on, though it may take a little playing around to fix it. Basically, GMail redraws the thread pane at least mostly from scratch upon receiving a new mail, and with that redrawing, the labels return. I added an event listener (on DOMSubtreeModified) to watch for changes to the page centered more-or-less on the thread pane, and I re-hide the newly re-created labels when a change is seen.

As for why you see a problem and I don't, at least for major changes in the past (the new interface a while back for instance) Google seems to roll out changes to users gradually rather than everybody all at once, so they may be making a change and you've gotten it before I have. I rather hope that's the case since it'll make it easier to debug if I can make the problem happen in my browser :)

Another related possibility is that in the latest version of the script, I tried to reduce the scope of that event listener to catch fewer unrelated page changes assuming that the internal structure of the GMail web page varies, I may have gone in too close and be missing the events for you. If you'd like to try the older script that will catch more page changes, you can do the following:
  1. Click on the "Source Code" link right under the title of the script on userscripts.org.
  2. Click on the link for "previous versions" of the script above the source listing.
  3. Install the version dated Feb 12, 2009 22:13.
If that works for you, please let me know and I'll change the current version to have the slightly wider view. Another thought occurs to me - if you don't mind saying, could you tell me what if any GMail labs features you are using? It's possible that if you are using one that I am not, or if I am using one that you are not, that changes the page a bit. If that's the case, I could definitely toggle some labs features to match what you're running and hopefully figure out how to catch the label redraws. Another thought that occurs to me -
 
H S User

Hi jmerz,
I tried installing the previous two versions listed, and then CTRL+refreshing the gmail window to load them. However neither older version seems to work with mine at all... the label stays intact. I've gone back to the latest one, and at least if i hit refresh it removes the label! It may be that the name of the event to subscibe to has changed with the new version - is there a way i can check?
Thanks
H

 
jmerz Script's Author

Sorry for the slow reply - I was just out of town over the weekend. I just posted an update based on some recent changes to the GMail structure again. I had noticed that on occasion, the script would run before GMail had fully loaded the GreaseMonkey API that GMail provides and which I use, and that caused things not to work - sometimes I would have to reload the page a few times to get everything loaded. My recent change appears to have solved this for me, but I suspect the timing of it all may have something to do with either how fast the computer parses the javascript, or just how fast it comes down the line, so I'd be interested to hear some more data points as to whether the delay solves it for everyone. I may make it configurable in the future if that seems like it would be helpful.

Back to the original problem then... Assuming that the latest script does at least put you back to where you were on Feb 23 - with labels initially disappearing, but then reappearing when a new message comes in, could you check the FireFox Error console to see if there are any errors that may be related to the script, especially after a new message arrives and the labels reappear. Any error message should probably make reference to the script itself, or possibly to GreaseMonkey. And do be sure to remove any personally identifiable information from any error message before you post.

Regarding how to go about looking into this in more detail, there are a couple of things we could do. First, if you are familiar with the DOM Inspector in Firefox, I'd have you take a look at the message list and labels in there to see if there is anything different in your GMail page structure from mine. Also, I could put up a version that would log some debugging messages to the error console to try and see what happens when the labels reappear.

I'm going to be a bit busy in the next week, so I apologize in advance if I respond slowly, but I do hope we can figure out what is going on and get the script working correctly. I expect I will be able to respond more quickly by next week at least.
 
jmerz Script's Author

Hi again H,

I just came up with another question for you: What version of Firefox are you using? I ask because I was just looking over some DOM event information and found that the DOMSubtreeModified event that I'm using to catch when GMail updates the message list only became available in Firefox 3.0, so if you are using some version of FF 2.x, that would be a possible explanation of why the labels initially disappear, but then reappear when a new message arrives.

 
mod_wastrel User

I just installed (again--I tried an early version shortly after you first posted it... didn't work (of course, Gmail was still "rolling out" its new code at the time)), and it seems to be working fine right now--gets rid of the "custom" labels ('cept for that little 'dot', which is OK by me), but not Gmail's built-in labels (All Mail, Sent Mail)--All Mail being the most annoying. It'd be nice to wipe those, too. :D

Thanks.

 
H S User

Hi Jmerz,

Sorry for the late reply - is there a way to subscribe to a topic or script for email notification? Or another way you know of to follow and updates / replies?

Anyhows, I just tried the updated script, and it didnt appear to make a difference - then I enabled the Offline labs feature as you suggested, and that seems to have worked! The selected label now gets hidden as new messages arrive. I'm not sure if it was the combination of the new script and the offline lab, or just the lab.

THanks for hte help - tho its a seemingly minor feature, it adds up to a big difference when I use it so much!

 
jmerz Script's Author

Hi HS,

Glad to hear that did it!

There's not a way as nice as email to follow replies on here. There is the RSS feed for each script, and I do follow that, but it isn't specific to a conversation - it displays updates to every discussion about this script. That's useful for me so I can see anytime somebody posts any questions or comments, but it might not be quite what you would be looking for.

For updates to scripts, if you mark a script as a favorite, you can go under your user settings, select "Notifications" and check the "Send me an email when someone uploads a new version of one of my favorite scripts".

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel