hexo-tag-dailymotion
Advanced tools
Comparing version 1.0.0 to 1.1.0
27
index.js
'use strict'; | ||
const { htmlTag } = require('hexo-util'); | ||
const dailymotionTag = require('./lib/dailymotion.js') | ||
/** | ||
* Dailymotion tag | ||
* | ||
* Syntax: | ||
* {% dailymotion [player:player_id] [video:video_id] [playlist:playlist_id] %} | ||
*/ | ||
hexo.extend.tag.register('dailymotion', function (args) { | ||
const arg = args.join(' '); | ||
const [, player=null] = arg.match(/\s*player:(\w+)/i) || []; | ||
const [, video=null] = arg.match(/\s*video:(\w+)/i) || []; | ||
const [, playlist=null] = arg.match(/\s*playlist:(\w+)/i) || []; | ||
const playerPath = player ? `player/${player}.js` : `player.js`; | ||
return htmlTag('script', { | ||
src: `https://geo.dailymotion.com/${playerPath}`, | ||
class: 'video-container', | ||
...(video ? {'data-video': video} : null), | ||
...(playlist ? {'data-playlist': playlist} : null), | ||
}, '', false); | ||
}); | ||
hexo.extend.tag.register('dailymotion', dailymotionTag); |
{ | ||
"name": "hexo-tag-dailymotion", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "A tag plugin to embed Dailymotion video player in your Hexo blog", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "node ./test/dailymotion.test.js" | ||
}, | ||
@@ -27,3 +27,8 @@ "keywords": [ | ||
}, | ||
"homepage": "https://github.com/dharFr/hexo-tag-dailymotion#readme" | ||
"homepage": "https://github.com/dharFr/hexo-tag-dailymotion#readme", | ||
"devDependencies": { | ||
"cli-color": "^2.0.3", | ||
"hexo-util": "^3.0.1", | ||
"node-html-parser": "^6.1.4" | ||
} | ||
} |
# hexo-tag-dailymotion | ||
A tag plugin to embed Dailymotion video player in your Hexo blog | ||
  | ||
[](https://www.npmjs.com/package/hexo-tag-dailymotion) [](https://github.com/dharFr/hexo-tag-dailymotion/blob/main/LICENSE) | ||
@@ -53,3 +53,3 @@ | ||
#### Embed a video and aplaylist | ||
#### Embed a video and a playlist | ||
@@ -75,1 +75,22 @@ ``` | ||
``` | ||
#### Embed a player with parameters | ||
``` | ||
{% dailymotion player:xakn video:x84sh87 params:startTime=15 %} | ||
``` | ||
will inject the following into hexo rendered page or post | ||
``` html | ||
<script src="https://geo.dailymotion.com/player/xakn.js" data-video="x84sh87" data-params="startTime=15"></script> | ||
``` | ||
--- | ||
``` | ||
{% dailymotion player:xakn video:x84sh87 params:startTime=15&mute=true&loop=true %} | ||
``` | ||
will inject the following into hexo rendered page or post | ||
``` html | ||
<script src="https://geo.dailymotion.com/player/xakn.js" data-video="x84sh87" data-params="startTime=15&mute=true&loop=true"></script> | ||
``` |
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
16618
9
167
0
95
3