| {% extends "nodes/view_base.html" %}

| {% block node_preview %}
| {% if node.picture %}
iframe(
id='vrview_window'
width='100%',
height='450px',
scrolling='no',
frameborder='0',
allowfullscreen='',
src="{{url_for('main.vrview', preview=node.picture.thumbnail('l', api=api), image=node.picture.thumbnail('h', api=api), default_yaw=(node.properties.default_yaw or 0))}}")
| {% else %}
section.node-preview
	h3 Missing Preview
| {% endif %}
| {% endblock node_preview %}

| {% block node_details_meta_extra %}
| {% if write_access %}
li.node-details-meta-list-item
	a.btn#copy_yaw(
		href='javascript:void(0);'
		title='Copies current yaw of panorama to the clipboard, so you can set it as default yaw.'
		) Copy yaw
| {% endif %}
| {% endblock node_details_meta_extra %}

| {% block node_download %}
| {% if node.properties.files %}
button.btn.btn-outline-secondary.dropdown-toggle(
	title="Download HDRI",
	type="button",
	data-toggle="dropdown",
	aria-haspopup="true",
	aria-expanded="false")
	i.pi-download
	| Download
	i.pi-angle-down.icon-dropdown-menu

ul.dropdown-menu
	| {% for var in node.properties.files %}
	li
		a(href="{{ var.file.link }}",
		title="Download this HDRi format",
		download)
			span.length {{ var.file.length | filesizeformat }}
			span.format {{ var.file.format | hide_none }}
			span.size {{ var.resolution }}

	| {% endfor %}
| {% endif %}
| {% endblock node_download %}

| {% block node_comments %}{% endblock %}

| {% block node_scripts %}
script(src="{{ url_for('static_pillar', filename='assets/js/vendor/clipboard.min.js')}}")
script.
	$().ready(function () {
		new Clipboard('#copy_yaw', {
			text: function(trigger) {
				var frame = document.getElementById('vrview_window').contentWindow;
				var yaw = frame.yaw();
				if (console)
					console.log('Current yaw is: ', yaw, ", which was copied to your clipboard.");
				return yaw;
			}
		})
		.on('success', function(e) {
			$(e.trigger).flashOnce();
		});
	});
| {% endblock node_scripts %}
