-
Notifications
You must be signed in to change notification settings - Fork 0
/
FhMonkey-xs.js
183 lines (175 loc) · 6.07 KB
/
FhMonkey-xs.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
// ==FeHelperMonkey==
// @reminder 请不要删除这部分代码注释,这是FeHelper油猴脚本能正常工作的基本条件!当然,你可以按需修改这里的内容!
// @id mf_1689643680235
// @name xs
// @url-pattern /[http|https]:\/\/(m|www|m2)\.(xxbooktxt|suiyuexs|lwshuku|00ksw|qjiij|sjwx|txt0871|sjxs|baba5|xlaidudu|qbiqus|ipinshu|yruan|biqiudu|00shu|ibiquges|asxs|biquge|6lk|cxbz958|ddyueshu|siluke|vodtw|yqxsge|taccx|biququ)\.*/
// @enable true
// @require-js
// @auto-refresh 0
// @updated 2023-10-19 14:34:37
// ==/FeHelperMonkey==
(() => {
// https://www.yqxsge.cc/html/28/28347/641621661.html
// https://www.taccx.com/html/133068/89.html
// https://www.vodtw.com/book/8000/chapter/6589607.html#main
const STYLE = document.createElement('style');
let CSS = `
body {
padding-bottom:90vh
}
* {
background: rgb(198, 220, 200) !important;
background: rgb(10, 10, 10) !important;
color: #333 !important;
color: rgba(255, 255, 255, .5) !important;
border: none !important;
max-width: 100% !important;
}
img, button, input {
opacity: 0.1 !important;
}
button, #tbox {
border: none !important;
}
.amiddle {
display: none !important;
}
#content, p, #info, #content1, #chaptercontent, #nr, #articlecontent, .content-body, #txt {
line-height: 2 !important;
font-size: 16px !important;
background: rgb(222, 236, 223) !important;
background: rgb(22, 22, 22) !important;
margin-top: 0.8em;
}
#content, #content1, #chaptercontent, #nr, #articlecontent, .content-body, #txt {
padding: 20pt !important;
}
`;
STYLE.innerHTML = CSS;
document.body.appendChild(STYLE);
var containerKeys = ['#content', '#chaptercontent', '#nr', '.pt-read-text', '#articlecontent', '.content-body', '#txt'];
var container;
for (const containerKey of containerKeys) {
container = document.querySelector(containerKey);
if (container) {
break;
}
}
if (!container) {
return;
}
['div', 'a'].forEach(tag => container.querySelectorAll(tag).forEach(el => el.remove()))
var content = container.innerHTML;
var words = [
'大家去快可以试试吧。】',
'安卓苹果均可。】',
'安装最新版。】',
'野果阅读',
'均可。】',
'换源app',
'天才一秒记住',
'弹 窗',
'弹 窗',
'本书首发域名',
'huanyuanapp',
'7017k',
'首发最新。',
];
var rWrods = [/^\?*/g];
var preWords = [' ', ' '];
var Filter = (item, index) => {
preWords.forEach((preWord) => {
if (item.startsWith(preWord)) {
item = item
.split(preWord)
.map((tmp) => {
rWrods.forEach((rWord) => {
tmp = tmp.replace(rWord, '');
});
return tmp;
})
.join(preWord);
}
});
rWrods.forEach((rWord) => {
item = item.replace(rWord, '');
});
if (words.map((word) => item.includes(word)).filter(Boolean).length > 0) {
return '';
}
return item;
};
if (content.split('<p>').length > 10) {
content = content.split('<p>');
content = content.map(Filter).filter(Boolean);
content = content.join('<p>');
} else {
['p'].forEach(tag => container.querySelectorAll(tag).forEach(el => el.remove()));
content = container.innerHTML;
content = content.split('<br>');
if(content.length < 10) {
content = content.map(item=>item.split('。').map((tmp,index)=>`${index % 3 === 1 ? ' ' : ''}${tmp}。${index % 3 === 0 ? '<br>' : ''}`)).flat(Infinity)
// content = content.join('<br>');
// const arr = [];
// let index = 0;
// while(index < content.length){
// arr.push(content.slice(index,index += 200));
// arr.push('')
// }
// content = arr
} else {
content = content.map(Filter).filter(Boolean);
}
content = content.join('<br>');
}
switch (location.host) {
case 'www.qjiij.com':
content = content.split('晶晶走到')[0];
['www.qjiij.com', 'qjiij.com', '齐聚文学'].map(word => content = content.replaceAll(word, ''))
break;
default:
break;
}
container.innerHTML = content;
let scrollTag = true;
window.onscroll = () => {
// 窗口高度
var windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
// 页面高度
var documentHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
// 滚动条位置
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
if (windowHeight + scrollTop + 2 >= documentHeight && scrollTag) {
scrollTag = false;
const elBox = ['#pb_next', '.pt-nextchapter'];
for (const elName of elBox) {
const ele = document.querySelector(elName);
if (ele) {
ele.click();
break;
}
}
}
};
document.onkeydown = function (e) {
let elBox = [];
switch (e.code) {
case 'ArrowLeft':
elBox = ['#pb_prev', '.pt-prechapter'];
break;
case 'ArrowRight':
elBox = ['#pb_next', '.pt-nextchapter', '.next', '.bottem2 a:nth-child(4)'];
break;
default:
elBox = [];
break;
}
for (const elName of elBox) {
const ele = document.querySelector(elName);
if (ele) {
ele.click();
break;
}
}
};
})();