finalizes things to be moved onto the server

This commit is contained in:
Effie 2023-07-13 15:08:50 +10:00
parent fd57f5813d
commit 26724e3475
17 changed files with 64 additions and 42 deletions

8
app.py
View File

@ -205,7 +205,7 @@ def motifindex():
group by group by
id, name, category id, name, category
order by order by
clip.song_id min(clip.song_id)
''').fetchall() ''').fetchall()
return flask.render_template('motifindex.html', return flask.render_template('motifindex.html',
@ -411,16 +411,12 @@ def songpage(id):
@app.route('/suggest') @app.route('/suggest')
def suggestpage(): def suggestpage():
return flask.render_template('suggest.html', return flask.render_template('suggest.html',
) )
@app.route('/sent', methods=['POST']) @app.route('/sent', methods=['POST'])
def sentpage(): def sentpage():
print(flask.request.headers)
with open ('suggestions.csv', 'a', newline='') as suggestlog: with open ('suggestions.csv', 'a', newline='') as suggestlog:
logwriter = csv.writer(suggestlog) logwriter = csv.writer(suggestlog)
logwriter.writerow([ logwriter.writerow([
@ -432,4 +428,4 @@ def sentpage():
flask.request.form['suggest-description'][:10_000], flask.request.form['suggest-description'][:10_000],
]) ])
return flask.render_template('sent.html', return flask.render_template('sent.html',
) )

View File

@ -1,12 +0,0 @@
eorzea-songbook.com/
index.html
/song
/id
/motif
/id
/album
/id

Binary file not shown.

Binary file not shown.

1
static/htmx.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -85,11 +85,10 @@ function searchIconChange(event, buttonid, barid) {
} }
} }
function clearSearch(searchid, resultid, clickevent) { function clearSearch(searchid, resultid) {
const searchbar = document.getElementById(searchid); const searchbar = document.getElementById(searchid);
const searchresults = document.getElementById(resultid); const searchresults = document.getElementById(resultid);
searchbar.value = ''; searchbar.value = '';
searchresults.replaceChildren(); searchresults.replaceChildren();
searchbar.dispatchEvent(new Event('input')); searchbar.dispatchEvent(new Event('input'));
clickevent.preventDefault();
} }

View File

@ -31,6 +31,43 @@
} }
} }
/* shippori-mincho-regular - japanese_latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Shippori Mincho';
font-style: normal;
font-weight: 400;
src: url('../static/fonts/shippori-mincho-v14-japanese_latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* shippori-mincho-700 - japanese_latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Shippori Mincho';
font-style: normal;
font-weight: 700;
src: url('../static/fonts/shippori-mincho-v14-japanese_latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* zen-maru-gothic-regular - japanese_latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Zen Maru Gothic';
font-style: normal;
font-weight: 400;
src: url('../static/fonts/zen-maru-gothic-v14-japanese_latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* zen-maru-gothic-700 - japanese_latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Zen Maru Gothic';
font-style: normal;
font-weight: 700;
src: url('../static/fonts/zen-maru-gothic-v14-japanese_latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
h1, h2, h3, h4, h5, h6{ h1, h2, h3, h4, h5, h6{
font-family: "Shippori Mincho", serif; font-family: "Shippori Mincho", serif;
margin: 0; margin: 0;
@ -211,7 +248,6 @@ header{
margin-left: auto; margin-right: auto; margin-left: auto; margin-right: auto;
background-color: var(--block); background-color: var(--block);
padding-top: .6rem; padding-bottom: .6rem; padding-top: .6rem; padding-bottom: .6rem;
/* border-style: solid; border-top: 0; border-left: 0; border-right: 0; border-color: var(--thin-border); border-width: 1px; */
} }
.search-items{ .search-items{
@ -240,9 +276,12 @@ header{
padding: 0; padding: 0;
} }
.search-icon{ .search-clear{
height: 100%; all:unset;
content: "🔎︎"; width: 1.2rem;
margin-left: .6rem;
text-align: center;
cursor: pointer;
} }
.search-clear.hidden{ .search-clear.hidden{

View File

@ -5,12 +5,22 @@
<title>{% block title required %}{% endblock %} - Eorzea Songbook</title> <title>{% block title required %}{% endblock %} - Eorzea Songbook</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=1" /> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=1" />
<meta name="description" content="An unofficial library of the motifs in Final Fantasy XIV's soundtrack." /> <meta name="description" content="An unofficial library of the motifs in Final Fantasy XIV's soundtrack." />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Shippori+Mincho|Shippori+Mincho:bold|Zen+Maru+Gothic|Zen+Maru+Gothic:bold" />
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" /> <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
{%block sheet %}{% endblock %} {%block sheet %}{% endblock %}
<link rel="icon" type="image/png" href="{{ url_for('static', filename='songbook.png') }}" /> <link rel="icon" type="image/png" href="{{ url_for('static', filename='songbook.png') }}" />
<script src="https://unpkg.com/htmx.org@1.9.2" integrity="sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h" crossorigin="anonymous"></script> <script src="{{ url_for('static', filename='htmx.min.js') }}"></script>
<script src="{{ url_for('static', filename='script.js') }}"></script> <script src="{{ url_for('static', filename='script.js') }}"></script>
<script type="text/javascript">
window.addEventListener('keydown',function(e) {
if (e.keyIdentifier=='U+000A' || e.keyIdentifier=='Enter' || e.keyCode==13) {
if (e.target.nodeName=='INPUT' && e.target.type=='text') {
e.preventDefault();
return false;
}
}
}, true);
</script>
</head> </head>
<body> <body>
@ -19,7 +29,6 @@
{% block main %}<main>{% endblock %} {% block main %}<main>{% endblock %}
{% block content required %}{% endblock %} {% block content required %}{% endblock %}
{% block main2 %}</main>{% endblock %} {% block main2 %}</main>{% endblock %}
{% block footer %}{% include 'footer.html' %}{% endblock %} {% block footer %}{% include 'footer.html' %}{% endblock %}
</body> </body>

View File

@ -1,11 +0,0 @@
<!-- {% macro icon(type) -%}
<img src="{{ url_for('static', filename='{0}icon.png'.format(type)) }}" alt='{{ type}} icon' class='connection-icon'>
{%- endmacro %}
{% macro link(type) -%}
{{ url_for('{0}page'.format(type), id=) }}"> {{ motif }}
{%- endmacro %}
-->
<!-- {{ icon(type) }}
{{ link(type) }} -->

View File

@ -24,7 +24,7 @@
<div id="top-search" class="search-bar search-empty"> <div id="top-search" class="search-bar search-empty">
<!-- <span class="search-icon"></span> --> <!-- <span class="search-icon"></span> -->
<button id="search-button" class="search-clear hidden" onclick="clearSearch('search-input', 'search-results-header', event)">X</button> <button id="search-button" class="search-clear hidden" onclick="clearSearch('search-input', 'search-results-header', event)">🗙</button>
<div class="search-items"> <div class="search-items">
<input <input
id="search-input" id="search-input"

Binary file not shown.

View File

@ -4,7 +4,7 @@
{% block content %} {% block content %}
<p>Thanks for your suggestion! It may take a while for me to check it out and update the website, so please be patient.</p>
{% endblock %} {% endblock %}

View File

@ -4,7 +4,7 @@
{% block content %} {% block content %}
<p>If you know about songs in the Final Fantasy XIV soundtrack that share a connection, and you can't find it on the website, tell me about it here. Just pick the two songs that share a motif - or the motif itself, if it already has a page - and tell me what to listen out for.</p> <p>If you know about songs in the Final Fantasy XIV soundtrack that share a connection, and you can't find it on the website, tell me about it here. Just pick the two songs that share a motif - or the motif itself, if it already has a page - and tell me what to listen out for. Timestamps are especially helpful!</p>
<form action="/sent" method="post" > <form action="/sent" method="post" >
<div class="suggestbox"> <div class="suggestbox">
@ -17,8 +17,8 @@
<div>Nothing selected yet.</div> <div>Nothing selected yet.</div>
</div> </div>
<div id="suggest-bar-{{ i }}" class="search-bar search-empty"> <div id="suggest-bar-{{ i }}" class="search-bar search-empty">
<button type="button" id="suggest-button-{{ i }}" class="search-clear hidden" onclick="clearSearch('search-input-suggest-{{ i }}', 'search-results-{{ i }}')">🗙</button>
<div class="search-items"> <div class="search-items">
<button id="suggest-button-{{ i }}" class="search-clear hidden" onclick="clearSearch('search-input-suggest-{{ i }}', 'search-results-{{ i }}', event)">X</button>
<input <input
id="search-input-suggest-{{ i }}" id="search-input-suggest-{{ i }}"
type="text" type="text"
@ -29,6 +29,7 @@
hx-trigger="keyup changed delay:250ms, search" hx-trigger="keyup changed delay:250ms, search"
hx-target="#search-results-{{ i }}" hx-target="#search-results-{{ i }}"
oninput="searchIconChange(event, 'suggest-button-{{ i }}', 'suggest-bar-{{ i }}')" oninput="searchIconChange(event, 'suggest-button-{{ i }}', 'suggest-bar-{{ i }}')"
keydown="return event.keyCode != 13;"
/> />
<div id="search-results-{{ i }}" class="search-results" data-form="{{ i }}"></div> <div id="search-results-{{ i }}" class="search-results" data-form="{{ i }}"></div>
</div> </div>