You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
885 B
30 lines
885 B
4 years ago
|
'use strict';
|
||
|
|
||
4 years ago
|
function postAudio(args) {
|
||
|
let src = args[0].trim()
|
||
|
return `<p><audio controls preload><source src='${src}' type='audio/mp3'>Your browser does not support the audio tag.</audio></p>`;
|
||
|
}
|
||
|
|
||
4 years ago
|
function postVideo(args) {
|
||
|
let src = args[0].trim()
|
||
4 years ago
|
return `<p><video controls preload><source src='${src}' type='video/mp4'>Your browser does not support the video tag.</video></p>`;
|
||
4 years ago
|
}
|
||
|
|
||
|
function postVideos(args, content) {
|
||
|
args = args.join(' ').split(',')
|
||
|
var cls = args[0]
|
||
|
if (cls.length > 0) {
|
||
|
cls = ' ' + cls
|
||
|
}
|
||
|
var col = Number(args[1]) || 0;
|
||
|
if (col > 0) {
|
||
|
return `<div class="videos${cls}" col='${col}'>${content}</div>`
|
||
|
} else {
|
||
|
return `<div class="videos${cls}">${content}</div>`
|
||
|
}
|
||
4 years ago
|
}
|
||
|
|
||
4 years ago
|
hexo.extend.tag.register('audio', postAudio);
|
||
4 years ago
|
hexo.extend.tag.register('video', postVideo);
|
||
4 years ago
|
hexo.extend.tag.register('videos', postVideos, {ends: true});
|