Add video support with special tag
This commit is contained in:
parent
dd717e331c
commit
b0d16ccfe7
|
@ -1,3 +1,9 @@
|
|||
.video-js-style {
|
||||
position: relative !important;
|
||||
width: 100% !important;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.navbar-custom {
|
||||
background-color: #ff5500;
|
||||
}
|
||||
|
|
|
@ -253,9 +253,14 @@ else
|
|||
<link rel="stylesheet" type="text/css" href="/css/emoji.css" />
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/style.css" />
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/vlitejs@4.0.5/dist/plugins/subtitle.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/vlitejs@4.0.5/dist/vlite.min.css" />
|
||||
<?php print(($_SESSION['md_admin'] == true)?'<link rel="stylesheet" href="/css/codemirror.min.css" />':''); ?>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vlitejs@4.0.5/dist/plugins/subtitle.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vlitejs@4.0.5/dist/plugins/pip.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vlitejs@4.0.5/dist/vlite.min.js"></script>
|
||||
<script type="text/javascript" src="/js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="/js/popper.min.js"></script>
|
||||
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
|
||||
|
|
|
@ -115,34 +115,52 @@ class ParsedownExtraplus extends ParsedownExtra
|
|||
return;
|
||||
}
|
||||
|
||||
$Inline = array(
|
||||
'extent' => $Link['extent'] + 1,
|
||||
'element' => array(
|
||||
'name' => 'img',
|
||||
'attributes' => array(
|
||||
'src' => $Link['element']['attributes']['href'],
|
||||
'alt' => $Link['element']['text'],
|
||||
),
|
||||
),
|
||||
);
|
||||
if ($Link['element']['text']!="video")
|
||||
{
|
||||
$Inline = array(
|
||||
'extent' => $Link['extent'] + 1,
|
||||
'element' => array(
|
||||
'name' => 'img',
|
||||
'attributes' => array(
|
||||
'src' => $Link['element']['attributes']['href'],
|
||||
'alt' => $Link['element']['text'],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$modifier = explode('?', $Inline['element']['attributes']['src'], 2)[1] ?? "";
|
||||
list($size,$align) = explode('-', $modifier, 2);
|
||||
$width = $height = 0;
|
||||
if (preg_match('/^\d+x\d+$/', $size)) {
|
||||
list($width, $height) = explode('x', $size);
|
||||
}
|
||||
if (preg_match('/^\d+$/', $size)) {
|
||||
$width = $size;
|
||||
}
|
||||
if($width > 0) $Inline['element']['attributes']['width'] = $width;
|
||||
if($height > 0) $Inline['element']['attributes']['height'] = $height;
|
||||
if($align !="" ) $Inline['element']['attributes']['align'] = $align;
|
||||
$modifier = explode('?', $Inline['element']['attributes']['src'], 2)[1] ?? "";
|
||||
list($size,$align) = explode('-', $modifier, 2);
|
||||
$width = $height = 0;
|
||||
if (preg_match('/^\d+x\d+$/', $size)) {
|
||||
list($width, $height) = explode('x', $size);
|
||||
}
|
||||
if (preg_match('/^\d+$/', $size)) {
|
||||
$width = $size;
|
||||
}
|
||||
if($width > 0) $Inline['element']['attributes']['width'] = $width;
|
||||
if($height > 0) $Inline['element']['attributes']['height'] = $height;
|
||||
if($align !="" ) $Inline['element']['attributes']['align'] = $align;
|
||||
|
||||
$Inline['element']['attributes'] += $Link['element']['attributes'];
|
||||
|
||||
unset($Inline['element']['attributes']['href']);
|
||||
$Inline['element']['attributes'] += $Link['element']['attributes'];
|
||||
|
||||
unset($Inline['element']['attributes']['href']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$Inline = array(
|
||||
'extent' => $Link['extent'] + 1,
|
||||
'element' => array(
|
||||
'name' => 'video',
|
||||
'attributes' => array(
|
||||
'src' => $Link['element']['attributes']['href'],
|
||||
'id' => 'player',
|
||||
'controls' => '',
|
||||
'class' => 'v-vlite video-js-style',
|
||||
'playsinline' => ''
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return $Inline;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue