fix: Prevent React app flash by hiding static content with display: none
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -32,8 +32,8 @@
|
|||||||
|
|
||||||
<script>document.documentElement.className = 'js-enabled';</script>
|
<script>document.documentElement.className = 'js-enabled';</script>
|
||||||
<style>
|
<style>
|
||||||
.js-enabled #root > * {
|
.js-enabled .static-content {
|
||||||
visibility: hidden;
|
display: none;
|
||||||
}
|
}
|
||||||
html {
|
html {
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
@@ -58,97 +58,99 @@
|
|||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<div id="root">
|
<div id="root">
|
||||||
<div class="container menu">
|
<div class="static-content">
|
||||||
<p>
|
<div class="container menu">
|
||||||
<a href="/">QotNews</a>
|
<p>
|
||||||
<br />
|
<a href="/">QotNews</a>
|
||||||
<span class="slogan">Hacker News, Reddit, Lobsters, and Tildes articles rendered in reader mode.</span>
|
<br />
|
||||||
</p>
|
<span class="slogan">Hacker News, Reddit, Lobsters, and Tildes articles rendered in reader mode.</span>
|
||||||
</div>
|
</p>
|
||||||
{% if story %}
|
|
||||||
<div class="{% if show_comments %}container{% else %}article-container{% endif %}">
|
|
||||||
<div class="article">
|
|
||||||
<h1>{{ story.title }}</h1>
|
|
||||||
|
|
||||||
{% if show_comments %}
|
|
||||||
<div class="info">
|
|
||||||
<a href="/{{ story.id }}">View article</a>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<div class="info">
|
|
||||||
Source: <a class="source" href="{{ story.url or story.link }}">{{ url }}</a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div class="info">
|
|
||||||
{{ story.score }} points
|
|
||||||
by <a href="{{ story.author_link }}">{{ story.author }}</a>
|
|
||||||
{{ story.date | fromnow }}
|
|
||||||
on <a href="{{ story.link }}">{{ story.source }}</a> |
|
|
||||||
<a href="/{{ story.id }}/c">
|
|
||||||
{{ story.num_comments }} comment{{ 's' if story.num_comments != 1 }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if not show_comments and story.text %}
|
|
||||||
<div class="story-text">{{ story.text | safe }}</div>
|
|
||||||
{% elif show_comments %}
|
|
||||||
{% macro render_comment(comment, level) %}
|
|
||||||
<dt></dt>
|
|
||||||
<dd class="comment{% if level > 0 %} lined{% endif %}">
|
|
||||||
<div class="info">
|
|
||||||
<p>
|
|
||||||
{% if comment.author == story.author %}[OP] {% endif %}{{ comment.author or '[Deleted]' }} | <a href="#{{ comment.author }}{{ comment.date }}" id="{{ comment.author }}{{ comment.date }}">{{ comment.date | fromnow }}</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="text">{{ (comment.text | safe) if comment.text else '<p>[Empty / deleted comment]</p>' }}</div>
|
|
||||||
{% if comment.comments %}
|
|
||||||
<dl>
|
|
||||||
{% for reply in comment.comments %}
|
|
||||||
{{ render_comment(reply, level + 1) }}
|
|
||||||
{% endfor %}
|
|
||||||
</dl>
|
|
||||||
{% endif %}
|
|
||||||
</dd>
|
|
||||||
{% endmacro %}
|
|
||||||
<dl class="comments">
|
|
||||||
{% for comment in story.comments %}{{ render_comment(comment, 0) }}{% endfor %}
|
|
||||||
</dl>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class='dot toggleDot'>
|
|
||||||
<div class='button'>
|
|
||||||
<a href="/{{ story.id }}{{ '/c' if not show_comments else '' }}">
|
|
||||||
{{ '' if not show_comments else '' }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% elif stories %}
|
{% if story %}
|
||||||
<div class="container">
|
<div class="{% if show_comments %}container{% else %}article-container{% endif %}">
|
||||||
{% for story in stories %}
|
<div class="article">
|
||||||
<div class='item'>
|
<h1>{{ story.title }}</h1>
|
||||||
<div class='title'>
|
|
||||||
<a class='link' href='/{{ story.id }}'>
|
{% if show_comments %}
|
||||||
<img class='source-logo' src='/logos/{{ story.source }}.png' alt='{{ story.source }}:' /> {{ story.title }}
|
<div class="info">
|
||||||
</a>
|
<a href="/{{ story.id }}">View article</a>
|
||||||
<span class='source'>
|
</div>
|
||||||
(<a class='source' href='{{ story.url or story.link }}'>{{ story.hostname }}</a>)
|
{% else %}
|
||||||
</span>
|
<div class="info">
|
||||||
</div>
|
Source: <a class="source" href="{{ story.url or story.link }}">{{ url }}</a>
|
||||||
<div class='info'>
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="info">
|
||||||
{{ story.score }} points
|
{{ story.score }} points
|
||||||
by <a href="{{ story.author_link }}">{{ story.author }}</a>
|
by <a href="{{ story.author_link }}">{{ story.author }}</a>
|
||||||
{{ story.date | fromnow }}
|
{{ story.date | fromnow }}
|
||||||
on <a href="{{ story.link }}">{{ story.source }}</a> |
|
on <a href="{{ story.link }}">{{ story.source }}</a> |
|
||||||
<a class="{{ 'hot' if story.num_comments > 99 else '' }}" href="/{{ story.id }}/c">
|
<a href="/{{ story.id }}/c">
|
||||||
{{ story.num_comments }} comment{{ 's' if story.num_comments != 1 }}
|
{{ story.num_comments }} comment{{ 's' if story.num_comments != 1 }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if not show_comments and story.text %}
|
||||||
|
<div class="story-text">{{ story.text | safe }}</div>
|
||||||
|
{% elif show_comments %}
|
||||||
|
{% macro render_comment(comment, level) %}
|
||||||
|
<dt></dt>
|
||||||
|
<dd class="comment{% if level > 0 %} lined{% endif %}">
|
||||||
|
<div class="info">
|
||||||
|
<p>
|
||||||
|
{% if comment.author == story.author %}[OP] {% endif %}{{ comment.author or '[Deleted]' }} | <a href="#{{ comment.author }}{{ comment.date }}" id="{{ comment.author }}{{ comment.date }}">{{ comment.date | fromnow }}</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="text">{{ (comment.text | safe) if comment.text else '<p>[Empty / deleted comment]</p>' }}</div>
|
||||||
|
{% if comment.comments %}
|
||||||
|
<dl>
|
||||||
|
{% for reply in comment.comments %}
|
||||||
|
{{ render_comment(reply, level + 1) }}
|
||||||
|
{% endfor %}
|
||||||
|
</dl>
|
||||||
|
{% endif %}
|
||||||
|
</dd>
|
||||||
|
{% endmacro %}
|
||||||
|
<dl class="comments">
|
||||||
|
{% for comment in story.comments %}{{ render_comment(comment, 0) }}{% endfor %}
|
||||||
|
</dl>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
<div class='dot toggleDot'>
|
||||||
</div>
|
<div class='button'>
|
||||||
{% endif %}
|
<a href="/{{ story.id }}{{ '/c' if not show_comments else '' }}">
|
||||||
|
{{ '' if not show_comments else '' }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% elif stories %}
|
||||||
|
<div class="container">
|
||||||
|
{% for story in stories %}
|
||||||
|
<div class='item'>
|
||||||
|
<div class='title'>
|
||||||
|
<a class='link' href='/{{ story.id }}'>
|
||||||
|
<img class='source-logo' src='/logos/{{ story.source }}.png' alt='{{ story.source }}:' /> {{ story.title }}
|
||||||
|
</a>
|
||||||
|
<span class='source'>
|
||||||
|
(<a class='source' href='{{ story.url or story.link }}'>{{ story.hostname }}</a>)
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class='info'>
|
||||||
|
{{ story.score }} points
|
||||||
|
by <a href="{{ story.author_link }}">{{ story.author }}</a>
|
||||||
|
{{ story.date | fromnow }}
|
||||||
|
on <a href="{{ story.link }}">{{ story.source }}</a> |
|
||||||
|
<a class="{{ 'hot' if story.num_comments > 99 else '' }}" href="/{{ story.id }}/c">
|
||||||
|
{{ story.num_comments }} comment{{ 's' if story.num_comments != 1 }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--
|
<!--
|
||||||
This HTML file is a template.
|
This HTML file is a template.
|
||||||
|
|||||||
Reference in New Issue
Block a user