Detangle src/readtheorg_theme/js/readtheorg.js

This commit is contained in:
Fabrice Niessen 2022-02-06 18:20:34 +01:00
parent 116d473b25
commit 10ecfa4ce2
1 changed files with 50 additions and 30 deletions

View File

@ -16,9 +16,9 @@ Get the lowdown on the key pieces of ReadTheOrg's infrastructure, including our
approach to better HTML export. approach to better HTML export.
* Typography * Typography
:PROPERTIES: :PROPERTIES:
:header-args: :tangle css/readtheorg.css :header-args: :tangle css/readtheorg.css
:END: :END:
#+begin_src css #+begin_src css
@import url("https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700"); @import url("https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700");
@ -216,9 +216,9 @@ dl dd{
#+end_src #+end_src
* Media queries * Media queries
:PROPERTIES: :PROPERTIES:
:header-args: :tangle css/readtheorg.css :header-args: :tangle css/readtheorg.css
:END: :END:
#+begin_src css #+begin_src css
@media print{ @media print{
@ -357,9 +357,9 @@ dl dd{
#+end_src #+end_src
* Code * Code
:PROPERTIES: :PROPERTIES:
:header-args: :tangle css/readtheorg.css :header-args: :tangle css/readtheorg.css
:END: :END:
** Inline ** Inline
@ -437,9 +437,9 @@ pre.src{
#+end_src #+end_src
* Tables * Tables
:PROPERTIES: :PROPERTIES:
:header-args: :tangle css/readtheorg.css :header-args: :tangle css/readtheorg.css
:END: :END:
** Basic example ** Basic example
@ -494,9 +494,9 @@ table tr:nth-child(2n) td{
#+end_src #+end_src
* Images * Images
:PROPERTIES: :PROPERTIES:
:header-args: :tangle css/readtheorg.css :header-args: :tangle css/readtheorg.css
:END: :END:
** Optional image caption ** Optional image caption
@ -509,9 +509,9 @@ table tr:nth-child(2n) td{
#+end_src #+end_src
* Helper classes * Helper classes
:PROPERTIES: :PROPERTIES:
:header-args: :tangle css/readtheorg.css :header-args: :tangle css/readtheorg.css
:END: :END:
#+begin_src css #+begin_src css
.rotate-90{ .rotate-90{
@ -532,9 +532,9 @@ table tr:nth-child(2n) td{
#+end_src #+end_src
* Responsive utilities * Responsive utilities
:PROPERTIES: :PROPERTIES:
:header-args: :tangle css/readtheorg.css :header-args: :tangle css/readtheorg.css
:END: :END:
Responsive for sidebar: Responsive for sidebar:
@ -595,9 +595,9 @@ Responsive for sidebar:
#+end_src #+end_src
* CSS * CSS
:PROPERTIES: :PROPERTIES:
:header-args: :tangle css/readtheorg.css :header-args: :tangle css/readtheorg.css
:END: :END:
#+begin_src css #+begin_src css
*{ *{
@ -1274,9 +1274,9 @@ for nice yellow or orange boxes.
#+end_src #+end_src
* Htmlize * Htmlize
:PROPERTIES: :PROPERTIES:
:header-args: :tangle css/htmlize.css :header-args: :tangle css/htmlize.css
:END: :END:
#+begin_src css #+begin_src css
.org-bold { /* bold */ font-weight: bold; } .org-bold { /* bold */ font-weight: bold; }
@ -1427,11 +1427,31 @@ for nice yellow or orange boxes.
#+end_src #+end_src
* JS * JS
:PROPERTIES: :PROPERTIES:
:header-args: :tangle js/readtheorg.js :header-args: :tangle js/readtheorg.js
:END: :END:
#+begin_src js #+begin_src js
function collapse_toc_elements_on_click (nav_li_a){
/*
When an `a' element in the TOC is clicked, its parent
`li' element's active attribute is toggled. This causes
the element to toggle between minimized and maximized
states. The active attribute is documented in bootstrap.
https://getbootstrap.com/docs/4.0/components/navbar/#nav
*/
$(nav_li_a).parent().toggleClass("active");
}
$( document ).ready(function() {
// When the document is loaded and ready, bind the
// function `collapse_toc_elements_on_click' to the
// `a' elements in the table of contents.
$("#text-table-of-contents a").click(function() {
collapse_toc_elements_on_click(this);
});
});
$(function() { $(function() {
$('.note').before("<p class='admonition-title note'>Note</p>"); $('.note').before("<p class='admonition-title note'>Note</p>");
$('.seealso').before("<p class='admonition-title seealso'>See also</p>"); $('.seealso').before("<p class='admonition-title seealso'>See also</p>");