Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418346/* toggless.js Frank Lübeck */12/* this file contains two functions:3mergeSideTOCHooks: this changes div.ContSect elements to the class4ContSectClosed and includes a hook to toggle between5ContSectClosed and ContSectOpen.6openclosetoc: this function does the toggling, the rest is done by7CSS8*/9101112closedTOCMarker = "▶ ";13openTOCMarker = "▼ ";14noTOCMarker = " ";15/* merge hooks into side toc for opening/closing subsections16with openclosetoc */17function mergeSideTOCHooks() {18var hlist = document.getElementsByTagName("div");19for (var i = 0; i < hlist.length; i++) {20if (hlist[i].className == "ContSect") {21var chlds = hlist[i].childNodes;22var el = document.createElement("span");23var oncl = document.createAttribute("class");24oncl.nodeValue = "toctoggle";25el.setAttributeNode(oncl);26var cont;27if (chlds.length > 2) {28var oncl = document.createAttribute("onclick");29oncl.nodeValue = "openclosetoc(event)";30el.setAttributeNode(oncl);31cont = document.createTextNode(closedTOCMarker);32} else {33cont = document.createTextNode(noTOCMarker);34}35el.appendChild(cont);36hlist[i].firstChild.insertBefore(el, hlist[i].firstChild.firstChild);37hlist[i].className = "ContSectClosed";38}39}40}4142function openclosetoc (event) {43/* first two steps to make it work in most browsers */44var evt=window.event || event;45if (!evt.target)46evt.target=evt.srcElement;4748var markClosed = document.createTextNode(closedTOCMarker);49var markOpen = document.createTextNode(openTOCMarker);5051var par = evt.target.parentNode.parentNode;52if (par.className == "ContSectOpen") {53par.className = "ContSectClosed";54evt.target.replaceChild(markClosed, evt.target.firstChild);55}56else if (par.className == "ContSectClosed") {57par.className = "ContSectOpen";58evt.target.replaceChild(markOpen, evt.target.firstChild);59}60}6162/* adjust jscontent which is called onload */63jscontentfuncs.push(mergeSideTOCHooks);64656667