forked from samliew/SO-mod-userscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MobileModeratorPages.user.js
195 lines (186 loc) · 4.33 KB
/
MobileModeratorPages.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
// ==UserScript==
// @name Mobile Moderator Pages
// @description Converts mod pages to mobile-friendly UI
// @homepage https://github.com/samliew/SO-mod-userscripts
// @author Samuel Liew
// @version 2.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/*
// @match 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==
/* globals StackExchange */
/// <reference types="./globals" />
'use strict';
// This is a moderator-only userscript
if (!isModerator()) return;
// This userscript is written only for mod pages when on mobile
const isMobile = devicePixelRatio > 2 || outerWidth <= 500;
const isModPage = document.body.classList.contains('mod-page');
if (!isMobile || !isModPage) return;
// Append styles
addStylesheet(`
/* General */
html, body {
min-width: 0;
}
body > *,
table {
max-width: 100% !important;
}
.container *, [style*='width']:not(input) {
width: auto !important;
word-break: break-word;
}
.float-right, .fr {
float: none !important;
}
.float-left, .fl {
float: none !important;
}
#left-sidebar,
#footer,
.help-button-item,
#tabs .bounty-indicator-tab,
input.post-id[readonly] {
display: none !important;
}
.leftnav-dialog .left-sidebar--sticky-container {
padding: 10px 10px 0;
}
#content {
width: 100%;
max-width: 100vw;
margin-left: 0;
padding: 10px;
overflow-x: hidden;
}
#sidebar {
float: none;
margin: 50px 0;
}
.subheader #tabs {
float: left;
width: 100%;
clear: both;
margin: 20px 0;
}
#tabs, .tabs {
position: relative;
}
#tabs a.youarehere, .tabs a.youarehere {
z-index: 1;
}
#tabs:after, .tabs:after {
border-bottom: 2px solid var(--black-075);
position: absolute;
bottom: 1px;
width: 100%;
z-index: 0;
}
.subheader {
margin: 10px 0 10px;
}
/* Specific */
table.flagged-posts .mod-post-header {
display: block;
clear: both;
}
table.flagged-posts .mod-post-header + td {
float: right;
clear: both;
}
.votecell.post-layout--left {
padding-right: 0 !important;
}
td.js-dashboard-row {
padding-left: 0;
padding-right: 0;
}
.mod-audit > br,
.question-status .cbt,
.mod-userlinks,
.module.collapse.start-open,
.module.collapse.start-open + .module {
display: none;
}
.mod-audit span + br {
display: initial;
}
.mod-audit {
margin: 5px 0;
padding: 0 !important;
}
.mod-audit * {
font-size: 12px !important;
}
table.flagged-posts .delete-options {
text-align: right;
}
table.flagged-posts .delete-options .popup {
text-align: left;
}
.revision-comment {
line-height: 16px;
}
.flagcount + .revision-comment {
display: inline-block;
clear: left;
word-break: unset;
line-height: 16px;
}
table.mod-summary td {
min-width: 60px !important;
}
#a-apply-filters {
font-size: 11px;
}
a.expander-arrow-small-hide {
float: left;
width: 13px !important;
margin-bottom: 5px;
transform: scale3d(2,2,1);
}
.user-info .user-gravatar32,
.user-info + br {
display: none;
}
.user-info .user-gravatar32+.user-details {
margin: 0;
}
table.flagged-posts .mod-audit {
min-width: 150px !important;
padding-left: 10px;
}
.mod-audit-user-info:not(.owner) {
background: var(--black-025);
}
.badge1, .badge2, .badge3 {
width: 6px !important;
}
`); // end stylesheet
// On script run
(function init() {
// Transform page
$('html').addClass('html__responsive');
$('head meta[name=viewport]').remove(); // remove existing viewport tag
$('head').append(`<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />`);
$('#left-sidebar > div').appendTo('.leftnav-dialog');
$('table.mod-summary').parent('div').attr('style', 'overflow-x:scroll!important;');
})();