mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 03:40:14 +00:00
chore: don't need to load script.js anymore
This commit is contained in:
parent
42ff29c13d
commit
4e4db8f0ae
@ -1,8 +1,7 @@
|
||||
|
||||
function sortChange(sortValue) {
|
||||
var payload = JSON.stringify({'sort_order': sortValue});
|
||||
var payload = JSON.stringify({ sort_order: sortValue });
|
||||
sendPost(payload);
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
return false;
|
||||
}, 500);
|
||||
@ -22,11 +21,11 @@ function updateVideoWatchStatus(input1, videoCurrentWatchStatus) {
|
||||
|
||||
if (videoCurrentWatchStatus == "watched") {
|
||||
var watchStatusIndicator = createWatchStatusIndicator(videoId, "unwatched");
|
||||
var payload = JSON.stringify({'un_watched': videoId});
|
||||
var payload = JSON.stringify({ un_watched: videoId });
|
||||
sendPost(payload);
|
||||
} else if (videoCurrentWatchStatus == "unwatched") {
|
||||
var watchStatusIndicator = createWatchStatusIndicator(videoId, "watched");
|
||||
var payload = JSON.stringify({'watched': videoId});
|
||||
var payload = JSON.stringify({ watched: videoId });
|
||||
sendPost(payload);
|
||||
}
|
||||
|
||||
@ -71,10 +70,10 @@ function removeProgressBar(videoId) {
|
||||
|
||||
function isWatchedButton(button) {
|
||||
youtube_id = button.getAttribute("data-id");
|
||||
var payload = JSON.stringify({'watched': youtube_id});
|
||||
var payload = JSON.stringify({ watched: youtube_id });
|
||||
button.remove();
|
||||
sendPost(payload);
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
return false;
|
||||
}, 1000);
|
||||
@ -95,17 +94,17 @@ function isWatchedButton(button) {
|
||||
// }
|
||||
|
||||
function unsubscribe(id_unsub) {
|
||||
var payload = JSON.stringify({'unsubscribe': id_unsub});
|
||||
var payload = JSON.stringify({ unsubscribe: id_unsub });
|
||||
sendPost(payload);
|
||||
var message = document.createElement('span');
|
||||
var message = document.createElement("span");
|
||||
message.innerText = "You are unsubscribed.";
|
||||
document.getElementById(id_unsub).replaceWith(message);
|
||||
}
|
||||
|
||||
function subscribe(id_sub) {
|
||||
var payload = JSON.stringify({'subscribe': id_sub});
|
||||
var payload = JSON.stringify({ subscribe: id_sub });
|
||||
sendPost(payload);
|
||||
var message = document.createElement('span');
|
||||
var message = document.createElement("span");
|
||||
message.innerText = "You are subscribed.";
|
||||
document.getElementById(id_sub).replaceWith(message);
|
||||
}
|
||||
@ -113,9 +112,9 @@ function subscribe(id_sub) {
|
||||
function changeView(image) {
|
||||
var sourcePage = image.getAttribute("data-origin");
|
||||
var newView = image.getAttribute("data-value");
|
||||
var payload = JSON.stringify({'change_view': sourcePage + ":" + newView});
|
||||
var payload = JSON.stringify({ change_view: sourcePage + ":" + newView });
|
||||
sendPost(payload);
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
return false;
|
||||
}, 500);
|
||||
@ -129,7 +128,7 @@ function toggleCheckbox(checkbox) {
|
||||
payloadDict[toggleId] = toggleVal;
|
||||
var payload = JSON.stringify(payloadDict);
|
||||
sendPost(payload);
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
var currPage = window.location.pathname;
|
||||
window.location.replace(currPage);
|
||||
return false;
|
||||
@ -138,138 +137,138 @@ function toggleCheckbox(checkbox) {
|
||||
|
||||
// download page buttons
|
||||
function rescanPending() {
|
||||
var payload = JSON.stringify({'rescan_pending': true});
|
||||
animate('rescan-icon', 'rotate-img');
|
||||
var payload = JSON.stringify({ rescan_pending: true });
|
||||
animate("rescan-icon", "rotate-img");
|
||||
sendPost(payload);
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
checkMessages();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function dlPending() {
|
||||
var payload = JSON.stringify({'dl_pending': true});
|
||||
animate('download-icon', 'bounce-img');
|
||||
var payload = JSON.stringify({ dl_pending: true });
|
||||
animate("download-icon", "bounce-img");
|
||||
sendPost(payload);
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
checkMessages();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function toIgnore(button) {
|
||||
var youtube_id = button.getAttribute('data-id');
|
||||
var payload = JSON.stringify({'ignore': youtube_id});
|
||||
var youtube_id = button.getAttribute("data-id");
|
||||
var payload = JSON.stringify({ ignore: youtube_id });
|
||||
sendPost(payload);
|
||||
document.getElementById('dl-' + youtube_id).remove();
|
||||
document.getElementById("dl-" + youtube_id).remove();
|
||||
}
|
||||
|
||||
function downloadNow(button) {
|
||||
var youtube_id = button.getAttribute('data-id');
|
||||
var payload = JSON.stringify({'dlnow': youtube_id});
|
||||
var youtube_id = button.getAttribute("data-id");
|
||||
var payload = JSON.stringify({ dlnow: youtube_id });
|
||||
sendPost(payload);
|
||||
document.getElementById(youtube_id).remove();
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
checkMessages();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function forgetIgnore(button) {
|
||||
var youtube_id = button.getAttribute('data-id');
|
||||
var payload = JSON.stringify({'forgetIgnore': youtube_id});
|
||||
var youtube_id = button.getAttribute("data-id");
|
||||
var payload = JSON.stringify({ forgetIgnore: youtube_id });
|
||||
sendPost(payload);
|
||||
document.getElementById("dl-" + youtube_id).remove();
|
||||
}
|
||||
|
||||
function addSingle(button) {
|
||||
var youtube_id = button.getAttribute('data-id');
|
||||
var payload = JSON.stringify({'addSingle': youtube_id});
|
||||
var youtube_id = button.getAttribute("data-id");
|
||||
var payload = JSON.stringify({ addSingle: youtube_id });
|
||||
sendPost(payload);
|
||||
document.getElementById("dl-" + youtube_id).remove();
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
checkMessages();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function deleteQueue(button) {
|
||||
var to_delete = button.getAttribute('data-id');
|
||||
var payload = JSON.stringify({'deleteQueue': to_delete});
|
||||
var to_delete = button.getAttribute("data-id");
|
||||
var payload = JSON.stringify({ deleteQueue: to_delete });
|
||||
sendPost(payload);
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
return false;
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function stopQueue() {
|
||||
var payload = JSON.stringify({'queue': 'stop'});
|
||||
var payload = JSON.stringify({ queue: "stop" });
|
||||
sendPost(payload);
|
||||
document.getElementById('stop-icon').remove();
|
||||
document.getElementById("stop-icon").remove();
|
||||
}
|
||||
|
||||
function killQueue() {
|
||||
var payload = JSON.stringify({'queue': 'kill'});
|
||||
var payload = JSON.stringify({ queue: "kill" });
|
||||
sendPost(payload);
|
||||
document.getElementById('kill-icon').remove();
|
||||
document.getElementById("kill-icon").remove();
|
||||
}
|
||||
|
||||
// settings page buttons
|
||||
function manualImport() {
|
||||
var payload = JSON.stringify({'manual-import': true});
|
||||
var payload = JSON.stringify({ "manual-import": true });
|
||||
sendPost(payload);
|
||||
// clear button
|
||||
var message = document.createElement('p');
|
||||
message.innerText = 'processing import';
|
||||
var toReplace = document.getElementById('manual-import');
|
||||
toReplace.innerHTML = '';
|
||||
var message = document.createElement("p");
|
||||
message.innerText = "processing import";
|
||||
var toReplace = document.getElementById("manual-import");
|
||||
toReplace.innerHTML = "";
|
||||
toReplace.appendChild(message);
|
||||
}
|
||||
|
||||
function reEmbed() {
|
||||
var payload = JSON.stringify({'re-embed': true});
|
||||
var payload = JSON.stringify({ "re-embed": true });
|
||||
sendPost(payload);
|
||||
// clear button
|
||||
var message = document.createElement('p');
|
||||
message.innerText = 'processing thumbnails';
|
||||
var toReplace = document.getElementById('re-embed');
|
||||
toReplace.innerHTML = '';
|
||||
var message = document.createElement("p");
|
||||
message.innerText = "processing thumbnails";
|
||||
var toReplace = document.getElementById("re-embed");
|
||||
toReplace.innerHTML = "";
|
||||
toReplace.appendChild(message);
|
||||
}
|
||||
|
||||
function dbBackup() {
|
||||
var payload = JSON.stringify({'db-backup': true});
|
||||
var payload = JSON.stringify({ "db-backup": true });
|
||||
sendPost(payload);
|
||||
// clear button
|
||||
var message = document.createElement('p');
|
||||
message.innerText = 'backing up archive';
|
||||
var toReplace = document.getElementById('db-backup');
|
||||
toReplace.innerHTML = '';
|
||||
var message = document.createElement("p");
|
||||
message.innerText = "backing up archive";
|
||||
var toReplace = document.getElementById("db-backup");
|
||||
toReplace.innerHTML = "";
|
||||
toReplace.appendChild(message);
|
||||
}
|
||||
|
||||
function dbRestore(button) {
|
||||
var fileName = button.getAttribute("data-id");
|
||||
var payload = JSON.stringify({'db-restore': fileName});
|
||||
var payload = JSON.stringify({ "db-restore": fileName });
|
||||
sendPost(payload);
|
||||
// clear backup row
|
||||
var message = document.createElement('p');
|
||||
message.innerText = 'restoring from backup';
|
||||
var message = document.createElement("p");
|
||||
message.innerText = "restoring from backup";
|
||||
var toReplace = document.getElementById(fileName);
|
||||
toReplace.innerHTML = '';
|
||||
toReplace.innerHTML = "";
|
||||
toReplace.appendChild(message);
|
||||
}
|
||||
|
||||
function fsRescan() {
|
||||
var payload = JSON.stringify({'fs-rescan': true});
|
||||
var payload = JSON.stringify({ "fs-rescan": true });
|
||||
sendPost(payload);
|
||||
// clear button
|
||||
var message = document.createElement('p');
|
||||
message.innerText = 'File system scan in progress';
|
||||
var toReplace = document.getElementById('fs-rescan');
|
||||
toReplace.innerHTML = '';
|
||||
var message = document.createElement("p");
|
||||
message.innerText = "File system scan in progress";
|
||||
var toReplace = document.getElementById("fs-rescan");
|
||||
toReplace.innerHTML = "";
|
||||
toReplace.appendChild(message);
|
||||
}
|
||||
|
||||
function resetToken() {
|
||||
var payload = JSON.stringify({'reset-token': true});
|
||||
var payload = JSON.stringify({ "reset-token": true });
|
||||
sendPost(payload);
|
||||
var message = document.createElement("p");
|
||||
message.innerText = "Token revoked";
|
||||
@ -279,16 +278,16 @@ function resetToken() {
|
||||
// delete from file system
|
||||
function deleteConfirm() {
|
||||
to_show = document.getElementById("delete-button");
|
||||
document.getElementById("delete-item").style.display = 'none';
|
||||
document.getElementById("delete-item").style.display = "none";
|
||||
to_show.style.display = "block";
|
||||
}
|
||||
|
||||
function deleteVideo(button) {
|
||||
var to_delete = button.getAttribute("data-id");
|
||||
var to_redirect = button.getAttribute("data-redirect");
|
||||
var payload = JSON.stringify({"delete-video": to_delete});
|
||||
var payload = JSON.stringify({ "delete-video": to_delete });
|
||||
sendPost(payload);
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
var redirect = "/channel/" + to_redirect;
|
||||
window.location.replace(redirect);
|
||||
return false;
|
||||
@ -297,9 +296,9 @@ function deleteVideo(button) {
|
||||
|
||||
function deleteChannel(button) {
|
||||
var to_delete = button.getAttribute("data-id");
|
||||
var payload = JSON.stringify({"delete-channel": to_delete});
|
||||
var payload = JSON.stringify({ "delete-channel": to_delete });
|
||||
sendPost(payload);
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
window.location.replace("/channel/");
|
||||
return false;
|
||||
}, 1000);
|
||||
@ -311,33 +310,33 @@ function deletePlaylist(button) {
|
||||
var payload = JSON.stringify({
|
||||
"delete-playlist": {
|
||||
"playlist-id": playlist_id,
|
||||
"playlist-action": playlist_action
|
||||
}
|
||||
"playlist-action": playlist_action,
|
||||
},
|
||||
});
|
||||
sendPost(payload);
|
||||
setTimeout(function(){
|
||||
setTimeout(function () {
|
||||
window.location.replace("/playlist/");
|
||||
return false;
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function cancelDelete() {
|
||||
document.getElementById("delete-button").style.display = 'none';
|
||||
document.getElementById("delete-item").style.display = 'block';
|
||||
document.getElementById("delete-button").style.display = "none";
|
||||
document.getElementById("delete-item").style.display = "block";
|
||||
}
|
||||
|
||||
// player
|
||||
function createPlayer(button) {
|
||||
var videoId = button.getAttribute('data-id');
|
||||
var videoId = button.getAttribute("data-id");
|
||||
var videoData = getVideoData(videoId);
|
||||
var videoProgress = getVideoProgress(videoId).position;
|
||||
var videoName = videoData.data.title;
|
||||
|
||||
var videoTag = createVideoTag(videoData, videoProgress);
|
||||
|
||||
var playlist = '';
|
||||
var playlist = "";
|
||||
var videoPlaylists = videoData.data.playlist; // Array of playlists the video is in
|
||||
if (typeof(videoPlaylists) != 'undefined') {
|
||||
if (typeof videoPlaylists != "undefined") {
|
||||
var subbedPlaylists = getSubbedPlaylists(videoPlaylists); // Array of playlist the video is in that are subscribed
|
||||
if (subbedPlaylists.length != 0) {
|
||||
var playlistData = getPlaylistData(subbedPlaylists[0]); // Playlist data for first subscribed playlist
|
||||
@ -356,7 +355,7 @@ function createPlayer(button) {
|
||||
// document.getElementById(videoId).outerHTML = ''; // Remove watch indicator from video info
|
||||
|
||||
// If cast integration is enabled create cast button
|
||||
var castButton = '';
|
||||
var castButton = "";
|
||||
if (videoData.config.application.enable_cast) {
|
||||
var castButton = `<google-cast-launcher id="castbutton"></google-cast-launcher>`;
|
||||
}
|
||||
@ -368,13 +367,15 @@ function createPlayer(button) {
|
||||
var watchStatusIndicator = createWatchStatusIndicator(videoId, "unwatched");
|
||||
}
|
||||
|
||||
|
||||
var playerStats = `<div class="thumb-icon player-stats"><img src="/static/img/icon-eye.svg" alt="views icon"><span>${videoViews}</span>`;
|
||||
if (videoData.data.stats.like_count) {
|
||||
var likes = formatNumbers(videoData.data.stats.like_count);
|
||||
playerStats += `<span>|</span><img src="/static/img/icon-thumb.svg" alt="thumbs-up"><span>${likes}</span>`;
|
||||
}
|
||||
if (videoData.data.stats.dislike_count && videoData.config.downloads.integrate_ryd) {
|
||||
if (
|
||||
videoData.data.stats.dislike_count &&
|
||||
videoData.config.downloads.integrate_ryd
|
||||
) {
|
||||
var dislikes = formatNumbers(videoData.data.stats.dislike_count);
|
||||
playerStats += `<span>|</span><img class="dislike" src="/static/img/icon-thumb.svg" alt="thumbs-down"><span>${dislikes}</span>`;
|
||||
}
|
||||
@ -412,9 +413,12 @@ function createVideoTag(videoData, videoProgress) {
|
||||
var videoId = videoData.data.youtube_id;
|
||||
var videoUrl = videoData.data.media_url;
|
||||
var videoThumbUrl = videoData.data.vid_thumb_url;
|
||||
var subtitles = '';
|
||||
var subtitles = "";
|
||||
var videoSubtitles = videoData.data.subtitles; // Array of subtitles
|
||||
if (typeof(videoSubtitles) != 'undefined' && videoData.config.downloads.subtitle) {
|
||||
if (
|
||||
typeof videoSubtitles != "undefined" &&
|
||||
videoData.config.downloads.subtitle
|
||||
) {
|
||||
for (var i = 0; i < videoSubtitles.length; i++) {
|
||||
let label = videoSubtitles[i].name;
|
||||
if (videoSubtitles[i].source == "auto") {
|
||||
@ -476,7 +480,10 @@ function getVideoPlayerWatchStatus() {
|
||||
|
||||
var watchButtons = document.getElementsByClassName("watch-button");
|
||||
for (let i = 0; i < watchButtons.length; i++) {
|
||||
if (watchButtons[i].getAttribute("data-id") == videoId && watchButtons[i].getAttribute("data-status") == "watched") {
|
||||
if (
|
||||
watchButtons[i].getAttribute("data-id") == videoId &&
|
||||
watchButtons[i].getAttribute("data-status") == "watched"
|
||||
) {
|
||||
watched = true;
|
||||
}
|
||||
}
|
||||
@ -488,9 +495,11 @@ function onVideoProgress() {
|
||||
var videoId = getVideoPlayerVideoId();
|
||||
var currentTime = getVideoPlayerCurrentTime();
|
||||
var duration = getVideoPlayerDuration();
|
||||
if ((currentTime % 10).toFixed(1) <= 0.2) { // Check progress every 10 seconds or else progress is checked a few times a second
|
||||
if ((currentTime % 10).toFixed(1) <= 0.2) {
|
||||
// Check progress every 10 seconds or else progress is checked a few times a second
|
||||
postVideoProgress(videoId, currentTime);
|
||||
if (!getVideoPlayerWatchStatus()) { // Check if video is already marked as watched
|
||||
if (!getVideoPlayerWatchStatus()) {
|
||||
// Check if video is already marked as watched
|
||||
if (watchedThreshold(currentTime, duration)) {
|
||||
updateVideoWatchStatus(videoId, "unwatched");
|
||||
}
|
||||
@ -501,19 +510,24 @@ function onVideoProgress() {
|
||||
// Runs on video end, marks video as watched
|
||||
function onVideoEnded() {
|
||||
var videoId = getVideoPlayerVideoId();
|
||||
if (!getVideoPlayerWatchStatus()) { // Check if video is already marked as watched
|
||||
if (!getVideoPlayerWatchStatus()) {
|
||||
// Check if video is already marked as watched
|
||||
updateVideoWatchStatus(videoId, "unwatched");
|
||||
}
|
||||
}
|
||||
|
||||
function watchedThreshold(currentTime, duration) {
|
||||
var watched = false;
|
||||
if (duration <= 1800){ // If video is less than 30 min
|
||||
if ((currentTime / duration) >= 0.90) { // Mark as watched at 90%
|
||||
if (duration <= 1800) {
|
||||
// If video is less than 30 min
|
||||
if (currentTime / duration >= 0.9) {
|
||||
// Mark as watched at 90%
|
||||
var watched = true;
|
||||
}
|
||||
} else { // If video is more than 30 min
|
||||
if (currentTime >= (duration - 120)) { // Mark as watched if there is two minutes left
|
||||
} else {
|
||||
// If video is more than 30 min
|
||||
if (currentTime >= duration - 120) {
|
||||
// Mark as watched if there is two minutes left
|
||||
var watched = true;
|
||||
}
|
||||
}
|
||||
@ -531,11 +545,14 @@ function onVideoPause() {
|
||||
function formatNumbers(number) {
|
||||
var numberUnformatted = parseFloat(number);
|
||||
if (numberUnformatted > 999999999) {
|
||||
var numberFormatted = (numberUnformatted / 1000000000).toFixed(1).toString() + "B";
|
||||
var numberFormatted =
|
||||
(numberUnformatted / 1000000000).toFixed(1).toString() + "B";
|
||||
} else if (numberUnformatted > 999999) {
|
||||
var numberFormatted = (numberUnformatted / 1000000).toFixed(1).toString() + "M";
|
||||
var numberFormatted =
|
||||
(numberUnformatted / 1000000).toFixed(1).toString() + "M";
|
||||
} else if (numberUnformatted > 999) {
|
||||
var numberFormatted = (numberUnformatted / 1000).toFixed(1).toString() + "K";
|
||||
var numberFormatted =
|
||||
(numberUnformatted / 1000).toFixed(1).toString() + "K";
|
||||
} else {
|
||||
var numberFormatted = numberUnformatted;
|
||||
}
|
||||
@ -574,7 +591,7 @@ function getVideoProgress(videoId) {
|
||||
function getSubbedPlaylists(videoPlaylists) {
|
||||
var subbedPlaylists = [];
|
||||
for (var i = 0; i < videoPlaylists.length; i++) {
|
||||
if(getPlaylistData(videoPlaylists[i]).playlist_subscribed) {
|
||||
if (getPlaylistData(videoPlaylists[i]).playlist_subscribed) {
|
||||
subbedPlaylists.push(videoPlaylists[i]);
|
||||
}
|
||||
}
|
||||
@ -585,9 +602,9 @@ function getSubbedPlaylists(videoPlaylists) {
|
||||
function postVideoProgress(videoId, videoProgress) {
|
||||
var apiEndpoint = "/api/video/" + videoId + "/progress/";
|
||||
var duartion = getVideoPlayerDuration();
|
||||
if (!isNaN(videoProgress) && duartion != 'undefined') {
|
||||
if (!isNaN(videoProgress) && duartion != "undefined") {
|
||||
var data = {
|
||||
"position": videoProgress
|
||||
position: videoProgress,
|
||||
};
|
||||
if (videoProgress == 0) {
|
||||
apiRequest(apiEndpoint, "DELETE");
|
||||
@ -622,7 +639,7 @@ function removePlayer() {
|
||||
var videoId = getVideoPlayerVideoId();
|
||||
postVideoProgress(videoId, currentTime);
|
||||
setProgressBar(videoId, currentTime, duration);
|
||||
var playerElement = document.getElementById('player');
|
||||
var playerElement = document.getElementById("player");
|
||||
if (playerElement.hasChildNodes()) {
|
||||
var youtubeId = playerElement.childNodes[1].getAttribute("data-id");
|
||||
var playedStatus = document.createDocumentFragment();
|
||||
@ -630,9 +647,9 @@ function removePlayer() {
|
||||
if (playedBox) {
|
||||
playedStatus.appendChild(playedBox);
|
||||
}
|
||||
playerElement.innerHTML = '';
|
||||
playerElement.innerHTML = "";
|
||||
// append played status
|
||||
var videoInfo = document.getElementById('video-info-' + youtubeId);
|
||||
var videoInfo = document.getElementById("video-info-" + youtubeId);
|
||||
videoInfo.insertBefore(playedStatus, videoInfo.firstChild);
|
||||
}
|
||||
}
|
||||
@ -652,16 +669,14 @@ function setProgressBar(videoId, currentTime, duration) {
|
||||
}
|
||||
|
||||
// progressBar = document.getElementById("progress-" + videoId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// multi search form
|
||||
function searchMulti(query) {
|
||||
if (query.length > 1) {
|
||||
var payload = JSON.stringify({'multi_search': query});
|
||||
var payload = JSON.stringify({ multi_search: query });
|
||||
var http = new XMLHttpRequest();
|
||||
http.onreadystatechange = function() {
|
||||
http.onreadystatechange = function () {
|
||||
if (http.readyState === 4) {
|
||||
allResults = JSON.parse(http.response).results;
|
||||
populateMultiSearchResults(allResults);
|
||||
@ -712,7 +727,6 @@ function populateMultiSearchResults(allResults) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function createVideo(video, viewStyle) {
|
||||
// create video item div from template
|
||||
const videoId = video.youtube_id;
|
||||
@ -725,7 +739,7 @@ function createVideo(video, viewStyle) {
|
||||
var watchStatusIndicator = createWatchStatusIndicator(videoId, "watched");
|
||||
} else {
|
||||
var watchStatusIndicator = createWatchStatusIndicator(videoId, "unwatched");
|
||||
};
|
||||
}
|
||||
const channelId = video.channel.channel_id;
|
||||
const channelName = video.channel.channel_name;
|
||||
// build markup
|
||||
@ -757,7 +771,6 @@ function createVideo(video, viewStyle) {
|
||||
return videoDiv;
|
||||
}
|
||||
|
||||
|
||||
function createChannel(channel, viewStyle) {
|
||||
// create channel item div from template
|
||||
const channelId = channel.channel_id;
|
||||
@ -833,7 +846,6 @@ function createPlaylist(playlist, viewStyle) {
|
||||
return playlistDiv;
|
||||
}
|
||||
|
||||
|
||||
// generic
|
||||
function sendPost(payload) {
|
||||
var http = new XMLHttpRequest();
|
||||
@ -843,7 +855,6 @@ function sendPost(payload) {
|
||||
http.send(payload);
|
||||
}
|
||||
|
||||
|
||||
function getCookie(c_name) {
|
||||
if (document.cookie.length > 0) {
|
||||
c_start = document.cookie.indexOf(c_name + "=");
|
||||
@ -851,36 +862,35 @@ function getCookie(c_name) {
|
||||
c_start = c_start + c_name.length + 1;
|
||||
c_end = document.cookie.indexOf(";", c_start);
|
||||
if (c_end == -1) c_end = document.cookie.length;
|
||||
return unescape(document.cookie.substring(c_start,c_end));
|
||||
return unescape(document.cookie.substring(c_start, c_end));
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
// animations
|
||||
function textReveal() {
|
||||
var textBox = document.getElementById('text-reveal');
|
||||
var button = document.getElementById('text-reveal-button');
|
||||
var textBox = document.getElementById("text-reveal");
|
||||
var button = document.getElementById("text-reveal-button");
|
||||
var textBoxHeight = textBox.style.height;
|
||||
if (textBoxHeight === 'unset') {
|
||||
textBox.style.height = '0px';
|
||||
button.innerText = 'Show';
|
||||
if (textBoxHeight === "unset") {
|
||||
textBox.style.height = "0px";
|
||||
button.innerText = "Show";
|
||||
} else {
|
||||
textBox.style.height = 'unset';
|
||||
button.innerText = 'Hide';
|
||||
textBox.style.height = "unset";
|
||||
button.innerText = "Hide";
|
||||
}
|
||||
}
|
||||
|
||||
function showForm() {
|
||||
var formElement = document.getElementById('hidden-form');
|
||||
var formElement = document.getElementById("hidden-form");
|
||||
var displayStyle = formElement.style.display;
|
||||
if (displayStyle === "") {
|
||||
formElement.style.display = 'block';
|
||||
formElement.style.display = "block";
|
||||
} else {
|
||||
formElement.style.display = "";
|
||||
}
|
||||
animate('animate-icon', 'pulse-img');
|
||||
animate("animate-icon", "pulse-img");
|
||||
}
|
||||
|
||||
function showOverwrite() {
|
||||
@ -888,7 +898,7 @@ function showOverwrite() {
|
||||
if (overwriteDiv.classList.contains("hidden-overwrite")) {
|
||||
overwriteDiv.classList.remove("hidden-overwrite");
|
||||
} else {
|
||||
overwriteDiv.classList.add("hidden-overwrite")
|
||||
overwriteDiv.classList.add("hidden-overwrite");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,11 +28,6 @@ function MyApp({ Component, pageProps: { session, ...pageProps } }: AppProps) {
|
||||
strategy="lazyOnload"
|
||||
src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"
|
||||
/> */}
|
||||
<Script
|
||||
onError={(e) => console.log(`Error loading script.js: ${e}`)}
|
||||
strategy="lazyOnload"
|
||||
src="/js/script.js"
|
||||
/>
|
||||
|
||||
{/** TODO: Detect casting before loading this? */}
|
||||
{/* <ClientOnlyScript strategy="lazyOnload" src="/js/cast-videos.js" /> */}
|
||||
|
Loading…
Reference in New Issue
Block a user