Last active
June 2, 2022 04:43
-
-
Save hidao80/4136e4bd7f92d0f38e0edd6c7b560a5d to your computer and use it in GitHub Desktop.
Qiitadon で投稿があったとき、トーストで通知するブックマークレット
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
(()=>{ | |
let old_id = document.getElementsByClassName("item-list")[2].firstElementChild.dataset.id; | |
const timer = setInterval(() => { | |
let new_id = document.getElementsByClassName("item-list")[2].firstElementChild.dataset.id; | |
if (old_id !== new_id) { | |
old_id = new_id; | |
const parentElm = [...document.querySelectorAll('.column-header')].find(v => /ローカルタイムライン/.test(v.textContent)).parentElement.parentElement; | |
new Notification(parentElm.querySelector(".display-name__html").textContent, { body: parentElm.querySelector('.status__content')?.textContent ?? '', icon: parentElm.querySelector('.account__avatar, account__avatar-overlay-base')?.style?.backgroundImage?.replace(/^url\("|"\)/g, '') ?? ''}); | |
} | |
},1000); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment