Note: These instructions are only for users who use the resizer code as either a Chrome extension/userscript or Greasemonkey userscript. Users who are using the bookmarklet version need not read any further!
Gmail changes
At some time in the last week or so, Google updated Gmail to provide new UI elements. Exactly what other changes were made, I can’t say… but around the same time, my Gmail label column resizer stopped loading.
It turns out that the resizer code itself was fine, as the bookmarklet version still worked. What I suspect had changed was something around the loading of their Gmail Greasemonkey API.
Every cloud has a silver lining, so the saying goes… and the silver lining to this was that I’ve updated my wrapper code to be identical for both Chrome userscripts and Greasemonkey userscripts. This was achieved by adding meta information to tell Greasemonkey that my code doesn’t need to be granted rights to use any of its "GM_"-prefixed functions, negating the need to use the "unsafeWindow" prefix.
A while ago, Google made Chrome more secure by restricting the ways that userscripts could be installed: now they have to be installed in the Extensions settings. I’ve given updated step-by-step instructions for this below, which should help some users who were finding my old instructions no longer worked.
Instructions for Firefox/Greasemonkey users
Greasemonkey users probably already know how to add userscripts, so I’m only providing instructions for Chrome users here. As mentioned above, the wrapper is now identical, so you should be able to use it without having to modify the code (tested against Greasemonkey 1.8 in Firefox 19.0.2). Remember: the use of the "unsafeWindow." prefix is no longer needed with the new wrapper code below.
Instructions for Chrome users
- Copy the code below into a text editor
- Copy the “full monty” code from my previous post and paste it into the text editor after the line that reads “// Insert code here…”
- Save the file with a name that ends in “.user.js”, for example, “chromeGmailResizer.user.js”. Note: the “.user.js” extension is important as tells Chrome that this code is to be installed as a user script
- Go into your Chrome extensions settings (either enter "chrome://extensions" into the address bar, or use the Chrome menu to visit "Tools" then "Extensions"
- You should see a page similar to this:
- Using the file manager for your operating system, drag the file into the Chrome Extensions page. You should see a message similar to this:
- Drop the file into the Extensions page. You should see a message similar to this:
- Click the "Add" button, and you should see a confirmation message similar to this:
- Load Gmail, and after a short delay, you should see the grab bar ready to go!
The new wrapper code
// ==UserScript== // @name Gmail label column resizer // @namespace http://www.codecouch.com/ // @description User script that allows the labels column in Gmail to be resized // @include http://mail.google.com/* // @include https://mail.google.com/* // @match http://mail.google.com/* // @match https://mail.google.com/* // @version 1.2 // @history 1.2 Allow 10 seconds for the Gmail Greasemonkey API to load, Chrome & GM userscripts now share same code // @history 1.1 Stopped duplicate grab bars and added more URL matching // @history 1.0 Initial version // @grant none // ==/UserScript== var addGmailResizerToPage = function() { function loadGmailResizer() { // Insert code here... }; // Test for the presence of the Gmail Greasemonkey API once per second. Give up if not present after 10 seconds var loadCount = 0; function testForGmonkey() { loadCount++; if (loadCount == 10) clearInterval(timerHandle); if (typeof(gmonkey) == 'object' && 'load' in gmonkey) { clearInterval(timerHandle); // Only load the resizer code if it hasn't already been run (stops multiple grab bars from appearing) if ('loadedGmailResizer' in top) return; top.loadedGmailResizer = true; loadGmailResizer(); } }; var timerHandle = setInterval(testForGmonkey, 1000); }; s = document.createElement('script'); s.type = 'text/javascript'; s.textContent = '(' + addGmailResizerToPage.toString() + ')()'; document.body.appendChild(s);