Skip to content

Instantly share code, notes, and snippets.

@monry
Last active December 28, 2015 09:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monry/7483161 to your computer and use it in GitHub Desktop.
Save monry/7483161 to your computer and use it in GitHub Desktop.
Fluid で ChatWork を App 化した際に、通知周りを拡張したかったので書いた。・未読件数をバッヂ表示・新着受信時 (正確にはバッヂ数が変化する時) に、Dock アイコン跳ねさせるSee also:- http://www.simplegimmick.com/2012/02/fluidchatworkcom.html- http://weblog.ymt2.net/blog/html/2012/12/13/chatwork_meets_fluid.html
window.fluid.dockBadge = '';
setTimeout(updateDockBadge, 1000);
setTimeout(updateDockBadge, 3000);
setInterval(updateDockBadge, 5000);
function updateDockBadge() {
var badge = '';
var unread = document.getElementById('_chatUnreadStatus');
if (unread.style.display != 'none' && unread.innerHTML) {
badge = unread.innerHTML + '';
if (window.fluid.dockBadge != badge) {
window.fluid.requestUserAttention(true);
}
}
window.fluid.dockBadge = badge;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment