mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-11 18:46:30 +00:00
JS cleanup
This commit is contained in:
parent
0924ea033d
commit
6b16ad2ce0
1 changed files with 2 additions and 3 deletions
|
@ -19,7 +19,6 @@ window.onload = function() {
|
||||||
if (loading) return;
|
if (loading) return;
|
||||||
if (html.scrollTop + html.clientHeight >= html.scrollHeight - 3000) {
|
if (html.scrollTop + html.clientHeight >= html.scrollHeight - 3000) {
|
||||||
loading = true;
|
loading = true;
|
||||||
var topRef = document.querySelector('.top-ref');
|
|
||||||
var loadMore = getLoadMore(document);
|
var loadMore = getLoadMore(document);
|
||||||
if (loadMore == null) return;
|
if (loadMore == null) return;
|
||||||
|
|
||||||
|
@ -30,7 +29,7 @@ window.onload = function() {
|
||||||
url.searchParams.append('scroll', 'true');
|
url.searchParams.append('scroll', 'true');
|
||||||
|
|
||||||
fetch(url.toString()).then(function (response) {
|
fetch(url.toString()).then(function (response) {
|
||||||
return response.text();
|
return response.text();
|
||||||
}).then(function (html) {
|
}).then(function (html) {
|
||||||
var parser = new DOMParser();
|
var parser = new DOMParser();
|
||||||
var doc = parser.parseFromString(html, 'text/html');
|
var doc = parser.parseFromString(html, 'text/html');
|
||||||
|
@ -46,7 +45,7 @@ window.onload = function() {
|
||||||
else insertBeforeLast(container, getLoadMore(doc));
|
else insertBeforeLast(container, getLoadMore(doc));
|
||||||
loading = false;
|
loading = false;
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
console.warn('Something went wrong.', err);
|
console.warn('Something went wrong.', err);
|
||||||
loading = true;
|
loading = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue