octomode/templates/pdf.html
decentral1se 42e408859b
refactor!: unify slash handling
It is hard to remember to add `/` at the end of the URL when configuring
a new etherpad URL. Also, web server proxies tend to do weird stuff when
you assume that you have a slash on the end of each URL.

So, I took a look at how to avoid doing that. It turns out that both
urljoin / os.path.join are kinda bad for handling URL building. Also,
APPLICATION_ROOT didn't seem that necessary since Flask knows what to do
with a `/` at the start of a URL, so I dropped it.

I think this doesn't break anything!
2022-10-02 16:53:25 +02:00

31 lines
875 B
HTML

{% extends "base.html" %}
{% block content %}
<iframe id="pdf" name="pdf" src="{{ url }}"></iframe>
{% endblock %}
{% block footer %}
<script>
function printPage(){
window.frames["pdf"].focus();
window.frames["pdf"].print();
}
window.addEventListener('load', function () {
// Load the main.css again, to load the stylesheet for the nav
var cssLink = document.createElement('link');
cssLink.rel = 'stylesheet';
cssLink.href = '{{ url_for("static", filename="main.css") }}';
var head = document.getElementsByTagName('head')[0];
head.insertBefore(cssLink, head.firstChild);
// Insert the SAVE button
const nav = document.getElementById('buttons');
const save = '<a href="#"><button id="save" onClick="printPage()">save</button></a>';
nav.innerHTML = nav.innerHTML + save;
})
</script>
{% endblock %}