Browse Source

Merge pull request #1619 from Ash258/patch-1

Update Discord js_unread
pull/1655/head
Ramiro Saenz 7 years ago committed by GitHub
parent
commit
72c314c0bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/store/ServicesList.js

3
app/store/ServicesList.js

@ -186,9 +186,8 @@ Ext.define('Rambox.store.ServicesList', {
,url: 'https://discordapp.com/login'
,type: 'messaging'
,titleBlink: true
,js_unread: 'function checkUnread(){var a=document.getElementsByClassName("guild unread").length,b=0,c=document.getElementsByClassName("badge");for(i=0;i<c.length;i++)b+=parseInt(c[i].innerHTML.trim());updateBadge(a,b)}function updateBadge(a,b){var c=b>0?"("+b+") ":a>0?"(•) ":"";document.title=c+originalTitle}var originalTitle=document.title;setInterval(checkUnread,3e3);'
,js_unread: 'function getAlertCount(badges) {var alerts = 0;for(var i = 0; i<badges.length; i++) {var badge = badges[i];if (badge && badge.childNodes && badge.childNodes.length > 0) {var count = parseInt(badge.childNodes[0].nodeValue, 10);alerts += count.isNaN? 1: count;} else {alerts++;}}return alerts;}function checkUnread() {var direct = 0,indirect = document.querySelectorAll(\'.guilds-wrapper .unread\').length,guildDirect = document.querySelectorAll(\'.guilds-wrapper .badge\'),channelDirect = document.querySelectorAll(\'[class^="nameUnreadText-"]+div>div>div\');direct += getAlertCount(guildDirect);direct += getAlertCount(channelDirect);indirect += document.querySelectorAll(\'[class^="nameUnreadText-"]\').length;updateBadge(indirect, direct);}function updateBadge(ind, dir) { var n = dir > 0 ? "(" + dir + ") ": ind > 0? "(•) ": "";document.title = n + originalTitle;}var originalTitle = document.title;setInterval(checkUnread, 3e3);'
,note: 'To enable desktop notifications, you have to go to Options inside Discord.'
,dont_update_unread_from_title: true
,userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
},
{

Loading…
Cancel
Save