Modified play script to substitute href of <a> tag in case that <video> tag is absent. This is for the ShiftFreq feature

This commit is contained in:
Louis Croisez
2023-05-08 17:50:56 +02:00
parent 3f07679e05
commit efe52a4638
+24 -10
View File
@@ -254,21 +254,35 @@ function toggleShiftFreq(filename, shiftAction, elem) {
elem.setAttribute("title", "This file has been shifted down in frequency."); elem.setAttribute("title", "This file has been shifted down in frequency.");
elem.setAttribute("onclick", elem.getAttribute("onclick").replace("shift","unshift")); elem.setAttribute("onclick", elem.getAttribute("onclick").replace("shift","unshift"));
console.log("shifted freqs of " + filename); console.log("shifted freqs of " + filename);
video=elem.parentNode.getElementsByTagName("video")[0]; video=elem.parentNode.getElementsByTagName("video");
video.setAttribute("title", video.getAttribute("title").replace("/By_Date/","/By_Date/shifted/")); console.log(video)
source = video.getElementsByTagName("source")[0]; console.log("len of video: " + video.length)
source.setAttribute("src", source.getAttribute("src").replace("/By_Date/","/By_Date/shifted/")); if (video.length > 0) {
video.load(); video[0].setAttribute("title", video[0].getAttribute("title").replace("/By_Date/","/By_Date/shifted/"));
source = video[0].getElementsByTagName("source")[0];
source.setAttribute("src", source.getAttribute("src").replace("/By_Date/","/By_Date/shifted/"));
video[0].load();
} else {
atag=elem.parentNode.getElementsByTagName("a")[0];
atag.setAttribute("href", atag.getAttribute("href").replace("/By_Date/","/By_Date/shifted/"));
}
} else { } else {
elem.setAttribute("src","images/shift.svg"); elem.setAttribute("src","images/shift.svg");
elem.setAttribute("title", "This file is not shifted in frequency."); elem.setAttribute("title", "This file is not shifted in frequency.");
elem.setAttribute("onclick", elem.getAttribute("onclick").replace("unshift","shift")); elem.setAttribute("onclick", elem.getAttribute("onclick").replace("unshift","shift"));
console.log("unshifted freqs of " + filename); console.log("unshifted freqs of " + filename);
video=elem.parentNode.getElementsByTagName("video")[0]; video=elem.parentNode.getElementsByTagName("video");
video.setAttribute("title", video.getAttribute("title").replace("/By_Date/shifted/","/By_Date/")); console.log(video)
source = video.getElementsByTagName("source")[0]; console.log("len of video: " + video.length)
source.setAttribute("src", source.getAttribute("src").replace("/By_Date/shifted/","/By_Date/")); if (video.length > 0) {
video.load(); video[0].setAttribute("title", video[0].getAttribute("title").replace("/By_Date/shifted/","/By_Date/"));
source = video[0].getElementsByTagName("source")[0];
source.setAttribute("src", source.getAttribute("src").replace("/By_Date/shifted/","/By_Date/"));
video[0].load();
} else {
atag=elem.parentNode.getElementsByTagName("a")[0];
atag.setAttribute("href", atag.getAttribute("href").replace("/By_Date/shifted/","/By_Date/"));
}
} }
} }
} }