-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path腾讯视频优化助手.user.js
199 lines (183 loc) · 5.08 KB
/
腾讯视频优化助手.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
196
197
198
199
// ==UserScript==
// @name 腾讯视频优化助手
// @namespace https://github.com/geoi6sam1
// @version 1.1.9
// @description 优化腾讯视频(WeTV)浏览与观影体验,支持电脑端和移动端
// @author [email protected]
// @icon https://v.qq.com/favicon.ico
// @supportURL https://github.com/geoi6sam1/FuckScripts/issues
// @match http*://v.qq.com/*
// @match http*://m.v.qq.com/*
// @match http*://film.qq.com/*
// @match http*://m.film.qq.com/*
// @run-at document-start
// @grant unsafeWindow
// @grant GM_addStyle
// @license GPL-3.0
// ==/UserScript==
(function () {
'use strict'
const obj = {
option: {
quick: 0, // 网页顶部导航按钮,默认隐藏,值为0
barrage: 0, // 视频弹幕相关内容,默认隐藏,值为0
watermark: 0, // 视频右上角水印,默认移除,值为0
grayscale: 0, // 哀悼日网站灰度,默认取消,值为0
},
}
const userAgent = navigator.userAgent || window.navigator.userAgent
const isMobile = /Android|webOS|iPhone|iPad|iPod|Opera Mini|Mobile/i.test(userAgent)
function removeTimeout(e, t) {
setTimeout(() => {
var d = document.querySelector(e)
if (d) {
d.remove()
}
}, t)
}
obj.wetvQuick = function () {
GM_addStyle(`
.quick_vip,
.quick_upload,
.quick_message,
#quick_access,
#pc_client
{
display: none !important;
}
`)
}
obj.wetvBarrage = function () {
GM_addStyle(`
[class*="-barrage"],
[class*="barrage-"]
{
display: none !important;
}
`)
if (!isMobile) {
GM_addStyle(`
iframe[src*="vfiles.gtimg.cn/tvideo/libcocos-frame"]
{
display: none !important;
}
`)
}
}
obj.wetvWatermark = function () {
removeTimeout(".txp-watermark", 5678)
}
obj.wetvGrayscale = function () {
GM_addStyle(`
.gray-style-remembrance
{
-webkit-filter: grayscale(0) !important;
filter: grayscale(0) !important;
}
`)
}
GM_addStyle(`
.quick_games,
.client_download,
.link_vip.__open_vip_tv,
.playlist-vip-section__vip,
.preview-mini-player,
.video-card-module [dt-params*="ad_"],
.focus-wrap [dt-eid*="ad_poster"],
a[href*="9377s."],
a[href*="qqgame."],
a[href*="gamer."],
a[href*="iwan."],
.video-banner-module:has(a[href*="9377s."]),
.video-banner-module:has(a[href*="qqgame."]),
.video-banner-module:has(a[href*="gamer."]),
.video-banner-module:has(a[href*="iwan."]),
#iwan-gamependant-page,
.tip_download,
.vip_act,
.fixed_box,
#ad_pc-index-vip-tips,
#channel-vip-popup,
#ad_container,
#iwan-game,
.banner-ad,
.txp_ad,
.game-switch-ad,
.player-comment-btn,
iframe[data-src*="mall."],
[class*="txp_full_screen_pause"],
[data-role*="creative-player-pause"],
#ad_m-site,
.open-app.old-open,
.bottom-wrapper,
.at-app-banner
{
display: none !important;
}
.video-card-wrap
{
margin-right: var(--content-big-card-margin);
margin-bottom: var(--content-big-card-margin);
}
`)
obj.adFloatFuck = function () {
var txv_player_choose = document.querySelectorAll("#player video")[0]
if (txv_player_choose) {
setTimeout(() => {
if (txv_player_choose.paused == true) {
var txv_player_win = document.querySelector(".txp_videos_container")
txv_player_win.setAttribute("style", "position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 0;")
}
}, 2000)
}
}
window.addEventListener("keydown", (event) => {
var e = event || window.event
var k = e.keyCode || e.which
if (k == 32) {
obj.adFloatFuck()
}
})
window.addEventListener("mousedown", (event) => {
var e = event || window.event
var b = e.button
if (b == 0) {
obj.adFloatFuck()
}
})
var arr = [
[obj.option.quick, obj.wetvQuick],
[obj.option.barrage, obj.wetvBarrage],
[obj.option.watermark, obj.wetvWatermark],
[obj.option.grayscale, obj.wetvGrayscale],
]
arr.forEach((item) => {
if (item[0] == 0) {
item[1]()
}
})
window.onload = () => {
let run = null
clearAd()
window.addEventListener("pushState", () => {
clearInterval(run)
clearAd()
})
function clearAd() {
run = setInterval(() => {
let adVideos = document.querySelectorAll(".txp_ad video")
adVideos.forEach(ad => {
if (ad.duration != ad.currentTime) {
ad.setAttribute("src", "")
}
})
}, 100)
}
}
if (isMobile) {
var customUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36';
Object.defineProperty(navigator, 'userAgent', {
value: customUserAgent
})
}
})()