-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquora.notifications.user.js
34 lines (28 loc) · 1.06 KB
/
quora.notifications.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// ==UserScript==
// @name Unread only Quora Notifications
// @namespace http://saiprasad.me/
// @version 0.1
// @description Hides the read items in Quora's notifications page. Can be toggled with Shift + ~.
// @match https://www.quora.com/notifications
// @match http://www.quora.com/notifications
// ==/UserScript==
/*global window, document*/
(function () {
"use strict";
var ID_STYLE = "__focussed";
// Add stylesheet..
var sheet = document.createElement("style");
sheet.type = "text/css";
sheet.id = ID_STYLE;
sheet.innerHTML = "@media screen {.notification_item.seen {display:none; }}";
(document.head || document.documentElement).appendChild(sheet);
// Listen for toggling keyboard shortcut (Shift + ~)
window.addEventListener("keypress", function (event) {
if (event.shiftKey && event.keyCode === 126) {
var style_node = document.getElementById(ID_STYLE);
if (style_node) {
style_node.disabled = !style_node.disabled;
}
}
}, false);
}());