use links ending in index.html for easier file:// viewing

This commit is contained in:
xenofem 2024-01-23 21:01:02 -05:00
parent 79b946889d
commit a825162dee
8 changed files with 27 additions and 25 deletions

View file

@ -98,7 +98,7 @@ document.addEventListener('DOMContentLoaded', () => {
function exitToWork() { function exitToWork() {
changeDuration(duration, true); changeDuration(duration, true);
localStorage.setItem(`${WORK_ID}-currentPage`, 0); localStorage.setItem(`${WORK_ID}-currentPage`, 0);
window.location.href = "../"; window.location.href = `../${INDEX}`;
} }
function hideTapZones() { function hideTapZones() {

View file

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark"> <meta name="color-scheme" content="dark">
<title>{% block title %}{% if title %}{{ title }} - {% else %}{% endif %}DLibrary{% endblock %}</title> <title>{% block title %}{% if title %}{{ title }} - {% else %}{% endif %}DLibrary{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{{ root() }}static/dlibrary.css"> <link rel="stylesheet" type="text/css" href="{{ root() }}/static/dlibrary.css">
{% block head %}{% endblock %} {% block head %}{% endblock %}
</head> </head>
<body> <body>

View file

@ -1,18 +1,18 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}{{ categorization.capitalize() }} - DLibrary{% endblock %} {% block title %}{{ categorization.capitalize() }} - DLibrary{% endblock %}
{% block body %} {% block body %}
{% from 'utils.html' import urlcat, root with context %} {% from 'utils.html' import urlcat, index, root with context %}
<h1 id="title"><a href="{{ root() }}">DLibrary</a> &gt; <a href="{{ root() }}{{ categorization }}">{{ categorization.capitalize() }}</a></h1> <h1 id="title"><a href="{{ root() }}/{{ index() }}">DLibrary</a> &gt; {{ categorization.capitalize() }}</h1>
{% include 'nav.html' %} {% include 'nav.html' %}
<div class="card-listing"> <div class="card-listing">
{% for cat in categories %} {% for cat in categories %}
<div class="card {% if not work_style_cards %}category{% endif %}"> <div class="card {% if not work_style_cards %}category{% endif %}">
<a href="{{ root() }}{{ categorization }}/{{ urlcat(cat) }}/"> <a href="{{ root() }}/{{ categorization }}/{{ urlcat(cat) }}/{{ index() }}">
<div class="card-title"> <div class="card-title">
{{ cat }} {{ cat }}
</div> </div>
{% if samples[cat] %} {% if samples[cat] %}
<img src="{{ root() }}thumbnails/{{ samples[cat]['id'] }}.jpg"> <img src="{{ root() }}/thumbnails/{{ samples[cat]['id'] }}.jpg">
{% endif %} {% endif %}
</a> </a>
</div> </div>

View file

@ -1,13 +1,13 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block body %} {% block body %}
{% from 'utils.html' import root with context %} {% from 'utils.html' import index, root with context %}
<h1 id="title"><a href="{{ root() }}">DLibrary</a>{% if categorization %} &gt; <a href="{{ root() }}{{ categorization }}">{{ categorization.capitalize() }}</a>{% endif %}{% if title %} &gt; {{ title }}{% endif %}</h1> <h1 id="title"><a href="{{ root() }}/{{ index() }}">DLibrary</a>{% if categorization %} &gt; <a href="{{ root() }}/{{ categorization }}/{{ index() }}">{{ categorization.capitalize() }}</a>{% endif %}{% if title %} &gt; {{ title }}{% endif %}</h1>
{% include 'nav.html' %} {% include 'nav.html' %}
<div class="card-listing"> <div class="card-listing">
{% for work in works %} {% for work in works %}
<div class="card"> <div class="card">
<a href="{{ root() }}works/{{ work['id'] }}/"> <a href="{{ root() }}/works/{{ work['id'] }}/{{ index() }}">
<img src="{{ root() }}thumbnails/{{ work['id'] }}.jpg"> <img src="{{ root() }}/thumbnails/{{ work['id'] }}.jpg">
<div class="card-authors"> <div class="card-authors">
[{% if work['circle'] %}{{ work['circle'] }}{% endif %}{% if work['circle'] and work['authors'] %} ({% endif %}{{ ', '.join(work['authors']) }}{% if work['circle'] and work['authors'] %}){% endif %}] [{% if work['circle'] %}{{ work['circle'] }}{% endif %}{% if work['circle'] and work['authors'] %} ({% endif %}{{ ', '.join(work['authors']) }}{% if work['circle'] and work['authors'] %}){% endif %}]
</div> </div>

View file

@ -1,2 +1,2 @@
{% from 'utils.html' import root with context %} {% from 'utils.html' import root, index with context %}
<div class="nav">{% for c in ['circles', 'authors', 'tags', 'series'] %}<div class="nav-item"><a href="{{ root() }}{{ c }}">{{ c.capitalize() }}</a></div>{% endfor %}</div> <div class="nav">{% for c in ['circles', 'authors', 'tags', 'series'] %}<div class="nav-item"><a href="{{ root() }}/{{ c }}/{{ index() }}">{{ c.capitalize() }}</a></div>{% endfor %}</div>

View file

@ -1,2 +1,3 @@
{% macro root() %}{% for i in range(depth) %}../{% endfor %}{% endmacro %} {% macro root() %}{% if depth == 0 %}.{% else %}..{% endif %}{{ '/..' * (depth-1) }}{% endmacro %}
{% macro index() %}{% if not noindex %}index.html{% endif %}{% endmacro %}
{% macro urlcat(s) %}{{ s | replace('/', ' ') | urlencode }}{% endmacro %} {% macro urlcat(s) %}{{ s | replace('/', ' ') | urlencode }}{% endmacro %}

View file

@ -1,16 +1,17 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% from 'utils.html' import root with context %} {% from 'utils.html' import index, root with context %}
{% block head %} {% block head %}
<link rel="stylesheet" type="text/css" href="{{ root() }}static/viewer.css"> <link rel="stylesheet" type="text/css" href="{{ root() }}/static/viewer.css">
<script> <script>
const WORK_ID = "{{ work['id'] }}"; const WORK_ID = "{{ work['id'] }}";
const INDEX = "{{ index() }}";
</script> </script>
<script src="{{ root() }}static/viewer.js"></script> <script src="{{ root() }}/static/viewer.js"></script>
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<div id="viewer-images"> <div id="viewer-images">
{% for filename in images %} {% for filename in images %}
<img src="{{ root() }}images/{{ work['id'] }}/{{ filename }}" class="viewer-image"> <img src="{{ root() }}/images/{{ work['id'] }}/{{ filename }}" class="viewer-image">
{% endfor %} {% endfor %}
</div> </div>
<div id="progress"></div> <div id="progress"></div>

View file

@ -1,11 +1,11 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block body %} {% block body %}
{% from 'utils.html' import urlcat, root with context %} {% from 'utils.html' import urlcat, root, index with context %}
<h1 id="title"><a href="{{ root() }}">DL</a> &gt; {{ title }}</h1> <h1 id="title"><a href="{{ root() }}/{{ index() }}">DL</a> &gt; {{ title }}</h1>
<div class="work-container"> <div class="work-container">
<div class="work-preview"> <div class="work-preview">
<a href="view/"> <a href="view/{{ index() }}">
<img src="{{ root() }}thumbnails/{{ work['id'] }}.jpg"> <img src="{{ root() }}/thumbnails/{{ work['id'] }}.jpg">
</a> </a>
</div> </div>
<div class="work-info"> <div class="work-info">
@ -13,25 +13,25 @@
{% if work['circle'] %} {% if work['circle'] %}
<tr> <tr>
<th>Circle</th> <th>Circle</th>
<td><a class="work-info-link" href="{{ root() }}circles/{{ urlcat(work['circle']) }}">{{ work['circle'] }}</a></td> <td><a class="work-info-link" href="{{ root() }}/circles/{{ urlcat(work['circle']) }}/{{ index() }}">{{ work['circle'] }}</a></td>
</tr> </tr>
{% endif %} {% endif %}
{% if work['authors'] %} {% if work['authors'] %}
<tr> <tr>
<th>Authors</th> <th>Authors</th>
<td>{% for author in work['authors'] %}<a class="work-info-link" href="{{ root() }}authors/{{ urlcat(author) }}">{{ author }}</a> {% endfor %}</td> <td>{% for author in work['authors'] %}<a class="work-info-link" href="{{ root() }}/authors/{{ urlcat(author) }}/{{ index() }}">{{ author }}</a> {% endfor %}</td>
</tr> </tr>
{% endif %} {% endif %}
{% if work['tags'] %} {% if work['tags'] %}
<tr> <tr>
<th>Tags</th> <th>Tags</th>
<td>{% for tag in work['tags'] %}<a class="work-info-link" href="{{ root() }}tags/{{ urlcat(tag) }}">{{ tag }}</a> {% endfor %}</td> <td>{% for tag in work['tags'] %}<a class="work-info-link" href="{{ root() }}/tags/{{ urlcat(tag) }}/{{ index() }}">{{ tag }}</a> {% endfor %}</td>
</tr> </tr>
{% endif %} {% endif %}
{% if work['series'] %} {% if work['series'] %}
<tr> <tr>
<th>Series</th> <th>Series</th>
<td><a class="work-info-link" href="{{ root() }}series/{{ urlcat(work['series']) }}">{{ work['series'] }}</a></td> <td><a class="work-info-link" href="{{ root() }}/series/{{ urlcat(work['series']) }}/{{ index() }}">{{ work['series'] }}</a></td>
</tr> </tr>
{% endif %} {% endif %}
</table> </table>