Skip to content

Commit

Permalink
Fix WhatsApp detection properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitthief committed Jan 10, 2023
1 parent 18d996a commit 3bf880a
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion app/store/ServicesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,29 @@ Ext.define('Hamsket.store.ServicesList', {
,description: locale['services[0]']
,url: 'https://web.whatsapp.com/'
,type: 'messaging'
,js_unread: `let checkUnread=()=>{const elements=document.querySelectorAll("#pane-side ._23LrM");let count=0;for(const i of elements){const gp=i.parentNode.parentNode;0===gp.querySelectorAll('#pane-side *[data-icon="muted"]').length&&count++}hamsket.updateBadge(count)};setInterval(checkUnread,1e3);let unregister_queue=[];navigator.serviceWorker.getRegistrations().then(registrations=>{for(const registration of registrations)unregister_queue.push(registration.unregister());return unregister_queue}).then(queue=>{}).catch(err=>{});`
,js_unread: `
const className = Array.from(document.styleSheets)
.flatMap(s => Array.from(s.cssRules))
.filter(r => r instanceof CSSStyleRule)
.find(({style}) => style.color === 'var(--unread-marker-text)')
.selectorText.split('.').reverse()[0];
let checkUnread = () => {
const elements = document.querySelectorAll("#pane-side ." + className);
let count = 0;
for (const i of elements) {
const gp = i.parentNode.parentNode;
0 === gp.querySelectorAll('#pane-side *[data-icon="muted"]').length && count++;
}
hamsket.updateBadge(count);
};
setInterval(checkUnread, 1e3);
let unregister_queue=[];
navigator.serviceWorker.getRegistrations().then(registrations => {
for (const registration of registrations)
unregister_queue.push(registration.unregister());
return unregister_queue;
}).then(queue => {}).catch(err => {});
`
},
{
id: 'slack'
Expand Down

0 comments on commit 3bf880a

Please sign in to comment.