Skip to content

Instantly share code, notes, and snippets.

@pacochi
Last active July 29, 2018 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pacochi/1e98fb37899018c761f0950fc2ceaada to your computer and use it in GitHub Desktop.
Save pacochi/1e98fb37899018c761f0950fc2ceaada to your computer and use it in GitHub Desktop.
pixiv Sketch の通知でお知らせ・お題をカウントに入れないようにします。
// ==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