42 lines
1.3 KiB
HTML
42 lines
1.3 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block content %}
|
|
<iframe id="pdf" name="pdf" src="{{ url }}" data-base-src="{{ pagedjs_base }}"></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);
|
|
|
|
const nav = document.getElementById('buttons');
|
|
|
|
// Insert the SAVE button without replacing existing nodes.
|
|
const saveLink = document.createElement('a');
|
|
saveLink.href = '#';
|
|
const saveButton = document.createElement('button');
|
|
saveButton.id = 'save';
|
|
saveButton.textContent = 'save';
|
|
saveButton.style.backgroundColor = '#66ee66';
|
|
saveButton.addEventListener('click', function (event) {
|
|
event.preventDefault();
|
|
printPage();
|
|
});
|
|
saveLink.appendChild(saveButton);
|
|
nav.appendChild(saveLink);
|
|
|
|
})
|
|
</script>
|
|
{% endblock %}
|