forked from Debuffxb/PT-Script
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInfoSync.js
More file actions
237 lines (231 loc) · 7 KB
/
InfoSync.js
File metadata and controls
237 lines (231 loc) · 7 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
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
// ==UserScript==
// @name PT-Script-InfoSync
// @namespace http://tampermonkey.net/
// @version 0.0.1
// @author Lepton
// @updateURL https://raw.githubusercontent.com/Debuffxb/PT-Script/master/InfoSync.js
// @downloadURL https://raw.githubusercontent.com/Debuffxb/PT-Script/master/InfoSync.js
// @homepage https://github.com/Debuffxb/PT-Script
// @match https://moecat.best/upload*
// @match https://pthome.net/upload*
// @match https://www.beitai.pt/upload*
// @match https://pterclub.com/upload*
// @match http://hdhome.org/upload*
// @match http://ourbits.club/upload*
// @match https://pt.btschool.club/upload*
// @match https://www.nicept.net/upload*
// @match https://leaguehd.com/upload*
// @match https://leaguehd.com/offers.php?add_offer=1
// @require https://cdn.bootcss.com/jquery/3.5.0/jquery.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
var sites = [];
var element = [];
var content = [];
//pthome.net
sites[0] = 'pthome.net';
element[0] = ['name', 'small_descr', 'descr']
content[0] = ['name', 'small_descr', 'descr']
//btschool
sites[1] = 'pt.btschool.club';
element[1] = ['name', 'small_descr', 'descr', 'imdbid', 'doubanid']
content[1] = ['name', 'small_descr', 'descr', 'imdb_url', 'douban_url']
//leaguehd
sites[2] = 'leaguehd.com';
element[2] = ['name', 'small_descr', 'body']
content[2] = ['name', 'small_descr', 'descr']
var father = document.createElement('div');
var child = document.createElement('div');
var css = document.createElement('style');
css.type = 'text/css';
var str = '\
.tzui-text{\
position: relative;\
margin:0 auto;\
padding-top: 2rem;\
padding-bottom: 2rem;\
}\
.tzui-text-label,\
.tzui-text-input {\
color:black;\
display: block;\
font-size: 1rem;\
position: absolute;\
outline: none;\
cursor: text;\
border: 0;\
top:1rem;\
text-align: left;\
width: 100%;\
}\
\
.tzui-text-input{\
border-bottom: .125rem solid gray;\
}\
.tzui-text-input::placeholder{\
transition: inherit;\
opacity: 0;\
}\
\
.tzui-text-label{\
padding-right: 0.5rem;\
}\
\
.tzui-text-label,\
.tzui-text-input:focus,\
.tzui-text-input:focus+.tzui-text-label{\
transition-duration: .5s;\
-webkit-transition-duration: .5s;\
}\
\
.tzui-text-input:not(:placeholder-shown)+.tzui-text-label,\
.tzui-text-input:focus+.tzui-text-label{\
animation: label-amp 0.5s;\
top:.125rem;\
font-size: 0.5rem;\
}\
.tzui-text-input:focus{\
border-bottom: .125rem solid lightcoral;\
}\
\
@keyframes label-amp {\
0%{\
font-size: 1rem;\
top:1rem;\
}\
100%{\
font-size: 0.5rem;\
top:.125rem;\
}\
}\
\
.tzui-btn{;\
position: relative;\
padding: 0.5rem 0.8rem;\
border:1px solid lightseagreen;\
display:block;\
font-size: 1rem;\
font-family: Monaco,monospace;\
cursor: pointer;\
text-align: center;\
color: black;\
overflow: hidden;\
outline: none;\
transition-duration: .5s;\
-webkit-transition-duration: .5s;\
}\
\
.tzui-btn:hover {\
box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);\
}\
\
.tzui-btn-ripple::after{\
transition-duration: .5s;\
-webkit-transition-duration: .5s;\
}\
\
.tzui-btn-ripple::after{\
content: "";\
background-color: lightskyblue;\
border-radius: 4em;\
display: block;\
position: absolute;\
width: 100%;\
top:0;\
height: 100%;\
left: 0;\
opacity:0;\
}\
\
.tzui-btn-ripple:active::after{\
left: 50%;\
width: 0;\
height: 0;\
top:50%;\
transition: 0s;\
opacity:1;\
}\
';
css.innerHTML = str;
document.getElementsByTagName('head')[0].append(css);
father.style.width = '100%';
father.style.position = 'fixed';
father.style.top = '10px';
document.getElementsByTagName('body')[0].append(father);
father.append(child);
var link = document.createElement('div');
link.style = 'width: 40%; max-width: 30rem; min-width: 10rem; background: lightpink; margin:0 auto';
child.append(link);
var btn_f = document.createElement('div');
btn_f.style = 'width: 10em; margin:0 auto;'
var btn = document.createElement('div');
btn.className = 'tzui-btn tzui-btn-ripple';
btn.style = 'height:100%, width: 100%;background: lightcyan'
link.append(btn_f);
btn_f.append(btn);
if( window.location.host == 'moecat.best'){
btn.innerHTML = '上传';
btn.addEventListener('click', function (){
var url = 'https://service-hcgq8ojo-1257040192.hk.apigw.tencentcs.com/release/Torrent';
var data = {
"name": document.getElementById('name').value,
"douban_url": document.getElementById('external_url').value,
"small_descr": document.getElementsByName('small_descr')[0].value,
"imdb_url": document.getElementById('imdburl').value,
"descr": document.getElementById('descr').value
}
jQuery.ajax({
type: 'POST',
url: url,
data: JSON.stringify(data),
withCredentials: true,
cache: false,
contentType: false,
processData: false,
success: function (data) {
if(data.state != 'OK'){
return btn.innerHTML = '失败';
}
return btn.innerHTML = '成功';
},
error: function(xhr,state,errorThrown){
alert(state);
}
});
});
} else {
btn.innerHTML = '同步';
for(var i = 0; i < sites.length; i++){
if(window.location.host == sites[i]){
btn.addEventListener('click', function (){
var url = '';
jQuery.ajax({
type: 'GET',
url: url,
withCredentials: true,
cache: false,
contentType: false,
processData: false,
success: function (data) {
if(data.state != 'OK'){
return btn.innerHTML = '失败';
}
for(var j = 0; j < element[i].length; j++){
//console.log(element[i], element[i][j]);
document.getElementsByName(element[i][j])[0].value = data.result[content[i][j]];
}
return btn.innerHTML = '成功';
},
error: function(xhr,state,errorThrown){
alert(state);
}
});
});
return;
}
}
}
// Your code here...
})();