mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-20 19:02:33 +00:00
Optimize video tag
This commit is contained in:
parent
6a642159b8
commit
afb052c39c
@ -5,5 +5,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = function(args) {
|
module.exports = function(args) {
|
||||||
return `<video src="${args}" preload="metadata" controls playsinline poster="">Sorry, your browser does not support the video tag.</video>`;
|
return `<video src="${args[0]}" preload="metadata" controlslist="nodownload" controls playsinline poster="${args[1] || ''}"></video>`;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,6 +6,10 @@ describe('video', () => {
|
|||||||
const postVideo = require('../../scripts/tags/video');
|
const postVideo = require('../../scripts/tags/video');
|
||||||
|
|
||||||
it('default', () => {
|
it('default', () => {
|
||||||
postVideo(['https://example.com/sample.mp4']).should.eql('<video src="https://example.com/sample.mp4" preload="metadata" controls playsinline poster="">Sorry, your browser does not support the video tag.</video>');
|
postVideo(['https://example.com/sample.mp4']).should.eql('<video src="https://example.com/sample.mp4" preload="metadata" controlslist="nodownload" controls playsinline poster=""></video>');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('poster', () => {
|
||||||
|
postVideo(['https://example.com/sample.mp4', 'https://example.com/sample.jpg']).should.eql('<video src="https://example.com/sample.mp4" preload="metadata" controlslist="nodownload" controls playsinline poster="https://example.com/sample.jpg"></video>');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user