-
Notifications
You must be signed in to change notification settings - Fork 34
/
HNQSiteNames.user.js
64 lines (60 loc) · 1.87 KB
/
HNQSiteNames.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// ==UserScript==
// @name HNQ Site Names
// @description Adds site names to HNQ sidebar
// @homepage https://github.com/samliew/SO-mod-userscripts
// @author Samuel Liew
// @version 1.0.13
//
// @match https://*.stackoverflow.com/*
// @match https://*.serverfault.com/*
// @match https://*.superuser.com/*
// @match https://*.askubuntu.com/*
// @match https://*.mathoverflow.net/*
// @match https://*.stackapps.com/*
// @match https://*.stackexchange.com/*
//
// @exclude https://stackoverflowteams.com/*
// @exclude https://api.stackexchange.com/*
// @exclude https://data.stackexchange.com/*
// @exclude https://contests.stackoverflow.com/*
// @exclude https://winterbash*.stackexchange.com/*
// @exclude *chat.*
// @exclude *blog.*
// @exclude */tour
//
// @require https://raw.githubusercontent.com/samliew/SO-mod-userscripts/master/lib/se-ajax-common.js
// @require https://raw.githubusercontent.com/samliew/SO-mod-userscripts/master/lib/common.js
// ==/UserScript==
/// <reference types="./globals" />
'use strict';
addStylesheet(`
#hot-network-questions li {
margin-bottom: 1rem;
}
#hot-network-questions .favicon {
position: relative;
pointer-events: none;
}
#hot-network-questions .favicon + a {
margin-top: 1.1rem;
}
#hot-network-questions .favicon:after {
content: attr(title);
display: block;
position: absolute;
left: calc(100% + 6px);
top: 0;
font-size: 0.8rem;
line-height: 1;
color: var(--black-400);
white-space: nowrap;
}
`);
// Links open in a new tab/window
document.querySelectorAll('#hot-network-questions a').forEach(v => {
v.target = "_blank";
});
// Strip "Stack Exchange" from site names
document.querySelectorAll('#hot-network-questions .favicon').forEach(v => {
v.title = v.title?.replace(/ Stack Exchange$/i, "") ?? "";
});