Skip to content

Instantly share code, notes, and snippets.

@pmuellr
Created November 16, 2010 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmuellr/701848 to your computer and use it in GitHub Desktop.
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
// ==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 ""
}
})();
@parente
Copy link

parente commented Nov 16, 2010

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.

@pmuellr
Copy link
Author

pmuellr commented Nov 16, 2010

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