Skip to content

Commit

Permalink
Committing.
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Feb 23, 2021
0 parents commit 480b2eb
Show file tree
Hide file tree
Showing 14 changed files with 1,676 additions and 0 deletions.
1 change: 1 addition & 0 deletions Library/TableOfContents-minified.es
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.addEventListener("load",function(){"use strict";let e=null;if(null===(e=window.document.getElementById("TableOfContents")))throw new Error("No table of contents on the web page.");let t=null;if(void 0!==e.dataset.displayToggle)if("true"===e.dataset.displayToggle)t=!0;else{if("false"!==e.dataset.displayToggle)throw new Error('The "displayToggle" attribute has an invalid value.');t=!1}let a=null;if(void 0!==e.dataset.floatRight)if("true"===e.dataset.floatRight)a=!0;else{if("false"!==e.dataset.floatRight)throw new Error('The "floatRight" attribute has an invalid value.');a=!1}let l="en",o={en:{contents:"Contents",hide:"hide",show:"show"},es:{contents:"Índice",hide:"ocultar",show:"mostrar"},is:{contents:"Efnisyfirlit",hide:"fela",show:"sýna"}};if(void 0!==e.dataset.language){if(!(e.dataset.language in o))throw new Error('The "language" attribute has an invalid value.');l=e.dataset.language}let n=6;if(void 0!==e.dataset.levelRestriction)switch(e.dataset.levelRestriction){case"2":n=2;break;case"3":n=3;break;case"4":n=4;break;case"5":n=5;break;case"6":n=6;break;default:throw new Error('The "levelRestriction" attribute has an invalid value.')}let i=null;if(void 0!==e.dataset.numbering)if("true"===e.dataset.numbering)i=!0;else{if("false"!==e.dataset.numbering)throw new Error('The "numbering" attribute has an invalid value.');i=!1}let d=!1;void 0!==e.dataset.relocation&&(d=!0);let s="",r=[],c=0,h=0,f=0,u=0,g=0,w=0,b=0,p=e.parentNode;s+='<div id="TableOfContentsList">',function e(t){if(1===t.nodeType){switch(t.tagName){case"H2":if(n<2)break;h=0,f=0,u=0,g=0,m(2,t,++c);break;case"H3":if(n<3)break;f=0,u=0,g=0,m(3,t,++h);break;case"H4":if(n<4)break;u=0,g=0,m(4,t,++f);break;case"H5":if(n<5)break;g=0,m(5,t,++u);break;case"H6":if(n<6)break;m(6,t,++g)}for(t=t.firstChild;t;)e(t),t=t.nextSibling}}(p);for(let e=1;e<w;++e)s+="</li>",s+="</ol>";if(s+="</div>",c+h+f+u+g===0)throw new Error("No headings on the web page.");let T="";t&&(T=' <span id="TableOfContentsDisplayToggle">[<span id="TableOfContentsDisplayToggleText">'+o[l].hide+"</span>]</span>");let y='<div id="TableOfContentsHeader">'+o[l].contents+T+"</div>";if(s=y+s,d){let t=window.document.getElementById(e.dataset.relocation);t.innerHTML=s,e.setAttribute("id",""),t.setAttribute("id","TableOfContents"),e=window.document.getElementById("TableOfContents")}else if(e.innerHTML=s,t){let e=window.document.getElementById("TableOfContentsDisplayToggle"),t=localStorage.getItem("TableOfContentsDisplayToggleState"),a=window.document.getElementById("TableOfContentsDisplayToggleText"),n=window.document.getElementById("TableOfContentsList");null===t&&(localStorage.setItem("TableOfContentsDisplayToggleState","true"),t=localStorage.getItem("TableOfContentsDisplayToggleState")),"true"===t?(n.style.display="block",a.textContent=o[l].hide):"false"===t&&(n.style.display="none",a.textContent=o[l].show),e.onclick=function(){a.textContent===o[l].hide?(n.style.display="none",a.textContent=o[l].show,localStorage.setItem("TableOfContentsDisplayToggleState","false")):a.textContent===o[l].show&&(n.style.display="block",a.textContent=o[l].hide,localStorage.setItem("TableOfContentsDisplayToggleState","true"))}}function m(e,t,a){let l="",o=0;for(let e=0;e<r.length;++e)r[e]==t.childNodes[0].nodeValue&&++o;o>0&&(l="_"+ ++o),r.push(t.childNodes[0].nodeValue),t.setAttribute("id",encodeURIComponent(t.childNodes[0].nodeValue+l));let n="";if(0!==c&&(n+=c+"."),0!==h&&(n+=h+"."),0!==f&&(n+=f+"."),0!==u&&(n+=u+"."),0!==g&&(n+=g+"."),b<(w=e))s+="<ol>",s+=i?'<li><a href="'+window.location.href.replace(location.hash,"")+"#"+encodeURIComponent(t.childNodes[0].nodeValue+l)+'">'+n+" "+t.childNodes[0].nodeValue+"</a>":'<li><a href="'+window.location.href.replace(location.hash,"")+"#"+encodeURIComponent(t.childNodes[0].nodeValue+l)+'">'+t.childNodes[0].nodeValue+"</a>";else if(b>w){let e=b-w;for(let t=0;t<e;++t)s+="</li>",s+="</ol>";s+=i?'<li><a href="'+window.location.href.replace(location.hash,"")+"#"+encodeURIComponent(t.childNodes[0].nodeValue+l)+'">'+n+" "+t.childNodes[0].nodeValue+"</a>":'<li><a href="'+window.location.href.replace(location.hash,"")+"#"+encodeURIComponent(t.childNodes[0].nodeValue+l)+'">'+t.childNodes[0].nodeValue+"</a>"}else s+="</li>",s+=i?'<li><a href="'+window.location.href.replace(location.hash,"")+"#"+encodeURIComponent(t.childNodes[0].nodeValue+l)+'">'+n+" "+t.childNodes[0].nodeValue+"</a>":'<li><a href="'+window.location.href.replace(location.hash,"")+"#"+encodeURIComponent(t.childNodes[0].nodeValue+l)+'">'+t.childNodes[0].nodeValue+"</a>";b=w,t.childNodes[0].nodeValue=i?n+" "+t.childNodes[0].nodeValue:t.childNodes[0].nodeValue}a&&(e.style.clear="right",e.style.float="right",e.style.margin="0 0 10px 10px"),e.style.display="inline-block"},!1);
85 changes: 85 additions & 0 deletions Library/TableOfContents.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
@charset "UTF-8";

/*
Copyright © 2016–2017, 2019, 2021 eMedia Intellect.
This file is part of eMI TOC Generator.
eMI TOC Generator is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
eMI TOC Generator is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with eMI TOC Generator. If not, see <http://www.gnu.org/licenses/>.
*/

#TableOfContents
{
background-color: #F9F9F9;
border: 1px solid #AAAAAA;
display: none;
font-size: 90%;
line-height: 160%;
padding: 5px;
}

#TableOfContents a
{
text-decoration: none;
}

#TableOfContents a:hover
{
text-decoration: underline;
}

@media print
{
#TableOfContents a:link, #TableOfContents a:visited
{
color: #000000;
}
}

#TableOfContentsDisplayToggle
{
font-size: smaller;
font-weight: normal;
}

@media print
{
#TableOfContentsDisplayToggle
{
display: none;
}
}

#TableOfContentsDisplayToggleText
{
color: blue;
cursor: pointer;
}

#TableOfContentsHeader
{
font-weight: bold;
text-align: center;
}

#TableOfContentsList > ol
{
padding: 0;
}

#TableOfContentsList ol
{
list-style-type: none;
margin: 0;
}
Loading

0 comments on commit 480b2eb

Please sign in to comment.