-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
48 lines (41 loc) · 1.2 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* @file This is a tag plugin for the Hexo static site generator.
* @copyright Doug Bromley 2015-2016
* @author Doug Bromley
* @license MIT
*/
hexo.extend.tag.register('deezer', function(args) {
var url = 'https://www.deezer.com/plugins/player';
var trackId = args[0];
var format = args[1] || 'classic';
var size = args[2] || 'medium';
var autoplay = args[3] || 'false';
var playlist = args[4] || 'false';
var width = '700';
var height = '120';
if (format === 'square') {
width = '300';
height = '300';
}
var config = hexo.config.deezer || {};
config.theme = config.theme || 'dark';
config.colour = config.colour || '1990DB';
var iframeTag = '<iframe src="' + url +
'?format=' + format +
'&autoplay=' + autoplay +
'&playlist=' + playlist +
'&width=' + width +
'&height=' + height +
'&color=' + config.colour +
'&layout=' + config.theme +
'&size=' + size +
'&type=tracks' +
'&id=' + trackId +
'&title=&app_id=161645"' +
' scrolling="no"' +
' frameborder="0"' +
' allowTransparency="true"' +
' width="' + width + '" height="' + height + '">' +
'</iframe>';
return iframeTag;
});