Skip to content

Instantly share code, notes, and snippets.

@MelkorNemesis
Forked from anonymous/javascript__
Created April 20, 2014 14:20
Show Gist options
  • Save MelkorNemesis/11115313 to your computer and use it in GitHub Desktop.
Save MelkorNemesis/11115313 to your computer and use it in GitHub Desktop.
javascript: function labelAttacks() {
var arrInputs = document.getElementsByTagName('input');
var txtAttack = "Útok";
var strDate = document.getElementById('serverDate').childNodes[0].nodeValue;
strDate = strDate.substring(0, strDate.length - 5);
var strTime = document.getElementById('serverTime').childNodes[0].nodeValue;
var j = 0;
jmeno = '[' + strDate + ' ' + strTime + ']';
$("#incomings_table tr:gt(0)").each(function () {
if($(this).find(":contains('"+txtAttack+"')")){
$(this).find(".rename-icon").click();
$(this).find("input[type=text]").val(jmeno);
$(this).find("input[type=button]").click();
j++;}});
alert("Nových:" + j);
}labelAttacks();
----------------------------------------------------
<table id="incomings_table" class="vis overview_table " style="width:100%">
<input type="hidden" name="label_format" value="%unit%" />
<tr>
<th width="120">Povel (4)</th>
<th width="*"><a href="/game.php?village=7898&amp;
page=-1
&amp;order=target_name
&amp;dir=desc&amp;type=unignored&amp;subtype=attacks&amp;screen=overview_villages">Cíl </a></th>
<th width="150"><a href="/game.php?village=7898&amp;
page=-1
&amp;order=start_village_name
&amp;dir=desc&amp;type=unignored&amp;subtype=attacks&amp;screen=overview_villages">Původ </a></th>
<th width="*"><a href="/game.php?village=7898&amp;
page=-1
&amp;order=start_name
&amp;dir=desc&amp;type=unignored&amp;subtype=attacks&amp;screen=overview_villages">Hráč</a></th>
<th><a href="/game.php?village=7898&amp;
page=-1
&amp;order=distance
&amp;dir=desc&amp;type=unignored&amp;subtype=attacks&amp;screen=overview_villages">Vzdálenost</a></th>
<th width="160"><a href="/game.php?village=7898&amp;
page=-1
&amp;order=date_arrival
&amp;dir=desc&amp;type=unignored&amp;subtype=attacks&amp;screen=overview_villages">Příchod</a></th>
<th width="80"><a href="/game.php?village=7898&amp;
page=-1
&amp;order=date_arrival
&amp;dir=desc&amp;type=unignored&amp;subtype=attacks&amp;screen=overview_villages">Dorazí za</a></th></tr>
<tr style="white-space:nowrap" class="nowrap selected row_a">
<td>
<input name="command_ids[19977938]" type="hidden" value="true" />
<input name="id_19977938" type="checkbox" />
<span class="quickedit" data-id="19977938">
<span class="quickedit-content">
<a href="/game.php?village=7898&amp;id=19977938&amp;type=other&amp;screen=info_command">
<img src="http://cdn.divokekmeny.cz/8.21/20272/graphic/command/attack.png?6d2c9" alt="" /> <span class="quickedit-label">
[20/04 15:56:05] </span>
</a>
<a class="rename-icon" href="#" title="Přejmenovat"></a>
</span>
</span>
</td>
<td>
<a href="/game.php?village=7898&amp;screen=overview">Bořa stavitel řádí... :-) (448|429) K44</a>
</td>
<td>
<a href="/game.php?village=7898&amp;id=9502&amp;screen=info_village">matyskovo 008 (435|426) K44</a>
</td>
<td>
<a href="/game.php?village=7898&amp;id=1136835&amp;screen=info_player">mates1274</a>
</td>
<td>
13.3 </td>
<td>
dnes v 16:15:25:<span class="grey small">121</span> hodin </td><td><span class="timer">0:13:42</span></td>
</tr>
<tr style="white-space:nowrap" class="nowrap row_b">
<td>
<input name="command_ids[19979798]" type="hidden" value="true" />
<input name="id_19979798" type="checkbox" />
<span class="quickedit" data-id="19979798">
<span class="quickedit-content">
<a href="/game.php?village=7898&amp;id=19979798&amp;type=other&amp;screen=info_command">
<img src="http://cdn.divokekmeny.cz/8.21/20272/graphic/command/attack.png?6d2c9" alt="" /> <span class="quickedit-label">
[20/04 15:56:05] </span>
</a>
<a class="rename-icon" href="#" title="Přejmenovat"></a>
</span>
</span>
</td>
<td>
<a href="/game.php?village=9628&amp;screen=overview">Megadeth - MM (407|470) K44</a>
</td>
<td>
<a href="/game.php?village=7898&amp;id=10675&amp;screen=info_village">matyskovo 009 (428|424) K44</a>
</td>
<td>
<a href="/game.php?village=7898&amp;id=1136835&amp;screen=info_player">mates1274</a>
</td>
<td>
50.6 </td>
<td>
dnes v 21:51:25:<span class="grey small">410</span> hodin </td><td><span class="timer">5:49:42</span></td>
</tr>
<tr style="white-space:nowrap" class="nowrap row_a">
<td>
<input name="command_ids[19979802]" type="hidden" value="true" />
<input name="id_19979802" type="checkbox" />
<span class="quickedit" data-id="19979802">
<span class="quickedit-content">
<a href="/game.php?village=7898&amp;id=19979802&amp;type=other&amp;screen=info_command">
<img src="http://cdn.divokekmeny.cz/8.21/20272/graphic/command/attack.png?6d2c9" alt="" /> <span class="quickedit-label">
[20/04 15:56:05] </span>
</a>
<a class="rename-icon" href="#" title="Přejmenovat"></a>
</span>
</span>
</td>
<td>
<a href="/game.php?village=9628&amp;screen=overview">Megadeth - MM (407|470) K44</a>
</td>
<td>
<a href="/game.php?village=7898&amp;id=10675&amp;screen=info_village">matyskovo 009 (428|424) K44</a>
</td>
<td>
<a href="/game.php?village=7898&amp;id=1136835&amp;screen=info_player">mates1274</a>
</td>
<td>
50.6 </td>
<td>
dnes v 21:51:31:<span class="grey small">076</span> hodin </td><td><span class="timer">5:49:48</span></td>
</tr>
<tr style="white-space:nowrap" class="nowrap row_b">
<td>
<input name="command_ids[19979927]" type="hidden" value="true" />
<input name="id_19979927" type="checkbox" />
<span class="quickedit" data-id="19979927">
<span class="quickedit-content">
<a href="/game.php?village=7898&amp;id=19979927&amp;type=other&amp;screen=info_command">
<img src="http://cdn.divokekmeny.cz/8.21/20272/graphic/command/attack.png?6d2c9" alt="" /> <span class="quickedit-label">
Útok </span>
</a>
<a class="rename-icon" href="#" title="Přejmenovat"></a>
</span>
</span>
</td>
<td>
<a href="/game.php?village=9628&amp;screen=overview">Megadeth - MM (407|470) K44</a>
</td>
<td>
<a href="/game.php?village=7898&amp;id=11218&amp;screen=info_village">--Vesnice barbarů (427|424) K44</a>
</td>
<td>
<a href="/game.php?village=7898&amp;id=1136835&amp;screen=info_player">mates1274</a>
</td>
<td>
50.2 </td>
<td>
dnes v 21:54:21:<span class="grey small">818</span> hodin </td><td><span class="timer">5:52:38</span></td>
</tr>
<tr>
<th style="white-space:nowrap;">
<input name="all" type="checkbox" class="selectAll" id="select_all" onclick="selectAll(this.form, this.checked)"/> <label for="select_all">zvolit vše</label>
</th>
<th colspan="6">
<input class="btn" type="submit" value="Ignorovat" name="ignore"/>
<input class="btn" type="button" onclick="$('#incomings_form').attr('action', '/game.php?village=7898&amp;screen=reqdef'); $('#incomings_form').submit();" value="Požádat o podporu" name="reqdef"/>
<input class="btn tooltip" type="submit" value="Označení" title="Označí vybrané příkazy jménem nejpomalejší jednotky, na základě odhadu, který je založen na zbylém čase příchodu a předpokladu, že byl příkaz právě poslán. Útoky, které již byly předtím přejmenovány, nebudou označeny." name="label" />
</th>
</tr>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment