Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Fix WhatsApp properly #261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 .VOr2j");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