mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-31 07:11:33 +00:00
Updated player.js
This commit is contained in:
parent
c16dac81ea
commit
5426c6f98d
@ -61,7 +61,7 @@ page.reloadVideo = () => {
|
|||||||
const src = `${page.uploadRoot}/${page.urlInput.value}`
|
const src = `${page.uploadRoot}/${page.urlInput.value}`
|
||||||
|
|
||||||
axios.head(src).then(response => {
|
axios.head(src).then(response => {
|
||||||
if (response.status !== 200 && response.status !== 304) {
|
if (![200, 304].includes(response.status)) {
|
||||||
page.toggleReloadBtn(true)
|
page.toggleReloadBtn(true)
|
||||||
return page.onAxiosError(response)
|
return page.onAxiosError(response)
|
||||||
}
|
}
|
||||||
@ -74,6 +74,8 @@ page.reloadVideo = () => {
|
|||||||
return swal('An error occurred!', 'The requested upload does not appear to be a media file.', 'error')
|
return swal('An error occurred!', 'The requested upload does not appear to be a media file.', 'error')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
page.urlIdentifier = page.urlInput.value
|
||||||
|
|
||||||
if (page.player) {
|
if (page.player) {
|
||||||
page.player.dispose()
|
page.player.dispose()
|
||||||
page.videoContainer.innerHTML = ''
|
page.videoContainer.innerHTML = ''
|
||||||
@ -112,14 +114,14 @@ page.reloadVideo = () => {
|
|||||||
page.player.seekButtons({ forward: 10, back: 10 })
|
page.player.seekButtons({ forward: 10, back: 10 })
|
||||||
|
|
||||||
if (page.titleFormat) {
|
if (page.titleFormat) {
|
||||||
document.title = page.titleFormat.replace(/%identifier%/g, page.urlInput.value)
|
document.title = page.titleFormat.replace(/%identifier%/g, page.urlIdentifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page.downloadBtn) {
|
if (page.downloadBtn) {
|
||||||
page.downloadBtn.setAttribute('href', src)
|
page.downloadBtn.setAttribute('href', src)
|
||||||
}
|
}
|
||||||
|
|
||||||
window.history.pushState(null, null, page.urlPrefix + page.urlInput.value)
|
window.history.pushState(null, null, page.urlPrefix + page.urlIdentifier)
|
||||||
page.toggleReloadBtn(true)
|
page.toggleReloadBtn(true)
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
page.toggleReloadBtn(true)
|
page.toggleReloadBtn(true)
|
||||||
|
Loading…
Reference in New Issue
Block a user