MediaWiki:Vector.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Wendl (Diskussion | Beiträge) |
Wendl (Diskussion | Beiträge) |
||
Zeile 38: | Zeile 38: | ||
var children_a = ol[0].getElementsByTagName("li"); | var children_a = ol[0].getElementsByTagName("li"); | ||
children = children_a[0]; | children = children_a[0]; | ||
console.log(children); | console.log(children_a); | ||
for (var i = 0; i < children; i ++){ | |||
var li = children[i]; | |||
console.log(li); | |||
} | |||
Version vom 6. Januar 2022, 16:57 Uhr
/* Das folgende JavaScript wird für Benutzer der Vector-Benutzeroberfläche geladen. */ var scroll_x; var scroll_y; //Scroll window.addEventListener("scroll", function(event) { scroll_y = this.scrollY; scroll_x = this.scrollX; if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { sc_t.style.display = "block"; } else { sc_t.style.display = "none"; } }); //Search Field document.querySelector("#searchInput").placeholder = "Suche…"; document.querySelector("#searchInput").focus(); //Add Scroll to top button sc_t = document.createElement("div"); sc_t.id = "scroll-top-button"; document.querySelector("body").append(sc_t); sc_t.addEventListener("click", topFunction); function topFunction() { document.body.scrollTop = 0; // For Safari document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera } //Inlist Incrementor function checkInlist(inlist){ var ol = inlist.getElementsByTagName("ol"); var children_a = ol[0].getElementsByTagName("li"); children = children_a[0]; console.log(children_a); for (var i = 0; i < children; i ++){ var li = children[i]; console.log(li); } } function incrementList(){ var inlists = document.querySelectorAll(".inlist"); for (var i = 0; i < inlists.length; i ++){ var inlist = inlists[i]; checkInlist(inlist); } } incrementList();