diff options
| author | Samantaz Fox <coding@samantaz.fr> | 2022-04-27 18:32:40 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-27 18:32:40 +0200 |
| commit | 3bbd709bd6ef812d8c4458c192e166c53b76ab1d (patch) | |
| tree | 6d81622d1d091ae37e13b5de38a319f956f88d61 /assets/js/community.js | |
| parent | a0f566fef34ec3ee2a1badc7ac6e78099ad24892 (diff) | |
| parent | dbb1e3f5d8aae3d732bbf3ccf82baec0739d9445 (diff) | |
| download | invidious-3bbd709bd6ef812d8c4458c192e166c53b76ab1d.tar.gz invidious-3bbd709bd6ef812d8c4458c192e166c53b76ab1d.tar.bz2 invidious-3bbd709bd6ef812d8c4458c192e166c53b76ab1d.zip | |
Merge pull request #3045 from AHOHNMYC/js-lint
Js lint
Diffstat (limited to 'assets/js/community.js')
| -rw-r--r-- | assets/js/community.js | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/assets/js/community.js b/assets/js/community.js index 4077f1cd..44066a58 100644 --- a/assets/js/community.js +++ b/assets/js/community.js @@ -1,19 +1,20 @@ -var community_data = JSON.parse(document.getElementById('community_data').innerHTML); +'use strict'; +var community_data = JSON.parse(document.getElementById('community_data').textContent); String.prototype.supplant = function (o) { return this.replace(/{([^{}]*)}/g, function (a, b) { var r = o[b]; return typeof r === 'string' || typeof r === 'number' ? r : a; }); -} +}; function hide_youtube_replies(event) { var target = event.target; - sub_text = target.getAttribute('data-inner-text'); - inner_text = target.getAttribute('data-sub-text'); + var sub_text = target.getAttribute('data-inner-text'); + var inner_text = target.getAttribute('data-sub-text'); - body = target.parentNode.parentNode.children[1]; + var body = target.parentNode.parentNode.children[1]; body.style.display = 'none'; target.innerHTML = sub_text; @@ -25,10 +26,10 @@ function hide_youtube_replies(event) { function show_youtube_replies(event) { var target = event.target; - sub_text = target.getAttribute('data-inner-text'); - inner_text = target.getAttribute('data-sub-text'); + var sub_text = target.getAttribute('data-inner-text'); + var inner_text = target.getAttribute('data-sub-text'); - body = target.parentNode.parentNode.children[1]; + var body = target.parentNode.parentNode.children[1]; body.style.display = ''; target.innerHTML = sub_text; @@ -63,8 +64,8 @@ function get_youtube_replies(target, load_more) { xhr.open('GET', url, true); xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status == 200) { + if (xhr.readyState === 4) { + if (xhr.status === 200) { if (load_more) { body = body.parentNode.parentNode; body.removeChild(body.lastElementChild); @@ -92,12 +93,12 @@ function get_youtube_replies(target, load_more) { body.innerHTML = fallback; } } - } + }; xhr.ontimeout = function () { - console.log('Pulling comments failed.'); + console.warn('Pulling comments failed.'); body.innerHTML = fallback; - } + }; xhr.send(); } |
