-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
22 lines (20 loc) · 680 Bytes
/
index.js
File metadata and controls
22 lines (20 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
* hexo-tag-bilibili
* https://github.com/Z4Tech/hexo-tag-bilibili.git
* Copyright (c) 2015, Z4Tech
* Licensed under the MIT license.
* Syntax:
* {% bilibili [av_id] %} or {% bilibili [av_id] [page] %}
*/
var bili_convert = require('bilibili-embed-convert');
hexo.extend.tag.register('bilibili', function(args){
var av_id = parseInt(args[0]);
var page = parseInt(args[1]) || 1;
var config = hexo.config.bilibili || {};
config.width = config.width || 452;
config.height = config.height || 544;
var bili_video = new bili_convert(av_id, page);
return '<div class="bili_video">'
+ bili_video.embedAddr(config.width, config.height)
+ '</div>';
});