Fix script variable issues.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Captain ALM 2022-07-30 21:06:04 +01:00
parent 8f3fc74270
commit 4c180c0966
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1

View File

@ -27,7 +27,7 @@ function CreateEntry(id, name, videourl, videotype, start, end, duration) {
}; };
} }
function CreateVideoPlaceholder(id) { function CreateVideoPlaceholder(id) {
let imgPH = document.createElement("img") var imgPH = document.createElement("img")
imgPH.src = PlayImageURL imgPH.src = PlayImageURL
imgPH.id = "play-"+id imgPH.id = "play-"+id
imgPH.alt = "Play Video" imgPH.alt = "Play Video"
@ -43,15 +43,15 @@ function CreateVideoPlaceholder(id) {
document.getElementById("video-" + id).appendChild(imgPH) document.getElementById("video-" + id).appendChild(imgPH)
} }
function ActivateVideo(id) { function ActivateVideo(id) {
let holder = document.getElementById("video-" + id) var holder = document.getElementById("video-" + id)
holder.removeChild(document.getElementById("play-"+id)) holder.removeChild(document.getElementById("play-"+id))
let vid = document.createElement("video") var vid = document.createElement("video")
vid.controls = true vid.controls = true
vid.width = 360 vid.width = 360
let vids = document.createElement("source") var vids = document.createElement("source")
vids.src = EntryData[id].videourl vids.src = EntryData[id].videourl
vids.type = EntryData[id].videotype vids.type = EntryData[id].videotype
let vida = document.createElement("a") var vida = document.createElement("a")
vida.href = EntryData[id].videourl vida.href = EntryData[id].videourl
vida.innerText = "The Video" vida.innerText = "The Video"
vid.appendChild(vids) vid.appendChild(vids)
@ -65,17 +65,17 @@ function SetupIndexArray() {
} }
} }
function SetupJSTheme() { function SetupJSTheme() {
let th = document.getElementById("theme") var th = document.getElementById("theme")
th.href = "#" th.href = "#"
if (document.addEventListener) { if (document.addEventListener) {
th.addEventListener("click", ToggleTheme) th.addEventListener("click", Toggvarheme)
} else { } else {
th.setAttribute("onclick", "ToggleTheme();") th.setAttribute("onclick", "Toggvarheme();")
th.onclick = ToggleTheme th.onclick = Toggvarheme
} }
} }
function ReplaceHistory(url) { function ReplaceHistory(url) {
let s = true var s = true
if (window.history) { if (window.history) {
if (window.history.replaceState) { if (window.history.replaceState) {
window.history.replaceState({ window.history.replaceState({
@ -90,12 +90,12 @@ function ReplaceHistory(url) {
document.location.href = url document.location.href = url
} }
} }
function ToggleTheme() { function Toggvarheme() {
let th = document.getElementById("theme") var th = document.getElementById("theme")
let thimg = document.getElementById("theme-img") var thimg = document.getElementById("theme-img")
let thsty = document.getElementById("style-theme") var thsty = document.getElementById("style-theme")
let logo = document.getElementById("logo") var logo = document.getElementById("logo")
let url = document.location.href var url = document.location.href
url = url.split("#", 1)[0].split('?', 1)[0] url = url.split("#", 1)[0].split('?', 1)[0]
if (document.getElementById("so-theme")) { if (document.getElementById("so-theme")) {
thimg.src = SunImageURL thimg.src = SunImageURL
@ -109,7 +109,7 @@ function ToggleTheme() {
thimg.src = MoonImageURL thimg.src = MoonImageURL
thimg.alt = "{" thimg.alt = "{"
th.title = "Switch to Dark Mode" th.title = "Switch to Dark Mode"
let thi = document.createElement("input") var thi = document.createElement("input")
thi.name = "light" thi.name = "light"
thi.type = "hidden" thi.type = "hidden"
thi.id = "so-theme" thi.id = "so-theme"
@ -131,8 +131,8 @@ function SetupJSHPL(){
function HandleHistoryPop(event) { function HandleHistoryPop(event) {
if (event.state) { if (event.state) {
SortOrderEnabled = false SortOrderEnabled = false
let isnl = !document.getElementById("so-theme") var isnl = !document.getElementById("so-theme")
if ((event.state.light && isnl) || (!event.state.light && !isnl)) {ToggleTheme();} if ((event.state.light && isnl) || (!event.state.light && !isnl)) {Toggvarheme();}
document.getElementById("so-order").value = event.state.order document.getElementById("so-order").value = event.state.order
document.getElementById("so-sort").value = event.state.sort document.getElementById("so-sort").value = event.state.sort
EntrySort(event.state.order, event.state.sort) EntrySort(event.state.order, event.state.sort)
@ -140,8 +140,8 @@ function HandleHistoryPop(event) {
} }
} }
function SetupJSHSO() { function SetupJSHSO() {
let pb = document.getElementById("sort-menu-button") var pb = document.getElementById("sort-menu-button")
let pane = document.getElementById("so-pane") var pane = document.getElementById("so-pane")
if (document.addEventListener) { if (document.addEventListener) {
document.addEventListener("click", HandleGlobalClick) document.addEventListener("click", HandleGlobalClick)
pb.addEventListener("mouseover", HandleSortOrderBEnter) pb.addEventListener("mouseover", HandleSortOrderBEnter)
@ -177,11 +177,11 @@ function HandleSortOrderLeave(){
SortOrderStateI = true SortOrderStateI = true
} }
function SetupJSSOI() { function SetupJSSOI() {
let submit = document.getElementById("so-submit") var submit = document.getElementById("so-submit")
if (submit.parentNode) {submit.parentNode.removeChild(submit);} if (submit.parentNode) {submit.parentNode.removeChild(submit);}
let oc = document.getElementById("so-order") var oc = document.getElementById("so-order")
OrderValue = oc.value OrderValue = oc.value
let sc = document.getElementById("so-sort") var sc = document.getElementById("so-sort")
SortValue = sc.value SortValue = sc.value
if (document.addEventListener) { if (document.addEventListener) {
oc.addEventListener("change", HandleSortOrderChange) oc.addEventListener("change", HandleSortOrderChange)
@ -210,7 +210,7 @@ function EntrySort(o, s) {
ts = 1 ts = 1
} }
if (OrderValue !== o) { if (OrderValue !== o) {
let to = o.toString().toLowerCase() var to = o.toString().toLowerCase()
if (to === "start") { if (to === "start") {
if (ts < 0) { if (ts < 0) {
EntryIndices = EntryIndices.sort(SortStartD) EntryIndices = EntryIndices.sort(SortStartD)
@ -241,7 +241,7 @@ function EntrySort(o, s) {
} }
if (chg) { if (chg) {
TheParameters = "order="+OrderValue+"&sort="+SortValue TheParameters = "order="+OrderValue+"&sort="+SortValue
url = url.split("#", 1)[0].split('?', 1)[0] var url = url.split("#", 1)[0].split('?', 1)[0]
if (document.getElementById("so-theme")) { if (document.getElementById("so-theme")) {
ReplaceHistory(url+"?light&"+TheParameters) ReplaceHistory(url+"?light&"+TheParameters)
} else { } else {