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/* manual.js Frank Lübeck */12/* This file contains a few javascript functions which allow to switch3between display styles for GAPDoc HTML manuals.4If javascript is switched off in a browser or this file in not available5in a manual directory, this is no problem. Users just cannot switch6between several styles and don't see the corresponding button.78A style with name mystyle can be added by providing two files (or only9one of them).10mystyle.js: Additional javascript code for the style, it is11read in the HTML pages after this current file.12The additional code may adjust the preprocessing function13jscontent() with is called onload of a file. This14is done by appending functions to jscontentfuncs15(jscontentfuncs.push(newfunc);).16Make sure, that your style is still usable without17javascript.18mystyle.css: CSS configuration, read after manual.css (so it can19just reconfigure a few details, or overwrite everything).2021Then adjust chooser.html such that users can switch on and off mystyle.2223A user can change the preferred style permanently by using the [Style]24link and choosing one. Or one can append '?GAPDocStyle=mystyle' to the URL25when loading any file of the manual (so the style can be configured in26the GAP user preferences).2728*/2930/* generic helper function */31function deleteCookie(nam) {32document.cookie = nam+"=;Path=/;expires=Thu, 01 Jan 1970 00:00:00 GMT";33}3435/* read a value from a "nam1=val1;nam2=val2;..." string (e.g., the search36part of an URL or a cookie */37function valueString(str,nam) {38var cs = str.split(";");39for (var i=0; i < cs.length; i++) {40var pos = cs[i].search(nam+"=");41if (pos > -1) {42pos = cs[i].indexOf("=");43return cs[i].slice(pos+1);44}45}46return 0;47}4849/* when a non-default style is chosen via URL or a cookie, then50the cookie is reset and the styles .js and .css files are read */51function overwriteStyle() {52/* style in URL? */53var style = valueString(window.location.search, "GAPDocStyle");54/* otherwise check cookie */55if (style == 0)56style = valueString(document.cookie, "GAPDocStyle");57if (style == 0)58return;59if (style == "default")60deleteCookie("GAPDocStyle");61else {62/* ok, we set the cookie for path "/" */63var path = "/";64/* or better like this ???65var here = window.location.pathname.split("/");66for (var i=0; i+3 < here.length; i++)67path = path+"/"+here[i];68*/69document.cookie = "GAPDocStyle="+style+";Path="+path;70/* split into names of style files */71var stlist = style.split(",");72/* read style's css and js files */73for (var i=0; i < stlist.length; i++) {74document.writeln('<link rel="stylesheet" type="text/css" href="'+75stlist[i]+'.css" />');76document.writeln('<script src="'+stlist[i]+77'.js" type="text/javascript"></script>');78}79}80}8182/* this adds a "[Style]" link next to the MathJax switcher */83function addStyleLink() {84var line = document.getElementById("mathjaxlink");85var el = document.createElement("a");86var oncl = document.createAttribute("href");87var back = window.location.protocol+"//"88if (window.location.protocol == "http:") {89back = back+window.location.host;90if (window.location.port != "") {91back = back+":"+window.location.port;92}93}94back = back+window.location.pathname;95oncl.nodeValue = "chooser.html?BACK="+back;96el.setAttributeNode(oncl);97var cont = document.createTextNode(" [Style]");98el.appendChild(cont);99line.appendChild(el);100}101102var jscontentfuncs = new Array();103104jscontentfuncs.push(addStyleLink);105106/* the default jscontent() only adds the [Style] link to the page */107function jscontent () {108for (var i=0; i < jscontentfuncs.length; i++)109jscontentfuncs[i]();110}111112113114