From 7d60af1491907d606aa4187e400659c52fe6069a Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 11 Sep 2021 18:42:37 +0700 Subject: [PATCH] cleanup logging --- tubearchivist/static/progress.js | 6 ------ tubearchivist/static/script.js | 22 ++++------------------ 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/tubearchivist/static/progress.js b/tubearchivist/static/progress.js index e716b71..ee61c1a 100644 --- a/tubearchivist/static/progress.js +++ b/tubearchivist/static/progress.js @@ -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); } } diff --git a/tubearchivist/static/script.js b/tubearchivist/static/script.js index 10961c4..1bbe600 100644 --- a/tubearchivist/static/script.js +++ b/tubearchivist/static/script.js @@ -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"));