mirror of
https://0xacab.org/anarsec/anarsec.guide.git
synced 2025-06-24 14:30:35 -04:00
improve toc js
This commit is contained in:
parent
89dd57f725
commit
27cbe3f4fd
3 changed files with 20 additions and 3 deletions
|
@ -234,7 +234,7 @@ To install Element Desktop, Whonix is not guaranteed to have Tor Stream Isolatio
|
||||||
* Open a Terminal in the new Template: **Applications menu → Template: whonix-ws-16-element: Xfce Terminal**
|
* Open a Terminal in the new Template: **Applications menu → Template: whonix-ws-16-element: Xfce Terminal**
|
||||||
* Run the commands in the [Element install guide](https://element.io/download#linux) to install Element Desktop in the Template.
|
* Run the commands in the [Element install guide](https://element.io/download#linux) to install Element Desktop in the Template.
|
||||||
* Template qubes require a proxy for `wget`. Before running the command, create a configuration file at `~/.wgetrc` in the Template, with the contents:
|
* Template qubes require a proxy for `wget`. Before running the command, create a configuration file at `~/.wgetrc` in the Template, with the contents:
|
||||||
```
|
```bash
|
||||||
use_proxy = on
|
use_proxy = on
|
||||||
http_proxy = 127.0.0.1:8082
|
http_proxy = 127.0.0.1:8082
|
||||||
https_proxy = 127.0.0.1:8082
|
https_proxy = 127.0.0.1:8082
|
||||||
|
|
|
@ -20,11 +20,28 @@
|
||||||
return (c.top <= h) && (n.top - menuBarHeight >= 0);
|
return (c.top <= h) && (n.top - menuBarHeight >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function highlightTocItem(tocIndex) {
|
||||||
|
const bottomGap = 50;
|
||||||
|
tocItems[tocIndex].classList.add('is-active');
|
||||||
|
const bodyRect = document.body.getBoundingClientRect();
|
||||||
|
const elemRect = tocItems[tocIndex].getBoundingClientRect();
|
||||||
|
const menuRect = document.querySelector(".menu").getBoundingClientRect();
|
||||||
|
const menuAbsTop = menuRect.top - bodyRect.top;
|
||||||
|
const elemAbsBottom = elemRect.bottom - bodyRect.top;
|
||||||
|
const h = (window.innerHeight || document.documentElement.clientHeight);
|
||||||
|
if(elemAbsBottom > menuAbsTop + h - 48 - bottomGap){
|
||||||
|
document.querySelector(".menu").style = "position: sticky; top: " + (menuAbsTop - elemAbsBottom + h - bottomGap).toString() + "px";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
document.querySelector(".menu").style = "position: sticky; top: 48px;";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function activateIfVisible() {
|
function activateIfVisible() {
|
||||||
let b = true;
|
let b = true;
|
||||||
for (let i = 0; i < tocItems.length; i++) {
|
for (let i = 0; i < tocItems.length; i++) {
|
||||||
if (b && isVisible(i)) {
|
if (b && isVisible(i)) {
|
||||||
tocItems[i].classList.add('is-active');
|
highlightTocItem(i);
|
||||||
b = false;
|
b = false;
|
||||||
} else
|
} else
|
||||||
tocItems[i].classList.remove('is-active');
|
tocItems[i].classList.remove('is-active');
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; font-src 'self'; img-src 'self'; script-src 'self'; media-src 'self'; style-src 'self';" />
|
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; font-src 'self'; img-src 'self'; script-src 'self'; media-src 'self'; style-src 'self' 'unsafe-inline';" />
|
||||||
<meta content="width=device-width, initial-scale=1" name="viewport" />
|
<meta content="width=device-width, initial-scale=1" name="viewport" />
|
||||||
<meta content="#ffffff" name="theme-color" />
|
<meta content="#ffffff" name="theme-color" />
|
||||||
<meta content="#da532c" name="msapplication-TileColor" />
|
<meta content="#da532c" name="msapplication-TileColor" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue