Created
November 16, 2010 14:03
-
-
Save pmuellr/701848 to your computer and use it in GitHub Desktop.
userscript for Fluid for Lotus Notes web version to update dock badge with inbox counter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name NotesInboxCounter | |
// @namespace http://fluidapp.com | |
// @description Updates the dock back with Inbox count for Lotus Notes | |
// @include * | |
// @author Patrick Mueller | |
// ==/UserScript== | |
(function () { | |
if (!window.fluid) return | |
var timeout = 30 * 1000 | |
updateBadge() | |
//-------------------------------------------------------- | |
function updateBadge() { | |
var count = getInboxCountForFrames() | |
window.fluid.dockBadge = count | |
setTimeout(updateBadge, timeout) | |
} | |
//-------------------------------------------------------- | |
function getInboxCountForFrames() { | |
var count = "" | |
for (var i=0; i<window.frames.length; i++) { | |
count = getInboxCount(window.frames[i].document) | |
if (count != "") return count | |
} | |
return count | |
} | |
//-------------------------------------------------------- | |
function getInboxCount(doc) { | |
var inboxPattern = /.*Inbox\s*(\((\d+)\))?.*/ | |
var tds = doc.getElementsByTagName("td") | |
for (var i=0; i<tds.length; i++) { | |
var match = inboxPattern.exec(tds[i].innerHTML) | |
if (match) { | |
var count = match[2] | |
if (count) return count | |
} | |
} | |
return "" | |
} | |
})(); |
ha! I think I've given up too. But I switched FROM chrome TO fluid because I was having 100% CPU usage quirks under chrome. Turns out, I get them under fluid as well. :-( Back to "the client" for me ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My hacky attempt that I forgot to post (until you just reminded me)
https://gist.github.com/702062
I gave up on using Fluid for iNotes though. It's much less quirky running it in Chrome.