Fix ISSO and JS

This commit is contained in:
Kujiu 2020-06-20 01:21:10 +02:00
parent ed193490ed
commit cf9a89b07b
Signed by: kujiu
GPG key ID: ABBB2CAC6855599F
10 changed files with 57 additions and 18 deletions

View file

@ -2,6 +2,12 @@
Changes
=======
1.1.2 (*2020-06-21*)
====================
- Update JS and version number.
- Reintroduce Isso support.
1.1.1 (*2020-06-20*)
====================

View file

@ -1,6 +1,6 @@
{
"name": "sphinx_nervproject_theme",
"version": "1.0.0",
"version": "1.1.2",
"description": "Sphinx Nerv Project Theme",
"main": "index.js",
"directories": {

View file

@ -28,7 +28,7 @@ with open("README.rst", "r") as fh:
setup(
name="sphinx_nervproject_theme",
version="1.1.1",
version="1.1.2",
url="https://procrastinator.nerv-project.eu/nerv-project/communication/sphinx_nervproject_theme",
license="EUPL 1.2",
author="Kujiu",

View file

@ -6,7 +6,7 @@ from sphinx.environment.collectors import EnvironmentCollector
from sphinx import addnodes
from sphinx.util.osutil import relative_uri
__version__ = (1, 1, 1)
__version__ = (1, 1, 2)
sys.setrecursionlimit(15000)

View file

@ -60,8 +60,6 @@
{%- endfor %}
<script src="{{ pathto('_static/sphinx_nervproject_theme.js', 1)}}" defer></script>
<script src="{{ pathto('_static/sphinx_nervproject_theme.js', 1)}}" defer></script>
{% endif %}
{%- endblock %}
{%- if pageurl %}

View file

@ -25,6 +25,19 @@
(not pagename in ablog and ablog.disqus_pages)) %}
{% include "util/disqus.html" %}
{% endif %}
{% if ablog and theme_isso and
(not ablog[pagename].nocomments) and
((pagename in ablog and (ablog[pagename].published or
ablog.disqus_drafts)) or
(not pagename in ablog and ablog.disqus_pages)) %}
<section class="comments" id="comments">
<h2 class="panel">{{ _("Comments") }}</h2>
<section id="isso-thread"
data-isso-id="{{ pagename }}"
data-title="{{ title }}">
</section>
</section>
{% endif %}
</div>
{% endif %}
{% endblock %}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,13 +1,29 @@
function toggleSidebar() {
document.querySelector('#sidebar').toggleAttribute('opened');
"use strict";
class SidebarButton {
constructor() {
if(document.sidebarButtonLoaded===true) {
return;
}
this.buttonToggle = document.querySelector('button.sidebar-button');
if(this.buttonToggle!==undefined) {
document.sidebarButtonLoaded = true;
}
const buttonToggle = document.querySelector('button.sidebar-button');
buttonToggle.addEventListener('click', event => {
toggleSidebar();
this.buttonToggle.addEventListener('click', event => {
this.toggleSidebar();
});
buttonToggle.addEventListener('keydown', event => {
this.buttonToggle.addEventListener('keydown', event => {
if(event.keyCode === 13 || event.keyCode === 32 ) {
toggleSidebar();
this.toggleSidebar();
}
});
}
toggleSidebar() {
document.querySelector('#sidebar').toggleAttribute('opened');
}
}
new SidebarButton();

View file

@ -40,6 +40,12 @@
}
}
.sidebar-button {
cursor: pointer;
}
.sidebar {
box-shadow: 0 0 @SdBClr, -0.3em 0.1em 0.2em 0.3em @NvBgClr;
}