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

Aus PokéWiki
Zur Navigation springen Zur Suche springen
KKeine Bearbeitungszusammenfassung
KKeine Bearbeitungszusammenfassung
Zeile 37: Zeile 37:
/* general toggling of generation-specific data */
/* general toggling of generation-specific data */
$("*[data-gen]").each(function() {
$("*[data-gen]").each(function() {
if (this.dataset.gen == "-0") this.style.display = (gen == 0 ? "" : "none");
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 && 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 && Math.abs(this.dataset.gen) != gen) this.style.display = "none";
Zeile 74: Zeile 74:
$(".at_t").each(function() {
$(".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);
$(this).find("tfoot th")[0].colSpan = 7 + (gen == 0 ? $(this).find("thead tr:nth-child(1) th:nth-child(1)")[0].colSpan : 0);
});
/* 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);
});
});
}
}
Zeile 110: Zeile 114:
{{AtkRow/Level|Schlafpuder|41}}
{{AtkRow/Level|Schlafpuder|41}}
{{AtkRow/Level|Solarstrahl|48|46|46|46|STAB=ja}}
{{AtkRow/Level|Solarstrahl|48|46|46|46|STAB=ja}}
{{AtkTable/Footer}}
{{AtkTable/Level/Footer}}


=== Durch TM/VM ===
=== Durch TM/VM ===
Zeile 165: Zeile 169:
{{AtkRow/TMVM|Reflektor|[[TM33]]|✔}}
{{AtkRow/TMVM|Reflektor|[[TM33]]|✔}}
{{AtkRow/TMVM|Geduld|[[TM34]]|✔}}
{{AtkRow/TMVM|Geduld|[[TM34]]|✔}}
{{AtkTable/Footer}}
{{AtkTable/TMVM/Footer}}


=== Vererbbarkeit ===
=== Vererbbarkeit ===
Zeile 187: Zeile 191:
{{AtkRow/Zucht|Verwurzler|||✔|✔|✔|✔|✔}}
{{AtkRow/Zucht|Verwurzler|||✔|✔|✔|✔|✔}}
{{AtkRow/Zucht|Zauberblatt||✔|✔|✔|✔|✔|✔|STAB=ja}}
{{AtkRow/Zucht|Zauberblatt||✔|✔|✔|✔|✔|✔|STAB=ja}}
{{AtkTable/Footer}}
{{AtkTable/Zucht/Footer}}


=== Durch Attacken-Lehrer ===
=== Durch Attacken-Lehrer ===
Zeile 212: Zeile 216:
{{AtkRow/Lehrer|Synthese|||{{sk|PT|HG|SS}}|{{sk|S2|W2}}|{{sk|OR|AS}}|{{sk|US|UM}}}}
{{AtkRow/Lehrer|Synthese|||{{sk|PT|HG|SS}}|{{sk|S2|W2}}|{{sk|OR|AS}}|{{sk|US|UM}}}}
{{AtkRow/Lehrer|Zornklinge||{{sk|SM}}|{{sk|PT|HG|SS}}}}
{{AtkRow/Lehrer|Zornklinge||{{sk|SM}}|{{sk|PT|HG|SS}}}}
{{AtkTable/Footer}}
{{AtkTable/Lehrer/Footer}}

Version vom 19. Februar 2018, 00:00 Uhr

Toggle + JavaScript

/* 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;
	$(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).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 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 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);
	});
}
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: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