mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 11:50:14 +00:00
cleanup logging
This commit is contained in:
parent
3376412c8f
commit
7d60af1491
@ -16,11 +16,9 @@ function checkMessage() {
|
||||
req.onload = function() {
|
||||
var dlProgress = req.response;
|
||||
if (dlProgress['status']) {
|
||||
console.log('start interval');
|
||||
buildDownloadMessage(dlProgress);
|
||||
handleInterval();
|
||||
};
|
||||
console.log(JSON.stringify(dlProgress));
|
||||
};
|
||||
req.send();
|
||||
}
|
||||
@ -34,14 +32,11 @@ function handleInterval() {
|
||||
req.onload = function() {
|
||||
var dlProgress = req.response;
|
||||
if (dlProgress['status']) {
|
||||
console.log('continue interval');
|
||||
buildDownloadMessage(dlProgress);
|
||||
} else {
|
||||
console.log('stop interval');
|
||||
clearInterval(watchDownload);
|
||||
location.reload();
|
||||
};
|
||||
console.log(JSON.stringify(dlProgress));
|
||||
};
|
||||
req.send();
|
||||
}, 3000);
|
||||
@ -81,6 +76,5 @@ function animate(elementId, animationClass) {
|
||||
var toAnimate = document.getElementById(elementId);
|
||||
if (toAnimate.className !== animationClass) {
|
||||
toAnimate.className = animationClass;
|
||||
console.log(elementId, animationClass);
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,6 @@ function dlPending() {
|
||||
function toIgnore(button) {
|
||||
var youtube_id = button.getAttribute('data-id');
|
||||
var payload = JSON.stringify({'ignore': youtube_id});
|
||||
console.log(payload);
|
||||
sendPost(payload);
|
||||
document.getElementById('dl-' + youtube_id).remove();
|
||||
}
|
||||
@ -151,17 +150,13 @@ function searchChannels(query) {
|
||||
if (query.length > 1) {
|
||||
var payload = JSON.stringify({'channel-search': query})
|
||||
sendSearchAsYouType(payload);
|
||||
console.log(payload);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function populateChannelResults(allResults) {
|
||||
|
||||
var searchResultBox = document.getElementById('resultBox');
|
||||
|
||||
for (let i = 0; i < allResults.length; i++) {
|
||||
|
||||
var singleResult = allResults[i];
|
||||
var source = singleResult['source'];
|
||||
var channelName = source['channel_name'];
|
||||
@ -170,10 +165,7 @@ function populateChannelResults(allResults) {
|
||||
optionElement.value = channelName;
|
||||
optionElement.setAttribute('data', channelId);
|
||||
searchResultBox.appendChild(optionElement);
|
||||
console.log(channelId, channelName);
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
function channelRedirect(){
|
||||
@ -181,24 +173,20 @@ function channelRedirect(){
|
||||
var firstChild = response.firstChild
|
||||
if (firstChild) {
|
||||
var redirectId = firstChild.getAttribute('data');
|
||||
console.log('redirecting: ' + redirectId);
|
||||
location = '/channel/' + redirectId;
|
||||
}
|
||||
};
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function sendSearchAsYouType(payload) {
|
||||
console.log(payload);
|
||||
var http = new XMLHttpRequest();
|
||||
|
||||
http.onreadystatechange = function() {
|
||||
if (http.readyState === 4) {
|
||||
allResults = JSON.parse(http.response)['results'];
|
||||
populateChannelResults(allResults);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
http.open("POST", "/process/", true);
|
||||
http.setRequestHeader("X-CSRFToken", getCookie("csrftoken"));
|
||||
http.setRequestHeader("Content-type", "application/json");
|
||||
@ -206,10 +194,8 @@ function sendSearchAsYouType(payload) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// generic
|
||||
function sendPost(payload) {
|
||||
console.log(payload);
|
||||
var http = new XMLHttpRequest();
|
||||
http.open("POST", "/process/", true);
|
||||
http.setRequestHeader("X-CSRFToken", getCookie("csrftoken"));
|
||||
|
Loading…
Reference in New Issue
Block a user