Last active
December 28, 2015 09:59
-
-
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
This file contains hidden or 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
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