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() {
changeDuration(duration, true);
localStorage.setItem(`${WORK_ID}-currentPage`, 0);
window.location.href = "../";
window.location.href = `../${INDEX}`;
}
function hideTapZones() {

View file

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<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 %}
</head>
<body>

View file

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

View file

@ -1,13 +1,13 @@
{% extends 'base.html' %}
{% block body %}
{% from 'utils.html' import 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>
{% from 'utils.html' import index, root with context %}
<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' %}
<div class="card-listing">
{% for work in works %}
<div class="card">
<a href="{{ root() }}works/{{ work['id'] }}/">
<img src="{{ root() }}thumbnails/{{ work['id'] }}.jpg">
<a href="{{ root() }}/works/{{ work['id'] }}/{{ index() }}">
<img src="{{ root() }}/thumbnails/{{ work['id'] }}.jpg">
<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 %}]
</div>

View file

@ -1,2 +1,2 @@
{% from 'utils.html' import root 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>
{% 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 }}/{{ 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 %}

View file

@ -1,16 +1,17 @@
{% extends 'base.html' %}
{% from 'utils.html' import root with context %}
{% from 'utils.html' import index, root with context %}
{% 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>
const WORK_ID = "{{ work['id'] }}";
const INDEX = "{{ index() }}";
</script>
<script src="{{ root() }}static/viewer.js"></script>
<script src="{{ root() }}/static/viewer.js"></script>
{% endblock %}
{% block body %}
<div id="viewer-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 %}
</div>
<div id="progress"></div>

View file

@ -1,11 +1,11 @@
{% extends 'base.html' %}
{% block body %}
{% from 'utils.html' import urlcat, root with context %}
<h1 id="title"><a href="{{ root() }}">DL</a> &gt; {{ title }}</h1>
{% from 'utils.html' import urlcat, root, index with context %}
<h1 id="title"><a href="{{ root() }}/{{ index() }}">DL</a> &gt; {{ title }}</h1>
<div class="work-container">
<div class="work-preview">
<a href="view/">
<img src="{{ root() }}thumbnails/{{ work['id'] }}.jpg">
<a href="view/{{ index() }}">
<img src="{{ root() }}/thumbnails/{{ work['id'] }}.jpg">
</a>
</div>
<div class="work-info">
@ -13,25 +13,25 @@
{% if work['circle'] %}
<tr>
<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>
{% endif %}
{% if work['authors'] %}
<tr>
<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>
{% endif %}
{% if work['tags'] %}
<tr>
<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>
{% endif %}
{% if work['series'] %}
<tr>
<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>
{% endif %}
</table>