diff options
author | luxagraf <sng@luxagraf> | 2021-01-30 15:30:11 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf> | 2021-01-30 15:30:11 -0500 |
commit | 75a321c33af42b329166e56cc6cf497f4c17949e (patch) | |
tree | 5d6a4205bcd52326ea862baa3ca8d00bc2198fb7 /design/templates/admin | |
parent | f468ddca717e3edbaa1a7780a1eced112a65d3b3 (diff) |
admin: fixed a js bug. god i hate js.
Diffstat (limited to 'design/templates/admin')
-rw-r--r-- | design/templates/admin/insert_images.html | 80 |
1 files changed, 38 insertions, 42 deletions
diff --git a/design/templates/admin/insert_images.html b/design/templates/admin/insert_images.html index 84e5a39..8a6596d 100644 --- a/design/templates/admin/insert_images.html +++ b/design/templates/admin/insert_images.html @@ -29,46 +29,6 @@ figure { color: #666; } </style> -<script> -function buildVideo(video_mp4, video_webm, id, c, poster, ytlink) { - console.log(poster); - html = '<div class="self-embed-container">\n\t<video poster="'+poster+'" controls="true" loop="false" preload="auto" id="'+id+'" class="vidauto'; - if (c) { - html += c+'"'; - } else { - html += '"'; - } - html += '>\n\t\t<source src="'+video_webm+'" type="video/webm">\n'; - html += '\t\t<source src="'+video_mp4+'" type="video/mp4">\n'; - html += '\t\tYour browser does not support video playback via HTML5.\n\t</video>\n'; - html += '\t<a href="+'ytlink+'">Watch on YouTube</a>\n</div>'; - return html; -} -function buildImage(image_url, id, c, caption) { - html = '<img src="'+image_url+'" id="image-'+id+'" class="'; - if (c) { - html += c; - } - if (caption) { - html += ' caption" />'; - } - else { - html += '" />'; - } - return html; -} -function buildAudio(audio_mp3, audio_ogg) { - html = '<audio controls="" preload="auto">\n\t<source src="'+audio_mp3+'">\n\t' - html += '<source src="'+audio_ogg+'">\n\t' - html += 'Sorry, your browser does not support audio in HTML\n</audio>' - return html; -} -function openInNewTab(url) { - var win = window.open(url, '_blank'); - win.focus(); - return false; -} -</script> </head> <body> <input type="button" value="Refresh" onClick="window.location.reload()"> @@ -89,7 +49,7 @@ function openInNewTab(url) { <li><a data-src="{{tn}}" data-id="{{object.id}}" data-class="cluster pic66" onclick="insertImage(this);return false;" href="#">cluster</a></li> <li><a data-src="{{tn}}" data-id="{{object.id}}" data-class="picfull" onclick="insertImage(this);return false;" href="#">column width</a></li> <li><a data-src="{{tn}}" data-id="{{object.id}}" data-class="picfull" data-caption="true" onclick="insertImage(this);return false;" href="#">column width cap</a></li> - <li><a onclick='openInNewTab("/admin/photos/luximage/{{object.pk}}/change/");' href="#">Edit Image</a></li>{%endif%} + <li><a onclick='openInNewTab("/admin/medij/luximage/{{object.pk}}/change/");' href="#">Edit Image</a></li>{%endif%} </ul> {% else %} <figure class="item" > @@ -107,9 +67,45 @@ function openInNewTab(url) { <!-- "next page" action --> <a class="nextPage browse right"></a> <script> +function buildVideo(video_mp4, video_webm, id, c, poster, ytlink) { + html = '<div class="self-embed-container">\n\t<video poster="'+poster+'" controls="true" loop="false" preload="auto" id="'+id+'" class="vidauto'; + if (c) { + html += c+'"'; + } else { + html += '"'; + } + html += '>\n\t\t<source src="'+video_webm+'" type="video/webm">\n'; + html += '\t\t<source src="'+video_mp4+'" type="video/mp4">\n'; + html += '\t\tYour browser does not support video playback via HTML5.\n\t</video>\n'; + html += '\t<a href="'+ytlink+'">Watch on YouTube</a>\n</div>'; + return html; +} +function buildImage(image_url, id, c, caption) { + html = '<img src="'+image_url+'" id="image-'+id+'" class="'; + if (c) { + html += c; + } + if (caption) { + html += ' caption" />'; + } + else { + html += '" />'; + } + return html; +} +function buildAudio(audio_mp3, audio_ogg) { + html = '<audio controls="" preload="auto">\n\t<source src="'+audio_mp3+'">\n\t' + html += '<source src="'+audio_ogg+'">\n\t' + html += 'Sorry, your browser does not support audio in HTML\n</audio>' + return html; +} +function openInNewTab(url) { + var win = window.open(url, '_blank'); + win.focus(); + return false; +} function insertImage(item) { if (item.dataset.isVideo) { - console.log(item.dataset.poster); var code = buildVideo(item.dataset.videoMp4, item.dataset.videoWebm, item.dataset.id, item.dataset.class, item.dataset.poster, item.dataset.ytlink); } else if (item.dataset.isAudio) { var code = buildAudio(item.dataset.mp3, item.dataset.ogg); |