Greasemonkey Script Updates #
There have been some reports that my Gmail Macros Greasemonkey script no longer works. I started to look into fixing this, and figured that while I was at it, I should incorporate the improvements that others have made to the script back into the original one. Both posts about it have a growing number of comments, including patched versions with various tweaks. Additionally, there is a Google Group dedicated to Gmail power users that seems to have made even more changes. The script has been updated and now contains the following additional commands:
- b: Remove label
- z: Mark unread
- o: Expand/collapse all messages in a conversation
- shift-x + a/n/r/u/s/t: Select all/none/read/unread/starred/unstarred
- h: Show help (reference for built-in and the script's keyboard shortcuts)
Thanks go to Karl, Anand and Michael (?) for these improvements. If I have missed anyone, please let me know.
On a related note, my Google Reader/Gmail integration script has spawned two variants, one by Rob Radez and another by Winston. They went for slightly deeper integrations, if you like the original you may like these too.
28 Comments
I love the color labels, but I am having a heck of a time trying to get the names to appear without the color tag on them in the Labels section on the left. Also, the formatting seems to disappear at times (running just your code).
EXCELLENT work on them all!
Anyway, thanks for your awesome GM scripts, they've become irreplaceable to me very quickly.
http://ustice.blogspot.com/2006/11/greasemonkey-script.html
Darn stripping out HTML tags. Oh well, such is the price of security.
http://groups-beta.google.com/group/gmail-power-users/web/gmailmacrosBN.user.js
I've created a printable cheat sheet available here: http://docs.google.com/View?docid=dn8w3vq_2gxd5hk
Also, check out the power users group mentioned above for great discussion and mods to this script.
I have posted a simple patch for GMail macros script, that allows you to GOTO/'Apply Label' even if the "Labels" table on left is in closed state. I have posted it here (dated Nov 19, 2006):
http://userscripts.org/scripts/show/2432
But, even though I idented the whole text properly, it all got messed up; perhaps that's not a place to post code or big notes of 'Thank You'. Thankfully, I had surrounded the code peices with <code></code> tags, so it is worthwhile for anybody who takes a little pain.
Anyway, I am posting just the patch part here:
Note to non-JS/novice guys: <code> and </code> tag are just delimiters, do not add them to your script; add just what is between them.
Declare a global variable (preferably just before "function beginLabelAction()"):
<code>
var closeLabels = false;
</code>
Now, add the following 4 lines at the beginning of "function beginLabelAction()":
<code>
if (document.getElementById("nt_0").nextSibling == null){
closeLabels = true;
simulateClick(document.getElementById("nt_0"), "click");
}
</code>
Now, at the end of "function endLabelAction()", add the following 4 lines:
<code>
if (closeLabels == true) {
closeLabels = false;
simulateClick(document.getElementById("nt_0"), "click");
}
</code>
Hope you like this small feature.
Best regards,
Gurjeet.
You can click on messages there, which will open them in a new Gmail window (tab). But how about opening them in "preview" mode, just like your "Gmail conversation Preview" GM script, straight from the home page?
Brian, the latest version of this script should work in Firefox 2.0.
updateLabelAction() {
//...
if (labelPrefix.length == 0) {
banner.matches(selectedLabels); // added this line
return;
}
//...
banner.matches(selectedLabels);
}
getNodeSet() {
//...
boxNode.appendChild(messageNode);
// added the following
var matchesNode = newNode("div");
with (matchesNode.style) {
fontSize = "16px";
fontFamily = "Lucida Grande, Trebuchet MS, sans-serif";
margin = "0 10px 10px 0";
}
boxNode.appendChild(matchesNode);
// added to here
var taglineNode = newNode("div");
//...
}
//added below Banner.prototype.update
Banner.prototype.matches = function(matchesArray) {
if (matchesArray.length) {
this.backgroundNode.firstChild.nextSibling.style.display =
this.foregroundNode.firstChild.nextSibling.style.display = "inline";
} else {
this.backgroundNode.firstChild.nextSibling.style.display =
this.foregroundNode.firstChild.nextSibling.style.display = "none";
}
var msg = this.backgroundNode.firstChild.innerHTML;
var html = '<span style="color:lightgrey">';
for (ii in matchesArray) {
if (ii == 0) {
html += matchesArray[ii].substring(msg.length);
}
else {
html += "<br/>" + matchesArray[ii];
}
}
html += "</span>"
this.backgroundNode.firstChild.nextSibling.innerHTML =
this.foregroundNode.firstChild.nextSibling.innerHTML = html;
You know what, I'll make my modified script available to download.
function updateLabelAction(event) {
// We've already dispatched the action, the user is just typing away
if (dispatchedActionTimeout) {
return;
}
selectedLabels = new Array();
// We need to skip the label shortcut that got us here
var labelPrefix = labelInput.value.substring(1).toLowerCase();
banner.update(labelPrefix);
if (labelPrefix.length == 0) {
return;
}
for (var i=0; i < labels.length; i++) {
if (labels[i].toLowerCase().indexOf(labelPrefix) == 0) {
selectedLabels.push(labels[i]);
}
}
// ADDED:: show the suggestions on the line below
banner.update(labelPrefix + "<br/>\n" + selectedLabels.join(' '));
if (event.keyCode == 13) {
// CHANGED: invoke the actual label typed (TODO: tab-completion)
activeLabelAction(labelPrefix);
dispatchedActionTimeout = window.setTimeout(
function () {
endLabelAction();
}, 400);
}
Thanks
Myspace Proxy
Afrid.com
Thanks!
Post a Comment