log.njk

---
pagination:
  data: changes
  size: 50
  alias: logs
permalink: "log/{{pagination.pageNumber}}.html"
---
<html>
    	{% set page = "log" %}
    	{% include "style.njk" %}
	<body>
    		{% include "tabs.njk" %}
		<h1>Log</h1>
		{% include "log_pages.njk" %}
		{% for log in logs %}
		<div class="log">
			<span>{{log.message}}</span><br />
			<span>{{log.authors | authors}}</span><br />
			<span>{{log.timestamp}}</span><br />
			<a href="/changes/{{log.hash}}.txt" target="_blank"><pre class=hash>{{log.hash}}</pre></a><button class="apply-btn" onclick="copyApplyCommand({{loop.index0}}, '{{log.hash}}')">Copy apply command</button><span class="confirmation" id="confirmation-{{loop.index0}}"></span>
		</div>
		{% endfor %}

		{% include "log_pages.njk" %}
	<script type="text/javascript">
		const copyApplyCommand = (index, hash) => {
			const str = `curl "${window.location.protocol}//${window.location.host}/changes/"${hash}.txt | pijul apply`
			navigator.clipboard.writeText(str).then(() => {
				document.querySelectorAll(".confirmation").forEach((elem) => {
					elem.innerHTML = ""
				})
				document.getElementById(`confirmation-${index}`).innerHTML = "Copied 'pijul apply' command to clipboard."
			})
		}
	</script>
	</body>
</html>