Make use of the video tag for videos in the ML

This commit is contained in:
onli 2019-11-03 21:30:51 +01:00
parent 2b82d111f0
commit 9c03f27e6f
3 changed files with 54 additions and 19 deletions

View File

@ -1,6 +1,9 @@
Version 2.4-alpha1 ()
------------------------------------------------------------------------
* Use the video tag for videos in the Medialibrary, also when
inserting such a video into an entry
* Fix: Items in Medialibrary that are not images now get
the correct link

View File

@ -174,21 +174,40 @@
parent.self.close();
</script>
{else}
<script>
block = '<a class="block_level opens_window" href="{$media.file.full_file}" title="{$media.file.realname|escape}"><!-- s9ymdb:{$media.file.id} -->{$media.file.realname|escape}</a>';
{serendipity_hookPlugin hookAll=true hook='frontend_image_add_unknown' eventData=$media}
if (parent.self.opener == undefined) {
// in iframes, there is no opener, and the magnific popup is wrapped
parent.self = window.parent.parent.$.magnificPopup;
parent.self.opener = window.parent.parent;
}
if (parent.self.opener.editorref) {
parent.self.opener.editorref.surroundHTML(block, '');
} else {
parent.self.opener.serendipity.serendipity_imageSelector_addToBody(block, '{$media.textarea}');
}
parent.self.close();
</script>
{if $media.file.mediatype == 'video'}
<script>
block = '<video src="{$media.file.full_file}" controls><!-- s9ymdb:{$media.file.id} --><a class="block_level opens_window" href="{$media.file.full_file}" title="{$media.file.realname|escape}">{$media.file.realname|escape}</a></video>';
{serendipity_hookPlugin hookAll=true hook='frontend_image_add_unknown' eventData=$media}
if (parent.self.opener == undefined) {
// in iframes, there is no opener, and the magnific popup is wrapped
parent.self = window.parent.parent.$.magnificPopup;
parent.self.opener = window.parent.parent;
}
if (parent.self.opener.editorref) {
parent.self.opener.editorref.surroundHTML(block, '');
} else {
parent.self.opener.serendipity.serendipity_imageSelector_addToBody(block, '{$media.textarea}');
}
parent.self.close();
</script>
{else}
<script>
block = '<a class="block_level opens_window" href="{$media.file.full_file}" title="{$media.file.realname|escape}"><!-- s9ymdb:{$media.file.id} -->{$media.file.realname|escape}</a>';
{serendipity_hookPlugin hookAll=true hook='frontend_image_add_unknown' eventData=$media}
if (parent.self.opener == undefined) {
// in iframes, there is no opener, and the magnific popup is wrapped
parent.self = window.parent.parent.$.magnificPopup;
parent.self.opener = window.parent.parent;
}
if (parent.self.opener.editorref) {
parent.self.opener.editorref.surroundHTML(block, '');
} else {
parent.self.opener.serendipity.serendipity_imageSelector_addToBody(block, '{$media.textarea}');
}
parent.self.close();
</script>
{/if}
{/if}
{/if}{* if $media.file.is_image is something else end *}
</div>

View File

@ -56,7 +56,6 @@
{/if}
{/if}
<article id="media_{$file.id}" class="media_file {if $media.manage AND $media.multiperm}manage {/if}{cycle values="odd,even"}">
<header class="clearfix">
{if $media.manage AND $media.multiperm}
@ -81,9 +80,23 @@
<div class="clearfix equal_heights media_file_wrap">
<div class="media_file_preview">
<a {if $media.manage AND $media.multiperm}class="media_fullsize"{/if} href="{$link}" title="{$CONST.MEDIA_FULLSIZE}: {$file.realname}" data-pwidth="{$file.popupWidth}" data-pheight="{$file.popupHeight}">
<img src="{$img_src}" title="{$img_title}" alt="{$img_alt}">
</a>
{if $file.mediatype == 'video'}
<video src="{$file.imgsrc}" controls>
<img src="{$img_src}" title="{$img_title}" alt="{$img_alt}">
</video>
<br />
{if NOT $media.manage}
{* we need a link to go to the next step when inserting into an entry *}
<a {if $media.manage AND $media.multiperm}class="media_fullsize"{/if} href="{$link}" title="{$CONST.MEDIA_FULLSIZE}: {$file.realname}" data-pwidth="{$file.popupWidth}" data-pheight="{$file.popupHeight}">
{$CONST.VIDEO}
</a>
{/if}
{else}
<a {if $media.manage AND $media.multiperm}class="media_fullsize"{/if} href="{$link}" title="{$CONST.MEDIA_FULLSIZE}: {$file.realname}" data-pwidth="{$file.popupWidth}" data-pheight="{$file.popupHeight}">
{* even files that are not images get aplaceholder image from the backend *}
<img src="{$img_src}" title="{$img_title}" alt="{$img_alt}">
</a>
{/if}
<footer id="media_file_meta_{$file.id}" class="media_file_meta additional_info">
<ul class="plainList">
{if $file.hotlink}