-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModIconPrep.js
More file actions
64 lines (64 loc) · 2.24 KB
/
ModIconPrep.js
File metadata and controls
64 lines (64 loc) · 2.24 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
55
56
57
58
59
60
61
62
63
64
if ($('.mw-rcfilters-ui-highlights-enhanced-toplevel').length > 0) {
mw.loader.addStyleTag(`
.pc-mip-count {
position: absolute;
bottom: -.4em;
right: -.4em;
display: inline-block;
background: #FFFD;
border: #AAA 1px dashed;
border-radius: 50%;
color: #222;
font-size: 9px;
font-style: normal;
line-height: 1.2em;
text-align: center;
width: 1.2em;
height: 1.2em;
user-select: none;
}
`);
if (window.modIconPrepAlignBlank) {
mw.loader.addStyleTag(`
td.mw-changeslist-line-inner:not(:has(i.mod-status-icon)),
td.mw-enhanced-rc-nested:not(:has(i.mod-status-icon)) > .mw-changeslist-separator {
text-indent: .84em;
}
td.mw-changeslist-line-inner:not(:has(i.mod-status-icon))::before {
content: " ";
white-space: pre;
}
td.mw-enhanced-rc-nested:not(:has(i.mod-status-icon)) > .mw-changeslist-separator::before {
content: " . .";
white-space: pre;
}
`);
}
let epath = '.mw-rcfilters-ui-highlights-enhanced-toplevel.mw-changeslist-src-mw-edit .mw-changeslist-line-inner';
let npath = '.mw-rcfilters-ui-highlights-enhanced-toplevel.mw-changeslist-src-mw-new .mw-changeslist-line-inner';
let lpath = '.mw-rcfilters-ui-highlights-enhanced-toplevel.mw-changeslist-src-mw-log .mw-changeslist-line-inner';
// 在合并更改前方添加图标
$('.mw-rcfilters-ui-highlights-enhanced-toplevel').each(function() {
const ico = $(this).next().find('i.mod-status-icon').first().clone();
const num = $(this).nextAll().find('i.mod-status-icon').length;
ico.css({'position': 'relative', 'contain': 'none'});
ico.append($('<span>').text(num).addClass('pc-mip-count'));
$(this).find('td.mw-changeslist-line-inner').first().prepend(ico);
});
// 隐藏合并编辑的后置图标
$(`${epath}, ${npath}`).each(function() {
let con = $(this).contents();
const ico = con.filter('span.mw-changeslist-links').find('i.mod-status-icon');
const prevNode = ico[0].previousSibling;
prevNode.remove();
ico.remove();
});
// 隐藏合并日志的后置图标
$(lpath).each(function() {
let con = $(this).contents();
const ico = con.filter('span.mw-changeslist-links').find('i.mod-status-icon');
if (ico.length > 0) {
ico.parent()[0].remove();
}
});
}