-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSticky Vote.user.js
More file actions
54 lines (51 loc) · 1.74 KB
/
Sticky Vote.user.js
File metadata and controls
54 lines (51 loc) · 1.74 KB
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
// ==UserScript==
// @name Sticky Vote
// @namespace https://github.com/MdoubleDash
// @version 0.1
// @description Makes the score and voting buttons for a post move with the viewport
// @author MDoubleDash (@M--)
// @contributor @TylerH
// @match *://*.stackoverflow.com/*
// @match *://*.stackexchange.com/*
// @match *://*.askubuntu.com/*
// @match *://*.serverfault.com/*
// @match *://*.superuser.com/*
// @match *://*.stackapps.com/*
// @downloadURL https://github.com/MdoubleDash/SOS_Userscripts/raw/main/Sticky%20Vote.user.js
// @updateURL https://github.com/MdoubleDash/SOS_Userscripts/raw/main/Sticky%20Vote.user.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
const css = `
/* Makes the score and voting buttons for a post move with the viewport */
#answers .votecell .js-voting-container {
position: sticky;
top: 100px;
z-index: 1;
}
/* Fixes the width of the tooltips which broke due to sticky positioning */
div.js-voting-container button.js-vote-up-btn + div.s-popover[role="tooltip"] {
min-width: 150px;
text-align: center;
padding: 11px;
}
div.js-voting-container button.js-vote-down-btn + div.s-popover[role="tooltip"] {
min-width: 170px;
text-align: center;
padding: 11px;
}
.js-voting-container div.js-vote-count + div.s-popover[role="tooltip"] {
min-width: 217px;
}
button.js-saves-btn + div.s-popover {
min-width: 128px;
}
a.js-post-issue + div.s-popover {
min-width: 140px;
}
`;
const style = document.createElement('style');
style.textContent = css;
document.head.append(style);
})();