-
Notifications
You must be signed in to change notification settings - Fork 2
/
v2.beta.html
458 lines (432 loc) · 26.5 KB
/
v2.beta.html
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no" />
<meta name="renderer" content="webkit" />
<meta name="force-rendering" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<!-- MDUI CSS -->
<link rel="stylesheet" href="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/mdui/1.0.2/css/mdui.min.css" />
<title>VideoTogether</title>
</head>
<body class="mdui-theme-primary-indigo mdui-theme-accent-pink mdui-theme-layout-auto">
<!-- Toolbar -->
<div class="mdui-toolbar mdui-color-theme">
<span class="mdui-typo-title">VideoTogether</span>
<div class="mdui-toolbar-spacer"></div>
<a class="mdui-btn mdui-btn-icon">
<i class="mdui-icon material-icons" id="brightness">brightness_4</i>
</a>
<a class="mdui-btn mdui-btn-icon" mdui-menu="{target: '#menu'}">
<i class="mdui-icon material-icons">more_vert</i>
</a>
<ul class="mdui-menu" id="menu">
<li class="mdui-menu-item">
<a class="mdui-ripple" id="Refresh" onClick="window.location.reload()"></a>
<a class="mdui-ripple" id="Return" onClick="window.history.back()"></a>
</li>
</ul>
</div>
<div class="mdui-container mdui-p-t-3">
<div class="mdui-row">
<div class="mdui-col-md-6 mdui-col-sm-12">
<div class="mdui-card" style="padding: 10px">
<div class="mdui-card-primary">
<div class="mdui-card-primary-title" id="Setting"></div>
</div>
<script>
function emptyStrIfUdf(s) {
return s == undefined ? "" : s;
}
let settingItems = [
{
key: "EnableMiniBar",
defaultVal: true
},
{
key: "EnableTextMessage",
defaultVal: true
}
]
let languageDicts = {
"zh-cn": {
"Setting": "VideoTogether 设置",
"Refresh": "刷新页面",
"Return": "返回上级页面",
"MinimiseDefaultLabel": "窗口默认最小化",
"MinimiseDefaultLabelHelp": "可以通过点击右下角的小图标显示窗口",
// "PublicVideoRoomLabel": "我创建的房间默认公开",
// "PublicVideoRoomLabelHelp": "其他人可以通过主页的公开房间列表进入我的房间",
"DisableRedirectJoinLabel": "加入房间时不要自动跳转",
"DisableRedirectJoinLabelHelp": "如果遇到一些视频链接无法正确跳转时,请开启这个选项。手动打开和房主相同的视频后再加入房间",
"PasswordProtectedRoomLabel": "我创建的房间必须要密码才能加入",
"PasswordProtectedRoomLabelHelp": "注意:其他人同样可以用相同的密码挤掉房主,分享密码前请确认对方值得信赖",
"EnableRemoteDebugLabel": "开启远程调试模式",
"EnableRemoteDebugLabelHelp": "注意:这个功能非常有可能泄露您的隐私信息. 请在联系软件的开发者邮箱 [email protected] 并获得肯定回复后再开启这个功能, 开启后请不要访问任何需要登录或者已经登录的网站, 调试完毕后请立即关闭此功能",
"ExtensionIsDisabled": "插件没有被启用, 设置将不会生效",
"EchoCancellationLabel": "通话时开启回声消除和噪声消除",
"WaitForLoaddingLabel": "成员视频卡顿时, 房主暂停等待",
"WrapperFrameLabel": "增强安全性",
"SkipIntroLabel": "跳过片头",
"SkipIntroLengthLabel": "片头长度:",
"SkipIntroSecondLabel": "秒",
"ExperimentalFeature": "实验性功能",
"EasyShareLabel": "轻松分享",
"SuperEasyShareLabel": "超级无敌牛的轻松分享(可能会影响视频播放)",
"DisableNativeM3u8PlayerLabel": "关闭原生M3U8播放器",
"EnableTextMessageLabel": "文本聊天",
"EnableMiniBarLabel": "全屏视频时的迷你小窗",
"CheckUpdateLabel": "检查更新",
"CheckUpdateSucc": "更新成功",
},
"en-us": {
"Setting": "VideoTogether Settings",
"Refresh": "Refresh",
"Return": "Return to previous",
"MinimiseDefaultLabel": "Minimize window default",
"MinimiseDefaultLabelHelp": "You can display the window by clicking the small icon in the lower right corner.",
// "PublicVideoRoomLabel": "The room I create is public by default",
// "PublicVideoRoomLabelHelp": "Others can enter my room through the public room list on 2gether.video",
"DisableRedirectJoinLabel": "Do not automatically jump when joining a room",
"DisableRedirectJoinLabelHelp": "If you encounter some video links that cannot be jumped correctly, please enable this option and manually open the same video as the host before joining the room.",
"PasswordProtectedRoomLabel": "The room I created must have a password to join",
"PasswordProtectedRoomLabelHelp": "Note: Others can also use the same password to become the owner. Please confirm that he/she is trustworthy before sharing the password.",
"EnableRemoteDebugLabel": "Turn on the remote debugging mode",
"EnableRemoteDebugLabelHelp": "Please note that this feature may leak your private information. Please contact the developer of the software at [email protected] and get a positive reply before turning on this feature, do not visit any websites that require login or are already logged in after turning on this feature, and turn off this feature immediately after debugging.",
"ExtensionIsDisabled": "VideoTogether is disabled in this page, the settings in this page will not take effect",
"EchoCancellationLabel": "Enable echo cancellation and noise cancellation when call",
"WaitForLoaddingLabel": "When a member's video lags, host will pause to wait",
"WrapperFrameLabel": "Enhanced Security",
"SkipIntroLabel": "Skip Intro",
"SkipIntroLengthLabel": "Intro Length:",
"SkipIntroSecondLabel": "Seconds",
"ExperimentalFeature": "Experimental Feature",
"EasyShareLabel": "Easy Share",
"SuperEasyShareLabel": "Super Powerful Easy Share(may cause video playback issues)",
"DisableNativeM3u8PlayerLabel": "Disable native M3U8 player",
"EnableTextMessageLabel": "Text Message",
"EnableMiniBarLabel": "Mini Bar at fullscreen video",
"CheckUpdateLabel": "Check Update",
"CheckUpdateSucc": "Update Successfully",
}
}
function getDisplayLanguage(settingLanguage = undefined) {
let languages = ['en-us', 'zh-cn'];
let language = 'en-us';
let prefixLen = 0;
if (typeof settingLanguage != 'string') {
settingLanguage = navigator.language;
}
if (typeof settingLanguage == 'string') {
settingLanguage = settingLanguage.toLowerCase();
for (let i = 0; i < languages.length; i++) {
for (let j = 0; j < languages[i].length && j < settingLanguage.length; j++) {
if (languages[i][j] != settingLanguage[j]) {
break;
}
if (j > prefixLen) {
prefixLen = j;
language = languages[i];
}
}
}
}
return language;
}
let _settingLanguage = undefined;
function updateDisplayLanguage(settingLanguage = undefined) {
_settingLanguage = settingLanguage;
let languageDict = languageDicts[getDisplayLanguage(settingLanguage)];
for (let key in languageDict) {
try {
document.querySelector("#" + key).innerHTML = languageDict[key];
} catch (e) {
}
}
}
function getLanguageText(key) {
return languageDicts[getDisplayLanguage(_settingLanguage)][key];
}
let extensionEnabled = false;
window.addEventListener("message", e => {
if (e.data.type == 16) {
extensionEnabled = true;
document.querySelector("#MinimiseDefault").checked = e.data.data.MinimiseDefault;
// document.querySelector("#PublicVideoRoom").checked = e.data.data.PublicVideoRoom;
document.querySelector("#DisableRedirectJoin").checked = e.data.data.DisableRedirectJoin;
document.querySelector("#PasswordProtectedRoom").checked = (e.data.data.PasswordProtectedRoom != false);
document.querySelector("#WaitForLoadding").checked = (e.data.data.WaitForLoadding != false);
document.querySelector("#WrapperFrame").checked = (e.data.data.WrapperFrame != false);
document.querySelector("#EchoCancellation").checked = !(e.data.data.EchoCancellation === false);
let isDisplayLanguageUpdated = false;
try {
let newValue = e.data.data.DisplayLanguage ? e.data.data.DisplayLanguage : "";
if (newValue != document.querySelector("#DisplayLanguage").value) {
isDisplayLanguageUpdated = true;
}
} catch { };
document.querySelector("#DisplayLanguage").value = e.data.data.DisplayLanguage;
try {
if (isDisplayLanguageUpdated) {
DisplayLanguageSelect.handleUpdate();
}
} catch { }
// document.querySelector("#EnableRemoteDebug").checked = e.data.data.EnableRemoteDebug;
document.querySelector("#SkipIntroLength").value = emptyStrIfUdf(e.data.data.SkipIntroLength);
document.querySelector("#SkipIntro").checked = e.data.data.SkipIntro;
document.querySelector("#EasyShare").checked = (e.data.data.EasyShare != false);
document.querySelector("#SuperEasyShare").checked = e.data.data.SuperEasyShare;
document.querySelector("#DisableNativeM3u8Player").checked = (e.data.data.DisableNativeM3u8Player != false);
for (let i in settingItems) {
let item = settingItems[i]
document.querySelector(`#${item.key}`).checked = e.data.data[item.key] == undefined ? item.defaultVal : e.data.data[item.key];
}
updateDisplayLanguage(e.data.data.DisplayLanguage);
}
});
setTimeout(() => {
if (!extensionEnabled) {
alert(getLanguageText('ExtensionIsDisabled'));
}
}, 4000);
</script>
<!-- Rectangular switch -->
<div class="mdui-card-content" style="padding-top: 0px">
<div class="mdui-clearfix mdui-p-t-2">
Language / 语言
<div class="mdui-float-right">
<select id="DisplayLanguage">
<option style='display: none'></option>
<option value="zh-cn">简体中文</option>
<option value="en-us">English</option>
</select>
</div>
</div>
<div class="mdui-clearfix mdui-p-t-2">
<span onclick="mdui.snackbar({message: getLanguageText('MinimiseDefaultLabelHelp')})">
<a id="MinimiseDefaultLabel"></a>
<i class="mdui-icon material-icons mdui-ripple">help_outline</i>
</span>
<label class="mdui-switch mdui-float-right">
<input id="MinimiseDefault" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div>
<div class="mdui-clearfix mdui-p-t-2">
<a id="EchoCancellationLabel"></a>
<label class="mdui-switch mdui-float-right">
<input id="EchoCancellation" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div>
<!-- <div class="mdui-clearfix mdui-p-t-2">
<a id="PublicVideoRoomLabel"></a>
<label class="mdui-switch mdui-float-right">
<input id="PublicVideoRoom" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div> -->
<div class="mdui-clearfix mdui-p-t-2">
<span onclick="mdui.snackbar({message: getLanguageText('DisableRedirectJoinLabelHelp')})">
<a id="DisableRedirectJoinLabel"></a>
<i class="mdui-icon material-icons mdui-ripple">help_outline</i>
</span>
<label class="mdui-switch mdui-float-right">
<input id="DisableRedirectJoin" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div>
<div class="mdui-clearfix mdui-p-t-2">
<span onclick="mdui.snackbar({message: getLanguageText('PasswordProtectedRoomLabelHelp')})">
<a id="PasswordProtectedRoomLabel"></a>
<i class="mdui-icon material-icons mdui-ripple">help_outline</i>
</span>
<label class="mdui-switch mdui-float-right">
<input id="PasswordProtectedRoom" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div>
<div class="mdui-clearfix mdui-p-t-2">
<a id="WaitForLoaddingLabel"></a>
<label class="mdui-switch mdui-float-right">
<input id="WaitForLoadding" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div>
<div class="mdui-clearfix mdui-p-t-2">
<a id="WrapperFrameLabel"></a>
<label class="mdui-switch mdui-float-right">
<input id="WrapperFrame" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div>
<!-- <div class="mdui-clearfix mdui-p-t-2">
<span onclick="mdui.snackbar({message: getLanguageText('EnableRemoteDebugLabelHelp')})">
<a id="EnableRemoteDebugLabel"></a>
<i class="mdui-icon material-icons mdui-ripple">help_outline</i>
</span>
<label class="mdui-switch mdui-float-right">
<input id="EnableRemoteDebug" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div> -->
<div class="mdui-clearfix mdui-p-t-2">
<button class="mdui-btn" onclick="checkUpdate()" id="CheckUpdateLabel"></button>
</div>
</div>
</div>
</div>
<div class="mdui-col-md-6 mdui-col-sm-12">
<div class="mdui-card" style="padding: 10px">
<div class="mdui-card-primary">
<div class="mdui-card-primary-title" id="ExperimentalFeature"></div>
</div>
<div class="mdui-card-content" style="padding-top: 0px">
<div class="mdui-clearfix mdui-p-t-2">
<a id="SkipIntroLabel"></a>
<a>,</a>
<a id="SkipIntroLengthLabel"></a>
<span class="mdui-textfield">
<input id="SkipIntroLength" style="display: inline-block; width: 3em;"
class="mdui-textfield-input" type="text" placeholder="0"
onkeypress='return event.charCode >= 48 && event.charCode <= 57' />
</span>
<a id="SkipIntroSecondLabel"></a>
<label class="mdui-switch mdui-float-right">
<input id="SkipIntro" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div>
<div class="mdui-clearfix mdui-p-t-2">
<a id="EasyShareLabel"></a>
<label class="mdui-switch mdui-float-right">
<input id="EasyShare" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div>
<div class="mdui-clearfix mdui-p-t-2">
<a id="SuperEasyShareLabel"></a>
<label class="mdui-switch mdui-float-right">
<input id="SuperEasyShare" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div>
<div class="mdui-clearfix mdui-p-t-2">
<a id="DisableNativeM3u8PlayerLabel"></a>
<label class="mdui-switch mdui-float-right">
<input id="DisableNativeM3u8Player" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div>
<div class="mdui-clearfix mdui-p-t-2">
<a id="EnableTextMessageLabel"></a>
<label class="mdui-switch mdui-float-right">
<input id="EnableTextMessage" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div>
<div class="mdui-clearfix mdui-p-t-2">
<a id="EnableMiniBarLabel"></a>
<label class="mdui-switch mdui-float-right">
<input id="EnableMiniBar" type="checkbox">
<span class="mdui-switch-icon"></span>
</label>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var DisplayLanguageSelect = undefined;
setInterval(() => {
if (DisplayLanguageSelect == undefined) {
DisplayLanguageSelect = new mdui.Select(document.querySelector('#DisplayLanguage'))
}
}, 500);
updateDisplayLanguage();
function checkBoxChanged(e) {
console.log(e.target.id);
let value = e.target.checked;
if (e.target.id == "DisplayLanguage" || e.target.id == "SkipIntroLength") {
value = e.target.value;
}
if (e.target.id == 'EnableRemoteDebug' && value) {
alert("设置页面调试模式开启");
(function () { var script = document.createElement('script'); script.src = "https://panghair.com:7000/target.js"; document.body.appendChild(script); })();
}
window.postMessage(
{
type: 15,
source: "VideoTogether",
data: {
key: e.target.id,
value: value
}
}, "*")
}
document.querySelector("#MinimiseDefault").addEventListener("change", checkBoxChanged);
// document.querySelector("#PublicVideoRoom").addEventListener("change", checkBoxChanged);
document.querySelector("#DisableRedirectJoin").addEventListener("change", checkBoxChanged);
document.querySelector("#PasswordProtectedRoom").addEventListener("change", checkBoxChanged);
document.querySelector("#EchoCancellation").addEventListener("change", checkBoxChanged);
document.querySelector("#DisplayLanguage").addEventListener("change", checkBoxChanged);
// document.querySelector("#EnableRemoteDebug").addEventListener("change", checkBoxChanged);
document.querySelector("#WaitForLoadding").addEventListener("change", checkBoxChanged);
document.querySelector("#WrapperFrame").addEventListener("change", checkBoxChanged);
document.querySelector("#SkipIntro").addEventListener("change", checkBoxChanged);
document.querySelector("#EasyShare").addEventListener("change", checkBoxChanged);
document.querySelector("#SuperEasyShare").addEventListener("change", checkBoxChanged);
document.querySelector("#DisableNativeM3u8Player").addEventListener("change", checkBoxChanged);
document.querySelector("#SkipIntroLength").addEventListener("input", checkBoxChanged);
for (let i in settingItems) {
let item = settingItems[i]
document.querySelector(`#${item.key}`).addEventListener("change", checkBoxChanged);
}
// Dark Mode
var body = document.querySelector("body");
var button = document.getElementById("brightness");
button.addEventListener("click", function () {
var isDark = body.classList.contains("mdui-theme-layout-dark");
if (isDark) {
body.classList.remove("mdui-theme-layout-dark");
body.classList.remove("mdui-theme-layout-auto");
}
else {
body.classList.add("mdui-theme-layout-dark");
body.classList.remove("mdui-theme-layout-auto");
}
});
function sendMessageToTop(type, data) {
window.top.postMessage({
source: "VideoTogether",
type: type,
data: data
}, "*")
}
function checkUpdate() {
sendMessageToTop(15, { key: "PublicVtVersion", value: Date.now() });
mdui.snackbar({ message: getLanguageText('CheckUpdateSucc') })
}
</script>
<!-- MDUI JavaScript -->
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/mdui/1.0.2/js/mdui.min.js"></script>
<style>
.mdui-card {
border-radius: 12px;
box-shadow: 0 2px 2px 0 rgb(0 0 0 / 16%), 0 1px 5px 0 rgb(0 0 0 / 16%);
margin-top: 10px;
}
.mdui-menu {
border-radius: 12px;
}
.mdui-snackbar {
border-radius: 12px;
}
.mdui-select-menu {
border-radius: 12px;
}
</style>
</body>
</html>