I wrote a userscript to highlight the current row in GMail (indicated by the arrow). Unfortunately the highlight will only stay until GMail Inbox is auto-refreshed, which happens quite often. Is there a way to catch that event so I could reapply the highlighting? I don't want to do it on timeout. There is another userscript that does that and it loads up CPU.
+1
A:
If you add a timer and look when your highlight element disappear? or if a parent object change its address (with ===).
sw
2010-03-14 01:13:42
Yep, that's what I said I DON'T want to do - use timer. Try it, you'll see CPU usage hovering just under 50%.
nameanyone
2010-03-15 07:44:27
+2
A:
It sounds to me like you will want to review this document which is documentation for the Gmail gmonkey API, which is an API that google provides for greasemonkey scripts.
This page describes a userscript which monitors view changes, and this should be very similar to what you need.
I assume you will want something like:
window.addEventListener('load', function() {
if (unsafeWindow.gmonkey) {
unsafeWindow.gmonkey.load('1.0', function(gmail) {
function changedViewType() {
// Threadlist
if(gmail.getActiveViewType()== "tl"){
// code to highlight the current row here...
}
}
gmail.registerViewChangeCallback(changedViewType);
changedViewType();
});
}
}, true);
Erik Vold
2010-03-22 01:17:35
I finally got around to checking this and it doesn't work. Neither does the sample script on that page, Gmail View Watcher.
nameanyone
2010-04-05 11:38:07
Gmail Greasemonkey API abandoned? See http://code.google.com/p/gmail-greasemonkey/issues/detail?id=39
nameanyone
2010-04-06 17:50:53
A:
consider a CSS userstyle (http://userstyles.org/ ) instead of a userscript. You can use Firefox's DOM inspector to look at the HTMl elements and classes in the selected row, and then it should be pretty straightforward to write a CSS selector that select just that row.
ryan
2010-09-20 15:08:39
ryan, the question is how to catch an event. I have no problem selecting a row.
nameanyone
2010-09-21 14:52:14