Last active
July 29, 2018 08:33
-
-
Save pacochi/1e98fb37899018c761f0950fc2ceaada to your computer and use it in GitHub Desktop.
pixiv Sketch の通知でお知らせ・お題をカウントに入れないようにします。
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 [pixivSketch] minimum notification | |
// @namespace hen.acho.co | |
// @version 1.180729 | |
// @description ignore announcements | |
// @author pacochi | |
// @match https://sketch.pixiv.net/* | |
// @downloadURL https://gist.github.com/pacochi/1e98fb37899018c761f0950fc2ceaada/raw/pixivsketch_minimum_notification.user.js | |
// @run-at document-start | |
// @grant none | |
// ==/UserScript== | |
(() => { | |
'use strict'; | |
Object.defineProperty(window, 'dehydrated', { | |
get() { | |
return this._dehydrated; | |
}, | |
set(prop) { | |
prop.context.dispatcher.stores.AnnouncementStore.announcements.forEach( | |
announcement => announcement.unread = false | |
); | |
this._dehydrated = prop; | |
} | |
}); | |
window.addEventListener('load', e => { | |
const counter = document.querySelector('.NotificationButton .count'); | |
if (counter) counter.classList[(+counter.innerText) ? 'add' : 'remove']('visible'); | |
}, { once: true }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment