Benutzer:Funbuilder/Inhaltsverzeichnis.js

Aus Jedipedia

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
var maxUeberschriftenAnzahlAusgeklappt = 50;



console.log('Inhaltsverzeichnis-Skript geladen');
if(mw.config.get('wgNamespaceNumber') == 0 && (mw.config.get('skin') == 'vector' || mw.config.get('skin') == 'vector-2022') && document.getElementsByClassName('toc').length == 0){
	
	var kanonTab = false;
	if(document.getElementsByClassName('tab-kanon').length > 0){kanonTab = true}
	var legendsTab = false;
	if(document.getElementsByClassName('tab-legends').length > 0){legendsTab = true}
	var hdkTab = false;
	if(document.getElementsByClassName('tab-hdk').length > 0){hdkTab = true}

	if(kanonTab == true){
		var h2TitleList = document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h2');
		Array.prototype.forEach.call(h2TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'kanon-' + title.getElementsByClassName('mw-headline')[0].id;
		});
		
		var h3TitleList = document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h3');
		Array.prototype.forEach.call(h3TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'kanon-' + title.getElementsByClassName('mw-headline')[0].id;
		});
		
		var h4TitleList = document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h4');
		Array.prototype.forEach.call(h4TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'kanon-' + title.getElementsByClassName('mw-headline')[0].id;
		});
		
		var h5TitleList = document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h5');
		Array.prototype.forEach.call(h5TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'kanon-' + title.getElementsByClassName('mw-headline')[0].id;
		});
		
		var h6TitleList = document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h6');
		Array.prototype.forEach.call(h6TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'kanon-' + title.getElementsByClassName('mw-headline')[0].id;
		});
	}
	
	if(legendsTab == true){
		var h2TitleList = document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h2');
		Array.prototype.forEach.call(h2TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'legends-' + title.getElementsByClassName('mw-headline')[0].id;
		});
		
		var h3TitleList = document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h3');
		Array.prototype.forEach.call(h3TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'legends-' + title.getElementsByClassName('mw-headline')[0].id;
		});
		
		var h4TitleList = document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h4');
		Array.prototype.forEach.call(h4TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'legends-' + title.getElementsByClassName('mw-headline')[0].id;
		});
		
		var h5TitleList = document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h5');
		Array.prototype.forEach.call(h5TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'legends-' + title.getElementsByClassName('mw-headline')[0].id;
		});
		
		var h6TitleList = document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h6');
		Array.prototype.forEach.call(h6TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'legends-' + title.getElementsByClassName('mw-headline')[0].id;
		});
	}
	
	if(hdkTab == true){
		var h2TitleList = document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h2');
		Array.prototype.forEach.call(h2TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'hdk-' + title.getElementsByClassName('mw-headline')[0].id;
		});
		
		var h3TitleList = document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h3');
		Array.prototype.forEach.call(h3TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'hdk-' + title.getElementsByClassName('mw-headline')[0].id;
		});
		
		var h4TitleList = document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h4');
		Array.prototype.forEach.call(h4TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'hdk-' + title.getElementsByClassName('mw-headline')[0].id;
		});
		
		var h5TitleList = document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h5');
		Array.prototype.forEach.call(h5TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'hdk-' + title.getElementsByClassName('mw-headline')[0].id;
		});
		
		var h6TitleList = document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h6');
		Array.prototype.forEach.call(h6TitleList, (title) => {
			title.getElementsByClassName('mw-headline')[0].id = 'hdk-' + title.getElementsByClassName('mw-headline')[0].id;
		});
	}

}



if(mw.config.get('wgNamespaceNumber') == 0 && mw.config.get('skin') == 'vector' && document.getElementsByClassName('toc').length == 0){
	if(document.getElementsByClassName('tab-kanon').length > 0){
		if(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h2').length > 1){
			var TOC = '<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="kanon-toctogglecheckbox" class="toctogglecheckbox" style="display:none"><div class="toctitle" lang="de" dir="ltr"><h2 id="mw-toc-heading">Inhaltsverzeichnis</h2><span class="toctogglespan"><label class="toctogglelabel" for="kanon-toctogglecheckbox"></label></span></div>\n<ul>';
			
			counter = 1;
			
			console.log(document.getElementsByClassName('tab-kanon')[0]);
			console.log(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h2'));
			Array.prototype.forEach.call(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h2'), (item) => {
					var itemIndex = Array.prototype.indexOf.call(document.getElementsByClassName('tab-kanon')[0].children, item);
					console.log(itemIndex);
				
			});
			
			
			
			ebene2counter = 1;
			Array.prototype.forEach.call(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h2'), (ebene2) => {
				TOC = TOC + '\n<li class=\"toclevel-1 tocsection-' + counter + '\"><a href=\"#' + ebene2.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '</span> <span class=\"toctext\">' + ebene2.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
				counter++;
				
				if(ebene2.getElementsByTagName('h3').length > 0){
					TOC = TOC + '<ul>';
					ebene3counter = 1;
					Array.prototype.forEach.call(ebene2.getElementsByTagName('h3'), (ebene3) => {
						TOC = TOC + '\n<li class=\"toclevel-2 tocsection-' + counter + '\"><a href=\"#' + ebene3.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '.' + ebene3counter + '</span> <span class=\"toctext\">' + ebene3.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
						counter++;
						
						if(ebene3.getElementsByTagName('h4').length > 0){
							TOC = TOC + '<ul>';
							ebene4counter = 1;
							Array.prototype.forEach.call(ebene3.getElementsByTagName('h4'), (ebene4) => {
								TOC = TOC + '\n<li class=\"toclevel-3 tocsection-' + counter + '\"><a href=\"#' + ebene4.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '.' + ebene3counter + '.' + ebene4counter + '</span> <span class=\"toctext\">' + ebene4.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
								counter++;
						
								if(ebene4.getElementsByTagName('h5').length > 0){
									TOC = TOC + '<ul>';
									ebene5counter = 1;
									Array.prototype.forEach.call(ebene4.getElementsByTagName('h5'), (ebene5) => {
										TOC = TOC + '\n<li class=\"toclevel-4 tocsection-' + counter + '\"><a href=\"#' + ebene5.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '.' + ebene3counter + '.' + ebene4counter + '.' + ebene5counter + '</span> <span class=\"toctext\">' + ebene5.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
										counter++;
						
										if(document.ebene5.getElementsByTagName('h6').length > 0){
											TOC = TOC + '<ul>';
											ebene6counter = 1;
											Array.prototype.forEach.call(ebene5.getElementsByTagName('h6'), (ebene6) => {
												TOC = TOC + '\n<li class=\"toclevel-5 tocsection-' + counter + '\"><a href=\"#' + ebene6.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '.' + ebene3counter + '.' + ebene4counter + '.' + ebene5counter + '.' + ebene6counter + '</span> <span class=\"toctext\">' + ebene6.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
												counter++;
												ebene6counter++;
											});
											TOC = TOC + '</ul>';
										}
						
										ebene5counter++;
									});
									TOC = TOC + '</ul>';
								}
						
								ebene4counter++;
							});
							TOC = TOC + '</ul>';
						}
						
						ebene3counter++;
					});
					TOC = TOC + '</ul>';
				}
				
				ebene2counter++;
			});
			TOC = TOC + '</ul>\n</div>';
			
			kanonTabContent = document.getElementsByClassName('tab-kanon')[0].innerHTML;
			ersetzung = document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h2')[0].outerHTML;
			kanonTabContent = kanonTabContent.replace(ersetzung, TOC + ersetzung);
			document.getElementsByClassName('tab-kanon')[0].innerHTML = kanonTabContent;
			if(counter-1 > maxUeberschriftenAnzahlAusgeklappt){document.getElementsByClassName('tab-kanon')[0].getElementsByClassName('toctogglelabel')[0].click();}
		}
	}
	
	if(document.getElementsByClassName('tab-legends').length > 0){if(document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h2').length > 1){
		var TOC = '<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="legends-toctogglecheckbox" class="toctogglecheckbox" style="display:none"><div class="toctitle" lang="de" dir="ltr"><h2 id="mw-toc-heading">Inhaltsverzeichnis</h2><span class="toctogglespan"><label class="toctogglelabel" for="legends-toctogglecheckbox"></label></span></div>\n<ul>';
		
		counter = 1;
		ebene2counter = 1;
		Array.prototype.forEach.call(document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h2'), (ebene2) => {
			TOC = TOC + '\n<li class=\"toclevel-1 tocsection-' + counter + '\"><a href=\"#' + ebene2.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '</span> <span class=\"toctext\">' + ebene2.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
			counter++;
			
			if(document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h3').length > 0){
				TOC = TOC + '<ul>';
				ebene3counter = 1;
				Array.prototype.forEach.call(document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h3'), (ebene3) => {
					TOC = TOC + '\n<li class=\"toclevel-2 tocsection-' + counter + '\"><a href=\"#' + ebene3.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '.' + ebene3counter + '</span> <span class=\"toctext\">' + ebene3.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
					counter++;
					
					if(document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h4').length > 0){
						TOC = TOC + '<ul>';
						ebene4counter = 1;
						Array.prototype.forEach.call(document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h4'), (ebene4) => {
							TOC = TOC + '\n<li class=\"toclevel-3 tocsection-' + counter + '\"><a href=\"#' + ebene4.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '.' + ebene3counter + '.' + ebene4counter + '</span> <span class=\"toctext\">' + ebene4.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
							counter++;
					
							if(document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h5').length > 0){
								TOC = TOC + '<ul>';
								ebene5counter = 1;
								Array.prototype.forEach.call(document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h5'), (ebene5) => {
									TOC = TOC + '\n<li class=\"toclevel-4 tocsection-' + counter + '\"><a href=\"#' + ebene5.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '.' + ebene3counter + '.' + ebene4counter + '.' + ebene5counter + '</span> <span class=\"toctext\">' + ebene5.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
									counter++;
					
									if(document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h6').length > 0){
										TOC = TOC + '<ul>';
										ebene6counter = 1;
										Array.prototype.forEach.call(document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h6'), (ebene6) => {
											TOC = TOC + '\n<li class=\"toclevel-5 tocsection-' + counter + '\"><a href=\"#' + ebene6.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '.' + ebene3counter + '.' + ebene4counter + '.' + ebene5counter + '.' + ebene6counter + '</span> <span class=\"toctext\">' + ebene6.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
											counter++;
											ebene6counter++;
										});
										TOC = TOC + '</ul>';
									}
					
									ebene5counter++;
								});
								TOC = TOC + '</ul>';
							}
					
							ebene4counter++;
						});
						TOC = TOC + '</ul>';
					}
					
					ebene3counter++;
				});
				TOC = TOC + '</ul>';
			}
			
			ebene2counter++;
		});
		TOC = TOC + '</ul>\n</div>';
		
		legendsTabContent = document.getElementsByClassName('tab-legends')[0].innerHTML;
		ersetzung = document.getElementsByClassName('tab-legends')[0].getElementsByTagName('h2')[0].outerHTML;
		legendsTabContent = legendsTabContent.replace(ersetzung, TOC + ersetzung);
		document.getElementsByClassName('tab-legends')[0].innerHTML = legendsTabContent;
		if(counter-1 > maxUeberschriftenAnzahlAusgeklappt){document.getElementsByClassName('tab-legends')[0].getElementsByClassName('toctogglelabel')[0].click();}
	}}
	
	if(document.getElementsByClassName('tab-hdk').length > 0){if(document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h2').length > 1){
		var TOC = '<div id="toc" class="toc" role="navigation" aria-labelledby="mw-toc-heading"><input type="checkbox" role="button" id="hdk-toctogglecheckbox" class="toctogglecheckbox" style="display:none"><div class="toctitle" lang="de" dir="ltr"><h2 id="mw-toc-heading">Inhaltsverzeichnis</h2><span class="toctogglespan"><label class="toctogglelabel" for="hdk-toctogglecheckbox"></label></span></div>\n<ul>';
		
		counter = 1;
		ebene2counter = 1;
		Array.prototype.forEach.call(document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h2'), (ebene2) => {
			TOC = TOC + '\n<li class=\"toclevel-1 tocsection-' + counter + '\"><a href=\"#' + ebene2.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '</span> <span class=\"toctext\">' + ebene2.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
			counter++;
			
			if(document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h3').length > 0){
				TOC = TOC + '<ul>';
				ebene3counter = 1;
				Array.prototype.forEach.call(document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h3'), (ebene3) => {
					TOC = TOC + '\n<li class=\"toclevel-2 tocsection-' + counter + '\"><a href=\"#' + ebene3.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '.' + ebene3counter + '</span> <span class=\"toctext\">' + ebene3.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
					counter++;
					
					if(document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h4').length > 0){
						TOC = TOC + '<ul>';
						ebene4counter = 1;
						Array.prototype.forEach.call(document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h4'), (ebene4) => {
							TOC = TOC + '\n<li class=\"toclevel-3 tocsection-' + counter + '\"><a href=\"#' + ebene4.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '.' + ebene3counter + '.' + ebene4counter + '</span> <span class=\"toctext\">' + ebene4.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
							counter++;
					
							if(document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h5').length > 0){
								TOC = TOC + '<ul>';
								ebene5counter = 1;
								Array.prototype.forEach.call(document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h5'), (ebene5) => {
									TOC = TOC + '\n<li class=\"toclevel-4 tocsection-' + counter + '\"><a href=\"#' + ebene5.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '.' + ebene3counter + '.' + ebene4counter + '.' + ebene5counter + '</span> <span class=\"toctext\">' + ebene5.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
									counter++;
					
									if(document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h6').length > 0){
										TOC = TOC + '<ul>';
										ebene6counter = 1;
										Array.prototype.forEach.call(document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h6'), (ebene6) => {
											TOC = TOC + '\n<li class=\"toclevel-5 tocsection-' + counter + '\"><a href=\"#' + ebene6.getElementsByClassName('mw-headline')[0].id + '\"><span class=\"tocnumber\">' + ebene2counter + '.' + ebene3counter + '.' + ebene4counter + '.' + ebene5counter + '.' + ebene6counter + '</span> <span class=\"toctext\">' + ebene6.getElementsByClassName('mw-headline')[0].innerHTML + '</span></a></li>';
											counter++;
											ebene6counter++;
										});
										TOC = TOC + '</ul>';
									}
					
									ebene5counter++;
								});
								TOC = TOC + '</ul>';
							}
					
							ebene4counter++;
						});
						TOC = TOC + '</ul>';
					}
					
					ebene3counter++;
				});
				TOC = TOC + '</ul>';
			}
			
			ebene2counter++;
		});
		TOC = TOC + '</ul>\n</div>';
		
		hdkTabContent = document.getElementsByClassName('tab-hdk')[0].innerHTML;
		ersetzung = document.getElementsByClassName('tab-hdk')[0].getElementsByTagName('h2')[0].outerHTML;
		hdkTabContent = hdkTabContent.replace(ersetzung, TOC + ersetzung);
		document.getElementsByClassName('tab-hdk')[0].innerHTML = hdkTabContent;
		if(counter-1 > maxUeberschriftenAnzahlAusgeklappt){document.getElementsByClassName('tab-hdk')[0].getElementsByClassName('toctogglelabel')[0].click();}
	}}
}



if(mw.config.get('wgNamespaceNumber') == 0 && mw.config.get('skin') == 'vector-2022' && document.getElementsByClassName('toc').length == 0){
	if(document.getElementsByClassName('tab-kanon').length > 0){if(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h2').length > 1){
		var TOC = '<input type="checkbox" id="vector-toc-collapsed-checkbox" class="vector-menu-checkbox">\n<nav id="mw-panel-toc" role="navigation" aria-label="Inhaltsverzeichnis" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark vector-sticky-pinned-container"><div id="vector-toc-pinned-container" class="vector-pinned-container"><div id="vector-toc" class="vector-toc vector-pinnable-element"><div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc"><h2 class="vector-pinnable-header-label">Inhaltsverzeichnis</h2><button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">In die Seitenleiste verschieben</button><button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">Verbergen</button></div><ul class="vector-toc-contents" id="mw-panel-toc-list"><li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1 vector-toc-level-1-active vector-toc-list-item-active"><a href="#" class="vector-toc-link"><div class="vector-toc-text">Anfang</div></a></li>';

		if(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h2').length > 0){
			ebene2counter = 1;
			Array.prototype.forEach.call(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h2'), (ebene2) => {
				TOC = TOC + '<li id=\"toc-' + ebene2.getElementsByClassName('mw-headline')[0].id + '\" class=\"vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded\"><a class=\"vector-toc-link\" href=\"#' + ebene2.getElementsByClassName('mw-headline')[0].id + '\"><div class=\"vector-toc-text\"><span class=\"vector-toc-numb\">' + ebene2counter + '</span>' + ebene2.getElementsByClassName('mw-headline')[0].innerHTML + '</div></a>';
				if(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h3').length > 0){
					TOC = TOC + '<button aria-controls=\"toc-' + ebene2.getElementsByClassName('mw-headline')[0].id + '-sublist\" class=\"cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle\" aria-expanded=\"true\"><span class=\"vector-icon vector-icon--x-small mw-ui-icon-wikimedia-expand\"></span><span>Unterabschnitt ' + ebene2.getElementsByClassName('mw-headline')[0].innerHTML + ' umschalten</span></button>';
				}
				TOC = TOC + '<ul id=\"toc-Generelles-sublist\" class=\"vector-toc-list\">';
				
				if(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h3').length > 0){
					ebene3counter = 1;
					Array.prototype.forEach.call(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h3'), (ebene3) => {
						TOC = TOC + '<li id=\"toc-' + ebene3.getElementsByClassName('mw-headline')[0].id + '\" class=\"vector-toc-list-item vector-toc-level-2 vector-toc-list-item-expanded\"><a class=\"vector-toc-link\" href=\"#' + ebene3.getElementsByClassName('mw-headline')[0].id + '\"><div class=\"vector-toc-text\"><span class=\"vector-toc-numb\">' + ebene2counter + '.' + ebene3counter + '</span>' + ebene3.getElementsByClassName('mw-headline')[0].innerHTML + '</div></a>';
						TOC = TOC + '<ul id=\"toc-Generelles-sublist\" class=\"vector-toc-list\">';
				
						if(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h4').length > 0){
							ebene4counter = 1;
							Array.prototype.forEach.call(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h4'), (ebene4) => {
								TOC = TOC + '<li id=\"toc-' + ebene4.getElementsByClassName('mw-headline')[0].id + '\" class=\"vector-toc-list-item vector-toc-level-3 vector-toc-list-item-expanded\"><a class=\"vector-toc-link\" href=\"#' + ebene4.getElementsByClassName('mw-headline')[0].id + '\"><div class=\"vector-toc-text\"><span class=\"vector-toc-numb\">' + ebene2counter + '.' + ebene3counter + '.' + ebene4counter + '</span>' + ebene4.getElementsByClassName('mw-headline')[0].innerHTML + '</div></a>';
								TOC = TOC + '<ul id=\"toc-Generelles-sublist\" class=\"vector-toc-list\">';
				
								if(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h5').length > 0){
									ebene5counter = 1;
									Array.prototype.forEach.call(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h5'), (ebene5) => {
										TOC = TOC + '<li id=\"toc-' + ebene5.getElementsByClassName('mw-headline')[0].id + '\" class=\"vector-toc-list-item vector-toc-level-4 vector-toc-list-item-expanded\"><a class=\"vector-toc-link\" href=\"#' + ebene5.getElementsByClassName('mw-headline')[0].id + '\"><div class=\"vector-toc-text\"><span class=\"vector-toc-numb\">' + ebene2counter + '.' + ebene3counter + '.' + ebene4counter + '.' + ebene5counter + '</span>' + ebene5.getElementsByClassName('mw-headline')[0].innerHTML + '</div></a>';
										TOC = TOC + '<ul id=\"toc-Generelles-sublist\" class=\"vector-toc-list\">';
				
										if(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h6').length > 0){
											ebene6counter = 1;
											Array.prototype.forEach.call(document.getElementsByClassName('tab-kanon')[0].getElementsByTagName('h6'), (ebene6) => {
												TOC = TOC + '<li id=\"toc-' + ebene6.getElementsByClassName('mw-headline')[0].id + '\" class=\"vector-toc-list-item vector-toc-level-5 vector-toc-list-item-expanded\"><a class=\"vector-toc-link\" href=\"#' + ebene6.getElementsByClassName('mw-headline')[0].id + '\"><div class=\"vector-toc-text\"><span class=\"vector-toc-numb\">' + ebene2counter + '.' + ebene3counter + '.' + ebene4counter + '.' + ebene5counter + '.' + ebene6counter + '</span>' + ebene6.getElementsByClassName('mw-headline')[0].innerHTML + '</div></a>';
												TOC = TOC + '<ul id=\"toc-Generelles-sublist\" class=\"vector-toc-list\">';
				
				
				
												TOC = TOC + '</ul></li>';
												ebene6counter++;
											});
											TOC = TOC + '</ul>';
										}
				
										TOC = TOC + '</ul></li>';
										ebene5counter++;
									});
									TOC = TOC + '</ul>';
								}
				
								TOC = TOC + '</ul></li>';
								ebene4counter++;
							});
							TOC = TOC + '</ul>';
						}
				
						TOC = TOC + '</ul></li>';
						ebene3counter++;
					});
					TOC = TOC + '</ul>';
				}
				
				TOC = TOC + '</ul></li>';
				ebene2counter++;
			});
			TOC = TOC + '</ul>';
		}
		
		TOC = TOC + '</ul></div></div></nav>';
		console.log(TOC);
		document.getElementsByClassName('vector-main-menu-container')[0].outerHTML = document.getElementsByClassName('vector-main-menu-container')[0].outerHTML + '\n' + TOC;
	}}
}