Last active
January 31, 2024 06:37
-
-
Save htsign/eb1b8917a4b6f9a29302b38d258e4770 to your computer and use it in GitHub Desktop.
はてなブックマークにて、自分が付けたスターを点滅させて見分けがつくようにします。
This file contains 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
// ==UserScript== | |
// @name blink-star | |
// @namespace jp.hateblo.htsign | |
// @description はてなブックマークにて、自分が付けたスターを点滅させて見分けがつくようにします。 | |
// @match http://b.hatena.ne.jp/* | |
// @match https://b.hatena.ne.jp/* | |
// @version 1.0.8 | |
// @updateURL https://gist.github.com/htsign/eb1b8917a4b6f9a29302b38d258e4770/raw/blink-star.user.js | |
// @downloadURL https://gist.github.com/htsign/eb1b8917a4b6f9a29302b38d258e4770/raw/blink-star.user.js | |
// @grant none | |
// ==/UserScript== | |
(async g => { | |
const root = g.document.documentElement; | |
if (!root || !root.dataset.pageScope) return; | |
const res = await fetch(`${g.origin}/api/my/profile`, { credentials: 'include' }); | |
const { status, name } = await res.json(); | |
if (status !== 1) return; | |
const style = g.document.createElement('style'); | |
g.document.head.appendChild(style); | |
style.sheet.insertRule(` | |
@keyframes blink-star { | |
from { opacity: 1.0 } | |
to { opacity: 0.3 } | |
}`); | |
style.sheet.insertRule(` | |
a.hatena-star-star[href$="/${name}"] { | |
animation: blink-star 300ms infinite ease-in alternate; | |
}`); | |
})(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment