75 lines
2.2 KiB
HTML
75 lines
2.2 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Flickr mail{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="container">
|
|
<div class="row">
|
|
<h1>Flickr mail</h1>
|
|
<form action="{{ url_for(request.endpoint) }}">
|
|
<div class="mb-3">
|
|
<label for="wikipedia" class="form-label">Wikipedia URL:</label>
|
|
<input type="text" class="form-control" id="wikipedia" name="wikipedia" value="{{ wikipedia_url }}" required>
|
|
</div>
|
|
|
|
<input type="submit" value="Submit">
|
|
</form>
|
|
|
|
{% if name %}
|
|
|
|
<p>Wikipedia article: {{ name }}</p>
|
|
<p><a href="https://flickr.com/search/?view_all=1&safe_search=3&text={{ '"' + name + '"' | urlencode }}" target="_blank">Search flickr</a></p>
|
|
|
|
<form action="{{ url_for(request.endpoint) }}">
|
|
<input type="hidden" name="wikipedia" value="{{ wikipedia_url }}"></input>
|
|
<div class="mb-3">
|
|
<label for="flickr" class="form-label">Flickr URL:</label>
|
|
<input type="text" class="form-control" id="flickr" name="flickr" value="{{ flickr_url }}" required>
|
|
</div>
|
|
|
|
<input type="submit" value="Submit">
|
|
</form>
|
|
|
|
{% endif %}
|
|
|
|
{% if flickr_url %}
|
|
<p><a href="https://www.flickr.com/mail/write/?to={{nsid}}">send message</a>
|
|
<div><strong>Subject:</strong> {{ subject }} <button class="btn btn-primary" id="copy-subject">copy</button>
|
|
<div>
|
|
<h3>message
|
|
<button class="btn btn-primary" id="copy-message">copy</button>
|
|
</h3>
|
|
{% for p in lines %}
|
|
<p>{{ p }}</p>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
|
|
{% endif %}
|
|
|
|
<div class="mt-3">Written by <a href="/">Edward Betts</a>. Source code and bug reports: <a href="https://git.4angle.com/edward/flickr-mail">https://git.4angle.com/edward/flickr-mail</div>
|
|
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
{% if subject and lines %}
|
|
<script>
|
|
var copy_subject = document.getElementById("copy-subject");
|
|
var copy_message = document.getElementById("copy-message");
|
|
var subject = {{ subject | tojson }};
|
|
var message = {{ "\n\n".join(lines) | tojson }};
|
|
|
|
copy_subject.addEventListener("click", function(e) {
|
|
navigator.clipboard.writeText(subject);
|
|
});
|
|
|
|
copy_message.addEventListener("click", function(e) {
|
|
navigator.clipboard.writeText(message);
|
|
});
|
|
|
|
</script>
|
|
{% endif %}
|
|
{% endblock %}
|