-
Notifications
You must be signed in to change notification settings - Fork 0
/
网易见外工作台.js
138 lines (113 loc) · 3.73 KB
/
网易见外工作台.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
// ==UserScript==
// @name 网易见外工作台
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://jianwai.youdao.com/videocheck/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youdao.com
// @require https://code.jquery.com/jquery-2.1.4.min.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
// setInterval(() => {
// document.querySelector("div.caption-text.caption-text-bg").style.display="block"
// }, 1000);
setTimeout(() => {
add_button()
}, 2000);
})();
function add_button() {
'use strict';
document.querySelector("div.c-caption-check > div.r-area").style.marginLeft="950px"
document.querySelector("div.c-video > video").style.maxHeight="none"
add_container();
var button1 = document.createElement("button"); //创建一个input对象(提示框按钮)
// button1.id = "id001";
button1.textContent = "切换视频宽度";
button1.style.display = "block";
button1.style.fontSize = "0.2rem";
button1.title = ""
button1.onclick = function () {
let now_width = document.querySelector("div.c-video > video").style.width
if (now_width == '') {
document.querySelector("div.c-video > video").style.width = "1000px"
} else {
document.querySelector("div.c-video > video").style.width = ""
let evt = new MouseEvent("mousedown", {//Uncaught ReferenceError: evt is not defined
bubbles: true,
cancelable: true,
view: window,
});
document.querySelector("span.icon.icon-expand").dispatchEvent(evt);
}
return;
};
background_color(button1);
///////////
//在浏览器控制台可以查看所有函数,ctrl+shift+I 调出控制台,在Console窗口进行实验测试
var contain_ = document.querySelector("#sp-ac-container")
contain_.appendChild(button1);
// // contain_.innerHTML += `<span class="tooltiptext">提示文本</span>`//不能用innerHTML,否则event会消失
// var span_tip = document.createElement("span");
// span_tip.textContent = "提示文本"
// span_tip.className = "tooltiptext";
// contain_.appendChild(span_tip);
//var y = document.getElementById('s_btn_wr');
//y.appendChild(button);
const styleText = `
.tooltiptext {
//visibility: hidden;
display: none;
//width: 120px;
background-color: black;
color: #fff;
text-align: center;
//border-radius: 6px;
//padding: 5px 0;
/* 定位 */
position: absolute;
//z-index: 1;
}
.tooltiptext:hover {
display: inline;
}
`
const style = GM_addStyle(styleText);
}
function add_container() {
let Container = document.createElement('div');
Container.id = "sp-ac-container";
Container.style.position = "fixed";
Container.style.right = "150px";
Container.style.top = "0px";
document.body.appendChild(Container);
}
function background_color(button) {
button.onmouseover = function () {
this.style.backgroundColor = 'cyan';
};
button.onmouseout = function () {
this.style.backgroundColor = 'transparent';
};
}
function display_block(){
setTimeout(() => {
document.querySelector("div.caption-text.caption-text-bg").style.display="block"
}, 50);
}
$(document).ready(function () {
$(document).keydown(function (event) { //调用键盘编码,按了键盘回调keydown里的function(event)函数,event就是你按的那个按键的code码
debugger
// console.log(event.altKey);
// console.log(event.keyCode)
// if (event.keyCode == 77 && event.altKey){
// click_nextpage();
// }
display_block();
});
$(document).click(function (event) {
display_block();
});
});