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 {
|
.navbar-custom {
|
||||||
background-color: #ff5500;
|
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="/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="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="/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" />':''); ?>
|
<?php print(($_SESSION['md_admin'] == true)?'<link rel="stylesheet" href="/css/codemirror.min.css" />':''); ?>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<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/jquery.min.js"></script>
|
||||||
<script type="text/javascript" src="/js/popper.min.js"></script>
|
<script type="text/javascript" src="/js/popper.min.js"></script>
|
||||||
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
|
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
|
||||||
|
|
|
@ -115,34 +115,52 @@ class ParsedownExtraplus extends ParsedownExtra
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$Inline = array(
|
if ($Link['element']['text']!="video")
|
||||||
'extent' => $Link['extent'] + 1,
|
{
|
||||||
'element' => array(
|
$Inline = array(
|
||||||
'name' => 'img',
|
'extent' => $Link['extent'] + 1,
|
||||||
'attributes' => array(
|
'element' => array(
|
||||||
'src' => $Link['element']['attributes']['href'],
|
'name' => 'img',
|
||||||
'alt' => $Link['element']['text'],
|
'attributes' => array(
|
||||||
),
|
'src' => $Link['element']['attributes']['href'],
|
||||||
),
|
'alt' => $Link['element']['text'],
|
||||||
);
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
$modifier = explode('?', $Inline['element']['attributes']['src'], 2)[1] ?? "";
|
$modifier = explode('?', $Inline['element']['attributes']['src'], 2)[1] ?? "";
|
||||||
list($size,$align) = explode('-', $modifier, 2);
|
list($size,$align) = explode('-', $modifier, 2);
|
||||||
$width = $height = 0;
|
$width = $height = 0;
|
||||||
if (preg_match('/^\d+x\d+$/', $size)) {
|
if (preg_match('/^\d+x\d+$/', $size)) {
|
||||||
list($width, $height) = explode('x', $size);
|
list($width, $height) = explode('x', $size);
|
||||||
}
|
}
|
||||||
if (preg_match('/^\d+$/', $size)) {
|
if (preg_match('/^\d+$/', $size)) {
|
||||||
$width = $size;
|
$width = $size;
|
||||||
}
|
}
|
||||||
if($width > 0) $Inline['element']['attributes']['width'] = $width;
|
if($width > 0) $Inline['element']['attributes']['width'] = $width;
|
||||||
if($height > 0) $Inline['element']['attributes']['height'] = $height;
|
if($height > 0) $Inline['element']['attributes']['height'] = $height;
|
||||||
if($align !="" ) $Inline['element']['attributes']['align'] = $align;
|
if($align !="" ) $Inline['element']['attributes']['align'] = $align;
|
||||||
|
|
||||||
$Inline['element']['attributes'] += $Link['element']['attributes'];
|
$Inline['element']['attributes'] += $Link['element']['attributes'];
|
||||||
|
|
||||||
unset($Inline['element']['attributes']['href']);
|
|
||||||
|
|
||||||
|
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;
|
return $Inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue