easy add danmu to your html, include frontend and backend
一行代码在你的任意html添加弹幕功能
三分钟(或者更短)添加弹幕功能
三步添加弹幕功能
# install aok.js
npm i -g aok.js
# cd workspace
mdkir temp
cd temp
# download zip
wget https://github.com/apporoad/LiSA.danmu.js/raw/master/LiSA.danmu.js.zip
# run
aok LiSA.danmu.js.zip -r api -s static -w danmu
# cat your data
cat $(ls danmu/api/*.data)
打开任意网页,进入开发者模式,粘帖以下代码
//config
window.danmu = {id :'',url:'http://localhost:11540/'}
//注入js
var s = document.createElement("script");s.type = "text/javascript"; s.src=(window.danmu.url||window.danmu.site||'') + 'LiSA.danmu.js';document.getElementsByTagName("head")[0].appendChild(s);
html 注入 go test 的代码即可
- 后端引擎采用aok.js
- 前端弹幕基于jquery.barrager.js
- 弹窗控件采用artDialog
浏览器必须支持 promise
较低版本浏览器未进行测试
思路是采用代理层文本替换,如nginx的http_addition_module 添加注入脚本
具体步骤见 deploy
mkdir -p /data/danmu
cd /data/danmu
wget https://github.com/apporoad/LiSA.danmu.js/raw/master/LiSA.danmu.js.zip
aok LiSA.danmu.js.zip -r api -s static -w site
#test
pm2 start --name danmu aok -- /data/danmu/site/api -s /data/danmu/site/static -p 11540