var aiHeadCnts = ;

for(let headCur of document.querySelectorAll('[class^="mw-heading"'))
{
	let bNewHeadLevel = false;
	let iOldHeadCurLevel = aiHeadCnts.length;
	let iLevelOfCurHead = parseInt(Array.from(headCur.classList).find((strCurClass) => /mw-heading\d+/i.test(strCurClass)).replace(/mw-heading/i, '')) - 1;

	if(iLevelOfCurHead < iOldHeadCurLevel)
		aiHeadCnts = aiHeadCnts.slice(0, iLevelOfCurHead);
	else if(iLevelOfCurHead > iOldHeadCurLevel)
	{
		aiHeadCnts = aiHeadCnts.concat(new Array(iLevelOfCurHead - iOldHeadCurLevel).fill(1));
		
		bNewHeadLevel = true;
	}
		
	if(!bNewHeadLevel)
		aiHeadCnts++;
	
	let spanCurLabel = headCur.querySelector('.header-label');
	if(spanCurLabel == null)
	{
		spanCurLabel = document.createElement("span");
		spanCurLabel.className = "header-label";
		
		headCur.prepend(spanCurLabel);
	}
	spanCurLabel.innerText = aiHeadCnts.join('.')
}