chaowenguo
commited on
Commit
•
bbe4369
1
Parent(s):
93174e5
Update index.js
Browse files
index.js
CHANGED
@@ -7,7 +7,7 @@ for (const button of globalThis.document.querySelectorAll('div[style*="justify-c
|
|
7 |
{
|
8 |
const list = globalThis.document.querySelector('div[style*="flex-direction"]')
|
9 |
for (const hyperlink of list.querySelectorAll('a')) hyperlink.remove()
|
10 |
-
for (const episode of await globalThis.fetch('https://backend.chaowenguo.eu.org/list', {method:'post', body:event.target.textContent}).then(_ => _.json()))
|
11 |
{
|
12 |
const hyperlink = globalThis.document.createElement('a')
|
13 |
hyperlink.href = ['', event.target.textContent, episode].join('/')
|
@@ -18,16 +18,19 @@ for (const button of globalThis.document.querySelectorAll('div[style*="justify-c
|
|
18 |
}
|
19 |
const drama = globalThis.decodeURIComponent(globalThis.location.pathname).slice(1)
|
20 |
globalThis.document.querySelector('title').textContent = globalThis.document.querySelector('h1').textContent = drama.split('/').at(-1)
|
21 |
-
|
22 |
{
|
23 |
-
const
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
globalThis.document.
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
33 |
}
|
|
|
7 |
{
|
8 |
const list = globalThis.document.querySelector('div[style*="flex-direction"]')
|
9 |
for (const hyperlink of list.querySelectorAll('a')) hyperlink.remove()
|
10 |
+
for (const episode of await globalThis.fetch('https://backend.chaowenguo.eu.org/list', {method:'post', headers:{'content-type':'application/x-www-form-urlencoded'}, body:event.target.textContent}).then(_ => _.json()))
|
11 |
{
|
12 |
const hyperlink = globalThis.document.createElement('a')
|
13 |
hyperlink.href = ['', event.target.textContent, episode].join('/')
|
|
|
18 |
}
|
19 |
const drama = globalThis.decodeURIComponent(globalThis.location.pathname).slice(1)
|
20 |
globalThis.document.querySelector('title').textContent = globalThis.document.querySelector('h1').textContent = drama.split('/').at(-1)
|
21 |
+
if (drama)
|
22 |
{
|
23 |
+
for (const episode of globalThis.Array(globalThis.Number(await globalThis.fetch('https://backend.chaowenguo.eu.org/episode', {method:'post', headers:{'content-type':'application/x-www-form-urlencoded'}, body:drama}).then(_ => _.text()))).keys())
|
24 |
+
{
|
25 |
+
const button = globalThis.document.createElement('button')
|
26 |
+
button.textContent = (episode + 1).toString().padStart(2, 0)
|
27 |
+
globalThis.document.querySelector('body > nav').appendChild(button)
|
28 |
+
}
|
29 |
+
for (const button of globalThis.document.querySelectorAll('body > nav > button')) button.onclick = async event =>
|
30 |
+
{
|
31 |
+
globalThis.document.querySelector('video').querySelector('source').src = await globalThis.fetch('https://backend.chaowenguo.eu.org/mp4', {method:'post', headers:{'content-type':'application/json'}, body:globalThis.JSON.stringify({drama, episode:event.target.textContent})}).then(_ => _.text())
|
32 |
+
globalThis.document.querySelector('video').querySelector('track').src = globalThis.URL.createObjectURL(await globalThis.fetch('https://backend.chaowenguo.eu.org', {method:'post', body:globalThis.JSON.stringify({drama, episode:event.target.textContent})}).then(_ => _.blob()))
|
33 |
+
globalThis.document.querySelector('video').load()
|
34 |
+
globalThis.document.querySelector('title').textContent = drama + event.target.textContent
|
35 |
+
}
|
36 |
}
|