tag:去掉了OSS中的版本参数。
This commit is contained in:
parent
8e6d988376
commit
2a6fa60587
|
@ -1,33 +1,32 @@
|
||||||
hexo.extend.tag.register('oss_image', function(args) {
|
hexo.extend.tag.register('oss_image', function(args) {
|
||||||
let { config } = hexo;
|
let { config } = hexo;
|
||||||
|
|
||||||
let requestImage = args[0] || '';
|
let requestImage = args.shift() || '';
|
||||||
let versionCode = args[1] || '';
|
if (requestImage.length === 0) {
|
||||||
if (requestImage.length === 0 || versionCode.length === 0) {
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
let imageSrc = `${config.oss.endpoint}/${requestImage}?versionId=${versionCode}`;
|
let imageSrc = `${config.oss.endpoint}/${requestImage}`;
|
||||||
|
|
||||||
let attrs = [];
|
let attrs = [];
|
||||||
attrs.push(`src="${imageSrc}"`);
|
attrs.push(`src="${imageSrc}"`);
|
||||||
|
|
||||||
let altMessage = args[2] || '';
|
let altMessage = args.shift() || '';
|
||||||
attrs.push(`alt="${altMessage}"`);
|
attrs.push(`alt="${altMessage}"`);
|
||||||
|
|
||||||
let classes = args[5] || '';
|
let width = args.shift() || 0;
|
||||||
if (classes.length !== 0) {
|
|
||||||
attrs.push(`class="${classes}"`);
|
|
||||||
}
|
|
||||||
|
|
||||||
let width = args[3] || 0;
|
|
||||||
if (width !== 0) {
|
if (width !== 0) {
|
||||||
attrs.push(`width="${width}"`);
|
attrs.push(`width="${width}"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let height = args[4] || 0;
|
let height = args.shift() || 0;
|
||||||
if (height !== 0) {
|
if (height !== 0) {
|
||||||
attrs.push(`height="${height}"`);
|
attrs.push(`height="${height}"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let classes = args.shift() || '';
|
||||||
|
if (classes.length !== 0) {
|
||||||
|
attrs.push(`class="${classes}"`);
|
||||||
|
}
|
||||||
|
|
||||||
return `<img ${attrs.join(" ")} />`;
|
return `<img ${attrs.join(" ")} />`;
|
||||||
});
|
});
|
|
@ -1,20 +1,20 @@
|
||||||
hexo.extend.tag.register('oss_video', function(args) {
|
hexo.extend.tag.register('oss_video', function(args) {
|
||||||
let { config } = hexo;
|
let { config } = hexo;
|
||||||
|
|
||||||
let src = args[0] || '';
|
let src = args.shift() || '';
|
||||||
let versionId = args[1] || '';
|
// let versionId = args[1] || '';
|
||||||
if (src.length === 0 || versionId.length === 0) {
|
if (src.length === 0) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
let fullUrl = `${config.oss.endpoint}/${src}?versionId=${versionId}`;
|
let fullUrl = `${config.oss.endpoint}/${src}`;
|
||||||
let affix = src.substring(src.lastIndexOf('.') + 1);
|
let affix = src.substring(src.lastIndexOf('.') + 1);
|
||||||
|
|
||||||
let attrs = []
|
let attrs = []
|
||||||
attrs.push('controls');
|
attrs.push('controls');
|
||||||
attrs.push('muted="true"');
|
attrs.push('muted="true"');
|
||||||
|
|
||||||
let width = args[2] || 0;
|
let width = args.shift() || 0;
|
||||||
let height = args[3] || 0;
|
let height = args.shift() || 0;
|
||||||
if (width !== 0) {
|
if (width !== 0) {
|
||||||
attrs.push(`width="${width}"`);
|
attrs.push(`width="${width}"`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user