User:Surjection/tocColumn.js

mw.hook("wikipage.content").add(function($) {   var toc = document.getElementById("toc");    var bodyContent = document.getElementById("bodyContent");    var contentText = document.getElementById("mw-content-text");    var tocUl = document.getElementById("toc").querySelector("ul");    if (toc && bodyContent && contentText) {        var tocHolder = document.createElement("div");        var tocParent = document.createElement("div");        tocHolder.style.display = "flex";        tocParent.style.marginLeft = "0.5em";        bodyContent.insertBefore(tocHolder, contentText);        tocHolder.appendChild(contentText);        tocHolder.appendChild(tocParent);        tocParent.appendChild(toc);        contentText.style.flex = "1";        contentText.style.flexShrink = "0";        if (tocUl) {            tocUl.style.width = "16em";        }    } });