Last active
August 24, 2019 03:34
-
-
Save tdchien/5f0a3c7d65202c047392a9a7197d9187 to your computer and use it in GitHub Desktop.
Intergrate zalo with Rambox. This script is used update unread message for zalo on rambox
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
function checkUnread() { | |
console.log('checkUnread run'); | |
var msg = document.getElementById("message-tab"); | |
var img = msg.querySelector(".tab-red-dot"); | |
if ((img == null) || (img == undefined)) { | |
// rambox.clearUnreadCount(); | |
document.title = originalTitle; | |
return; | |
} | |
var src = img.attributes["src"]; | |
src = src.value; | |
// src = 'https://zalo-chat-static.zadn.vn/message_notification_more.png'; | |
t = src.replace(/https\:\/\/zalo-chat-static.zadn.vn\/message_notification_|png|\./g, ''); | |
if (t === 'more') { | |
// rambox.setUnreadCount('5+') | |
document.title = "(5+) " + originalTitle | |
} else if (t >= 1) { | |
// rambox.setUnreadCount(e) | |
document.title = "(" + t + ") " + originalTitle | |
} else { | |
// rambox.clearUnreadCount() | |
document.title = originalTitle; | |
} | |
} | |
var originalTitle = document.title; | |
setInterval(checkUnread, 3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here my whole config, no need advanced code. I add _Custom Service and just fill https://chat.zalo.me in url box, after that I can login zalo by my account.
