Benutzer:Shadowtweaker/Vorlage:AtkTable: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 1: | Zeile 1: | ||
== Toggle + JavaScript == | == Toggle + JavaScript == | ||
<pre> | <pre> | ||
$(". | /* initialize generation and position labels */ | ||
$(".at").each(function() { | |||
coltogen = $(this).find("thead tr:nth-child(2) th").toArray().map((x, i) => [x.dataset.gen, x.dataset.gen].slice(0, x.colSpan).join(",")).join(",").split(","); | |||
$(this).find("tbody tr").each(function() { | |||
$(this).find("td").toArray().slice(0, coltogen.length).forEach((x, i) => x.dataset.gen = coltogen[i]); | |||
}); | |||
}); | }); | ||
$(".at tbody tr").each((a, b) => b.setAttribute("data-pos", a)); | $(".at tbody tr").each((a, b) => b.setAttribute("data-pos", a)); | ||
function | /* 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); | |||
}); | |||
function at_toggle(gen) { | /* 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 && 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).map(x => x.innerText != "—").reduce((acc, cv) => acc || cv, false)) | |||
$(this)[0].style.display = "none"; | |||
}); | |||
/* sort rows by level */ | |||
/*$(".at_l").each(function() { | |||
rows = []; | |||
$(this).find("tbody tr").each((a, b) => rows.push(b)); | |||
if (gen == 0) | |||
rows = rows.sort((a, b) => a.getAttribute("data-pos") - b.getAttribute("data-pos")); | |||
else | |||
rows = rows.sort((a, b) => parseInt($(a).find("td:nth-child(" + gen + ")")[0].innerText.replace("—", "101")) - parseInt($(b).find("td:nth-child(" + gen + ")")[0].innerText.replace("—", "101"))); | |||
$(this).find("tbody")[0].innerHTML = rows.map(x => x.outerHTML).join(""); | |||
});*/ | |||
} | } | ||
</pre> | </pre> | ||
{| class=" | {| 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? | ||
|- | |- style="background:white" | ||
| <span class="at_toggle" data-for="1">1. Gen.</span> | | <span class="at_toggle" data-for="1">1. Gen.</span> | ||
| <span class="at_toggle" data-for="2">2. Gen.</span> | | <span class="at_toggle" data-for="2">2. Gen.</span> |
Version vom 4. Februar 2018, 02:25 Uhr
Toggle + JavaScript
/* initialize generation and position labels */ $(".at").each(function() { coltogen = $(this).find("thead tr:nth-child(2) th").toArray().map((x, i) => [x.dataset.gen, x.dataset.gen].slice(0, x.colSpan).join(",")).join(",").split(","); $(this).find("tbody tr").each(function() { $(this).find("td").toArray().slice(0, coltogen.length).forEach((x, i) => x.dataset.gen = coltogen[i]); }); }); $(".at tbody tr").each((a, b) => b.setAttribute("data-pos", a)); /* 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 && 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).map(x => x.innerText != "—").reduce((acc, cv) => acc || cv, false)) $(this)[0].style.display = "none"; }); /* sort rows by level */ /*$(".at_l").each(function() { rows = []; $(this).find("tbody tr").each((a, b) => rows.push(b)); if (gen == 0) rows = rows.sort((a, b) => a.getAttribute("data-pos") - b.getAttribute("data-pos")); else rows = rows.sort((a, b) => parseInt($(a).find("td:nth-child(" + gen + ")")[0].innerText.replace("—", "101")) - parseInt($(b).find("td:nth-child(" + gen + ")")[0].innerText.replace("—", "101"))); $(this).find("tbody")[0].innerHTML = rows.map(x => x.outerHTML).join(""); });*/ }
Welche Generationen sollen angezeigt werden? | |||||||
---|---|---|---|---|---|---|---|
1. Gen. | 2. Gen. | 3. Gen. | 4. Gen. | 5. Gen. | 6. Gen. | 7. Gen. | alle |
Attacken
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:AtkTable/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/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/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/Footer