but, at the same time, the API call returns (the correct) cooldown index of 9:
This fix works I believe, api_data is passed to requestId() later (don't really know javascript so not submitting a file):
function overlay() {
[...]
element.innerHTML += "<div class='extWrapper'><ul style='list-style: none;' class='extBounce extAttUl'>🐈</ul></div>";
// Fix incorrect speed.innerText above
// nativeElement.getElementsByClassName('KittyCard-coldown')[0]
// may return innertext "Fast" for cat which is "Slow"
// Save api data to global variable to avoid a repeat call in requestId()
api_data = stats.fast = null;
$.ajax({
url: "https://api.cryptokitties.co/kitties/"+curId,
async: false,
dataType: 'json',
success: function(data) {
let cd_index = data.status.cooldown_index;
api_data = data;
stats.fast = cdTbl.indexOf(cdValueTbl[cd_index]);
}
});
The text says "Fast"
but, at the same time, the API call returns (the correct) cooldown index of 9:
This fix works I believe, api_data is passed to requestId() later (don't really know javascript so not submitting a file):