Greetings %alluser%
There is a browser game League 17 .
I would like to write a script for tampermonkey to it, the game has a "Nursery League" here is the code for this block .
The task is to display a list of all the demons, if possible then screw the sorting.
I thought to do in a similar way.

 var enemyDiv = document.getElementById('divFarmList'); while ( x ) { var enemyImage = enemyDiv.getElementsByClassName('image'); var enemyName = enemyDiv.getElementsByClassName('name'); var enemyLvL = enemyDiv.getElementsByClassName('lvl'); var enemyIvcode = enemyDiv.getElementsByClassName('ivcode'); } 

But firstly, it will not work this way, but the problem is that not the entire list of pokovs is displayed at once, but 25 each at a time.

Closed due to the fact that off-topic participants are Vladimir Martyanov , zRrr , Grundy , Vartlok , PashaPash 15 Apr '16 at 20:43 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - zRrr, PashaPash
If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    Could bring this porridge to pastebin and to a normal form, but it is impossible to look there. If you are too lazy to do it, then the potential respondents, even more so. Is it really so difficult to use any online automatic formatting tool (html beatifier)?

    Work the code will be fine, what you do not like?

     var elements = document.querySelectorAll(".divFarmPoke") for(var i = 0; i < elements.length; i++){ var pokeinfo = ""; pokeinfo += " image src: " + elements[i].querySelector(".image").src; pokeinfo += " name: " + elements[i].querySelector(".name").innerText; pokeinfo += " lvl: " + elements[i].querySelector(".lvl").innerText; pokeinfo += " ivcode: " + elements[i].querySelector(".ivcode").innerText; console.log(pokeinfo) } 
      <div id="divFarmList" class=""> <div class="divFarmPoke"> <div class="button ctrl nobg btnBack"> </div> <div class="pokemonBoxTiny sizeundefined clickable"> <img class="image" src="//img.league17.ru/pub/pkmn/norm/anim/298.gif"> <div class="name"> #298 Азурилл </div> <div class="shorts"> <span class="sex1 breedable">♂</span><span class="lvl">6</span> </div> <div class="extra"> <span><span class="ivcode">h0a24d9s21sa12sd26.100G</span></span> </div> </div> </div> <div class="hr"> </div> <div class="divFarmPoke"> <div class="button ctrl nobg btnBack"> </div> <div class="pokemonBoxTiny sizeundefined clickable"> <img class="image" src="//img.league17.ru/pub/pkmn/norm/anim/298.gif"> <div class="name"> #298 Азурилл </div> <div class="shorts"> <span class="sex2 breedable">♀</span><span class="lvl">6</span> </div> <div class="extra"> <span><span class="ivcode">h8a13d12s23sa7sd6.100A</span></span> </div> </div> </div> <div class="hr"> </div> <div class="divFarmPoke"> <div class="button ctrl nobg btnBack"> </div> <div class="pokemonBoxTiny sizeundefined clickable"> <img class="image" src="//img.league17.ru/pub/pkmn/norm/anim/118.gif"> <div class="name"> #118 Голдин </div> <div class="shorts"> <span class="sex1 breedable">♂</span><span class="lvl">12</span> </div> <div class="extra"> <span><span class="ivcode">h8a6d26s3sa4sd11.100G</span></span> </div> </div> </div> <div class="hr"> </div> </div> 

    About the fact that the code does not display all, what do you want? It displays only what is on the page. It is necessary for all, load the remaining pages and parse them. Either through Ajax, or through manual transitions.

    In any case, do not forget about the rules, and in the case of using third-party bot programs, you may be in for a ban, and as an option for the whole IP subnet: Ligue 17: rules

    • Thank you very much! I didn’t know about html beatifier, it’s not very convenient. - Izya12