Benutzer:Shadowtweaker/Vorlage:AtkTable: Unterschied zwischen den Versionen

Aus PokéWiki
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
== Toggle + JavaScript ==
== Attacken ==
<pre>
/* initialize generation labels and level sorting across generations */
$(".at").each(function() {
coltogen = $(this).find("thead tr:nth-child(2) th").toArray().map((x, i) => [Math.abs(x.dataset.gen), Math.abs(x.dataset.gen)].slice(0, x.colSpan).join(",")).join(",").split(",");
shift = $(this)[0].classList.contains("at_l") ? 1 : 0;
if ($(this)[0].classList.contains("at_z")) coltogen = coltogen.map(x => (coltogen.filter(y => y == x).length == 1 ? "+" : "") + x);
$(this).find("tbody tr").each(function() {
$(this).find("td").toArray().slice(shift, coltogen.length+shift).forEach((x, i) => x.dataset.gen = coltogen[i]);
});
});
$(".at_l tbody tr td:nth-child(1)").each((i, x) => x.innerHTML = "" + i);
$(".at_l").each(function() {
id = $(this).find("thead tr:nth-child(1) th:nth-child(1)")[0];
level = $(this).find("thead tr:nth-child(1) th:nth-child(2)")[0];
id2 = document.createElement("th");
id2.rowSpan = id.rowSpan;
$(this).find("thead tr:nth-child(1)")[0].insertBefore(id2, id);
id.colSpan = level.colSpan;
id.rowSpan = level.rowSpan;
id.style.display = "";
level.style.display = "none";
});
 
/* initialize toggle buttons */
$(".at_toggle").each(function(index, object) {
var toggle = document.createElement("a");
toggle.className = 'at_togglerlink';
toggle.setAttribute('href', 'javascript:at_toggle("' + object.getAttribute("data-for") + '");');
var child = object.firstChild;
object.removeChild(child);
toggle.appendChild(child);
object.insertBefore(toggle, object.firstChild);
});
 
/* toggler function */
function at_toggle(gen) {
/* general toggling of generation-specific data */
$("*[data-gen]").each(function() {
if (this.dataset.gen == "-0") this.style.display = (gen == 0 ? "none" : "");
else if (gen != 0 && this.dataset.gen.substring(0, 1) == "+") this.style.display = "none";
else if (gen != 0 && Math.abs(this.dataset.gen) != gen) this.style.display = "none";
else if (gen == 0 && this.dataset.gen < 0) this.style.display = "none";
else this.style.display = "";
});
/* toggle rows that are irrelevant for this generation */
$(".at tbody tr").each(function() {
$(this)[0].style.display = "";
if (gen != 0 && !$(this).find("td").toArray().filter(x => x.dataset.gen == gen || x.dataset.gen == "+" + gen).map(x => x.innerText != "—").reduce((acc, cv) => acc || cv, false))
$(this)[0].style.display = "none";
});
/* toggle columns in tmvm tables */
$(".at_t tbody td[data-gen]").each(function() {
$(this)[0].style.display = (gen == 0 ? "" : "none");
});
/* adjust level header */
$(".at_l").each(function() {
id = $(this).find("thead tr:nth-child(1) th:nth-child(2)")[0];
level = $(this).find("thead tr:nth-child(1) th:nth-child(3)")[0];
if (gen == 0) {
id.colSpan = level.colSpan;
$(this).find("thead tr:nth-child(1) th").toArray().slice(3).forEach(x => x.rowSpan = $(this).find("thead tr:nth-child(1) th:nth-child(1)")[0].rowSpan);
}
else {
id.colSpan = $(this).find("thead tr:nth-child(2) th").toArray().filter(x => x.dataset.gen == gen)[0].colSpan;
$(this).find("thead tr:nth-child(1) th").toArray().slice(3).forEach(x => x.rowSpan = $(this).find("thead tr:nth-child(2) th").toArray().filter(x => x.dataset.gen == gen)[0].colSpan);
}
$(this).find("thead tr:nth-child(2)")[0].style.display = (gen == 0 ? "" : "none");
if ($(this).find("thead tr:nth-child(3)")[0]) {
$(this).find("thead tr:nth-child(3)")[0].style.display = (gen == 0 ? "" : ($(this).find("thead tr:nth-child(2) th").toArray().filter(x => x.dataset.gen == gen)[0].rowSpan > 1 ? "none" : ""));
}
$(this).find("tfoot th")[0].colSpan = id.colSpan + 6;
});
/* adjust tmvm header */
$(".at_t thead tr:nth-child(1) th:nth-last-child(7)").toggleClass("round-topleft", gen != 0);
/* adjust tmvm footer */
$(".at_t").each(function() {
$(this).find("tfoot th")[0].colSpan = 7 + (gen == 0 ? $(this).find("thead tr:nth-child(1) th:nth-child(1)")[0].colSpan : 0);
});
/* adjust breeding header and footer */
$(".at_z").each(function() {
var split = gen != 0 && $(this).find("thead tr:nth-child(2) th").toArray().filter(x => x.dataset.gen == "+" + gen)[0].colSpan > 1;
$(this).find("thead tr:nth-child(1) th:nth-child(2)")[0].style.display = (split ? "": "none");
$(this).find("thead tr:nth-child(1) th:nth-last-child(6)").toggleClass("round-topleft", gen != 0 && !split);
$(this).find("tfoot th")[0].colSpan = (gen == 0 ? 6 + $(this).find("thead tr:nth-child(1) th:nth-child(1)")[0].colSpan : (split ? 8 : 6));
});
/* adjust tutor footer */
$(".at_a").each(function() {
$(this).find("tfoot th")[0].colSpan = 6 + (gen == 0 ? $(this).find("thead tr:nth-child(1) th:nth-child(1)")[0].colSpan : 1);
});
}
</pre>
{| class="zentriert c round innerround" style="background:#{{Typ/Color/{{Id2Typ1|{{namenr|{{PAGENAME}}}}}}-dunkel}}; border:2px solid #{{Typ/Color/{{Id2Typ2|{{namenr|{{PAGENAME}}}}}}-dunkel+}}"
{| class="zentriert c round innerround" style="background:#{{Typ/Color/{{Id2Typ1|{{namenr|{{PAGENAME}}}}}}-dunkel}}; border:2px solid #{{Typ/Color/{{Id2Typ2|{{namenr|{{PAGENAME}}}}}}-dunkel+}}"
! colspan={{#expr:9-{{{g|1}}}}} style="background:#{{Typ/Color/{{Id2Typ1|{{namenr|{{PAGENAME}}}}}}-hell}}"|Welche Generationen sollen angezeigt werden?
! colspan={{#expr:9-{{{g|1}}}}} style="background:#{{Typ/Color/{{Id2Typ1|{{namenr|{{PAGENAME}}}}}}-hell}}"|Welche Generationen sollen angezeigt werden?
Zeile 103: Zeile 12:
| <span class="at_toggle" data-for="0">alle</span>
| <span class="at_toggle" data-for="0">alle</span>
|}
|}
== Attacken ==
=== Durch Levelaufstieg ===
=== Durch Levelaufstieg ===
{{AtkTable/Level|usum=ja}}
{{AtkTable/Level|usum=ja}}

Version vom 28. Februar 2018, 22:49 Uhr

Attacken

Welche Generationen sollen angezeigt werden?
1. Gen. 2. Gen. 3. Gen. 4. Gen. 5. Gen. 6. Gen. 7. Gen. alle

Durch Levelaufstieg

Vorlage:AtkTable/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkRow/Level Vorlage:AtkTable/Level/Footer

Durch TM/VM

Vorlage:AtkTable/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkRow/TMVM Vorlage:AtkTable/TMVM/Footer

Vererbbarkeit

Vorlage:AtkTable/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkRow/Zucht Vorlage:AtkTable/Zucht/Footer

Durch Attacken-Lehrer

Vorlage:AtkTable/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkRow/Lehrer Vorlage:AtkTable/Lehrer/Footer