JSFiddle - React, Tailwind, and code Playground
JavaScript
function addJQuery(){
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
}
function sleep(ms) {
ms += new Date().getTime();
while (new Date() < ms) {
}
}
function scrollToEndOfList(callback){
setTimeout(function () {
var document_height = 0;
var intervalID = setInterval(function () {
if ($(document).height() <= document_height)
scrollFinish();
document_height = $(document).height();
$(window).scrollTop($(document).height());
}, 1000);
function scrollFinish() {
clearInterval(intervalID);
console.log('scrollFinish');
if(callback)
callback();
}
}, 1000);
}
(function getAudios() {
"use strict";
addJQuery();
var simpleAudios = [];
scrollToEndOfList(function(){
var audioNodes = document.querySelectorAll('.audio_row');
for (var i = 0, length = audioNodes.length; i < length; i++) {
simpleAudios[i] = {
id: audioNodes[i].getAttribute('data-full-id'),
node: audioNodes[i]
}
}
console.log('audios: ' + simpleAudios);
});
})();