Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Горячая кнопка скрыть пост: Ctrl + Alt + ;
- // @version 1
- // @author Konf
- // @namespace https://greasyfork.org/ru/users/462954
- // @icon https://www.google.com/s2/favicons?domain=2ch.hk
- // @include /^https:\/\/2ch\.(hk|pm)\/.*/
- // @run-at document-start
- // @grant none
- // ==/UserScript==
- /* jshint esversion: 6 */
- /* global Post */
- (function() {
- 'use strict';
- window.addEventListener('keydown', ev => {
- if (!ev.altKey || !ev.ctrlKey || ev.code !== 'Semicolon') return;
- const nodesUnderCursor = document.querySelectorAll(':hover');
- for (const node of nodesUnderCursor) {
- if (node.matches('.post')) {
- const postId = node.dataset.num;
- const postInstance = Post(postId);
- // 2ch built-in methods
- postInstance.hide(); // hide visually right now
- Post(postId)._storeHide(); // remember for hiding after page reload
- break;
- }
- }
- });
- })();
Add Comment
Please, Sign In to add comment