--- GMail.user.js.orig 2012-10-31 01:24:30.336862469 +0000 +++ GMail.user.js 2012-11-04 21:03:40.214603303 +0000 @@ -32,7 +32,7 @@ function getLabels() { var i, res = []; - var snapshot = document.evaluate('//div[2]/div/div/div[5]/div/*/div/div/div[2]/span/a', + var snapshot = document.evaluate('//div[@role="navigation"]/div[2]/div/div/div/div/div/*/div/div/span/a', pane, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (i = 0; i < snapshot.snapshotLength; i++) { @@ -58,7 +58,8 @@ function checkMessangesCount() { var tag = document.evaluate('//div[@aria-label="Navigate to"]/span', document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue; - if (tag.textContent != 'Gmail' && tag.textContent != 'Mail') { + var tagContent = tag.textContent.replace(/\s+$/, ''); + if (tagContent != 'Gmail' && tagContent != 'Mail') { return; } @@ -96,8 +97,8 @@ doMatrixIntegration(); } -if (isCorrectPage()) { - setTimeout(wrapCallback(function wait() { +setTimeout(wrapCallback(function wait() { + if (isCorrectPage()) { pane = document.evaluate('//div[@role="navigation"]', document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue; @@ -119,10 +120,9 @@ login = gmaillogin.indexOf("@") != -1 ? gmaillogin : gappslogin.indexOf("@") != -1 ? gappslogin : ""; Unity.init({ name: "GMail", - login: login, iconUrl: "icon://unity-webapps-gmail", homepage: 'https://mail.google.com', domain: 'mail.google.com', onInit: wrapCallback(unityLoaded) }); - }), 2000); -} + } +}), 2000);