Skip to content

Commit

Permalink
V1.4
Browse files Browse the repository at this point in the history
更新 DPlayer 至最新版本
新增 去除右键菜单
新增 去除全局按建检测 设置
新版 DPlayer 更新了 SATA 授权协议,用前请先 +1star =-=(支持作者)
  • Loading branch information
fghrsh committed Jul 16, 2016
1 parent b06244f commit 1ec935f
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 19 deletions.
3 changes: 3 additions & 0 deletions DPlayer.min.js

Large diffs are not rendered by default.

23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
[dplayer url="http://xxx.com/xxx.mp4" pic="http://xxx.com/xxx.jpg" autoplay="true" danmu="false"/]
```

### V1.4 更新
更新 DPlayer 至最新版本
新增 去除右键菜单
新增 去除全局按建检测 设置
新版 DPlayer 更新了 [SATA](https://github.com/DIYgod/DPlayer/blob/master/LICENSE "The Star And Thank Author License") 授权协议,用前请先 [+1star](https://github.com/DIYgod/DPlayer "DPlayer") =-=(支持作者)

### V1.2 更新
已实现Ajax/Pjax模板支持,仅需在 加载完成时执行 里加入
```
Expand All @@ -20,16 +26,19 @@ dpajaxload();
即可无刷新加载 DPlayer 播放器(效果见我博客,全站pjax)

###参数说明
url - 视频地址(必须)
pic - 视频封面(可选)
danmu - 弹幕(可选,默认开)
autoplay - 自动播放(可选,默认关)
url - 视频地址(必须)
pic - 视频封面(可选)
danmu - 弹幕(可选,默认开)
loop - 循环播放(可选,默认关)
autoplay - 自动播放(可选,默认关)
theme - 自定义颜色(可选,默认为全局设置)

###后台配置说明
本站地址 - 用于生成唯一视频ID
弹幕后端服务器 - 用于指定弹幕服务器地址
播放器色调 - 指定全局播放器颜色主题(颜色生效在哪?你看看进度条..)
本站地址 - 用于生成唯一视频ID
去除右键菜单 - 隐藏播放器右键菜单
弹幕后端服务器 - 用于指定弹幕服务器地址
去除全局按建检测 - 解决评论 输入空格 导致 播放器暂停/播放 问题
播放器色调 - 指定全局播放器颜色主题(颜色生效在哪?你看看进度条..)
Tips:想多个站显示同一弹幕,设置“本站地址”为同一地址即可(视频地址需相同)

## LICENSE
Expand Down
1 change: 0 additions & 1 deletion dplayer/DPlayer.min.css

This file was deleted.

3 changes: 0 additions & 3 deletions dplayer/DPlayer.min.js

This file was deleted.

2 changes: 2 additions & 0 deletions function.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ function parseCallback($post,$siteurl,$dmserver,$theme) {
'theme' => $theme);
$data['autoplay'] = ($atts['autoplay'] == 'true') ? true : false;
$data['theme'] = $atts['theme'] ? $atts['theme'] : $theme;
$data['loop'] = ($atts['loop'] == 'true') ? true : false;
$data['lang'] = 'zh';
$data['video'] = $result;
$danmaku = array(
'id' => md5($id),
Expand Down
23 changes: 20 additions & 3 deletions include.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,38 @@ function DPlayer_Filter_Plugin_ViewList_Template(&$template) {

function DPlayer_Filter_Plugin_Zbp_MakeTemplatetags() {
global $zbp;
$zbp->header .= '<link rel="stylesheet" href="'.$zbp->host.'zb_users/plugin/DPlayer/dplayer/DPlayer.min.css">'."\r\n";
$zbp->footer .= '<script type="text/javascript" src="'.$zbp->host.'zb_users/plugin/DPlayer/dplayer/DPlayer.min.js"></script>'."\r\n"."<script>function dpajaxload(){var dPlayers=[],dPlayerOptions=[];if($(\"#dpajax\").length>0){eval($(\"#dpajax\").text());var len=dPlayerOptions.length;for(var i=0;i<len;i++){dPlayers[i]=new DPlayer({element:document.getElementById('player'+dPlayerOptions[i]['id']),autoplay:dPlayerOptions[i]['autoplay'],video:dPlayerOptions[i]['video'],theme:dPlayerOptions[i]['theme'],danmaku:dPlayerOptions[i]['danmaku'],});dPlayers[i].init()}}}dpajaxload();</script>";
//$zbp->header .= '<link rel="stylesheet" href="'.$zbp->host.'zb_users/plugin/DPlayer/dplayer/DPlayer.min.css">'."\r\n";
$zbp->footer .= '<script type="text/javascript" src="'.$zbp->host.'zb_users/plugin/DPlayer/DPlayer.min.js?v=1.0.2"></script>'."\r\n"."<script>function dpajaxload(){var dPlayers=[],dPlayerOptions=[];if($(\"#dpajax\").length>0){eval($(\"#dpajax\").text());var len=dPlayerOptions.length;for(var i=0;i<len;i++){dPlayers[i]=new DPlayer({element:document.getElementById('player'+dPlayerOptions[i]['id']),autoplay:dPlayerOptions[i]['autoplay'],loop:dPlayerOptions[i]['loop'],lang:dPlayerOptions[i]['lang'],video:dPlayerOptions[i]['video'],theme:dPlayerOptions[i]['theme'],danmaku:dPlayerOptions[i]['danmaku'],});dPlayers[i].init()}}}dpajaxload();</script>";
}

function InstallPlugin_DPlayer() {
global $zbp,$obj,$bucket;
if (!$zbp->Config('DPlayer')->HasKey('theme')) {
$zbp->Config('DPlayer')->seturl = $zbp->host;
$zbp->Config('DPlayer')->dmserver = '//danmaku.daoapp.io/dplayer/danmaku';
$zbp->Config('DPlayer')->dmserver = '//dplayer.daoapp.io/';
$zbp->Config('DPlayer')->theme = '#FADFA3';
$zbp->Config('DPlayer')->hidermmenu = '0';
$zbp->Config('DPlayer')->fixcodekey = '0';
$zbp->SaveConfig('DPlayer');
}
}

function UninstallPlugin_DPlayer() {
global $zbp;
if ($zbp->Config('DPlayer')->hidermmenu == '1') {
$dpjs = file_get_contents(dirname(__FILE__)."/DPlayer.min.js");
$dpjs = str_replace('<!--<div class="dplayer-menu">','<div class="dplayer-menu">',$dpjs);
$dpjs = str_replace('About DPlayer")+"</a></span></div>\n </div>-->\n','About DPlayer")+"</a></span></div>\n </div>\n',$dpjs);
file_put_contents(dirname(__FILE__)."/DPlayer.min.js",$dpjs);
}
if ($zbp->Config('DPlayer')->hidermmenu !== '0') {
$dpjs = file_get_contents(dirname(__FILE__)."/DPlayer.min.js");
$dpjs = str_replace('/*fixcodekey32*/','a.preventDefault(),e.toggle();',$dpjs);
$dpjs = str_replace('/*fixcodekey37*/','a.preventDefault(),e.audio.currentTime=e.audio.currentTime-5;',$dpjs);
$dpjs = str_replace('/*fixcodekey39*/','a.preventDefault(),e.audio.currentTime=e.audio.currentTime+5;',$dpjs);
$dpjs = str_replace('/*fixcodekey38*/','a.preventDefault(),r=e.audio.volume+.1,r=r>0?r:0,r=r<1?r:1,e.updateBar("volume",r,"width"),e.audio.volume=r,e.audio.muted&&(e.audio.muted=!1),b();',$dpjs);
$dpjs = str_replace('/*fixcodekey40*/','a.preventDefault(),r=e.audio.volume-.1,r=r>0?r:0,r=r<1?r:1,e.updateBar("volume",r,"width"),e.audio.volume=r,e.audio.muted&&(e.audio.muted=!1),b()',$dpjs);
file_put_contents(dirname(__FILE__)."/DPlayer.min.js",$dpjs);
}
$zbp->DelConfig('DPlayer');
}
43 changes: 40 additions & 3 deletions main.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$zbp->Load();
if (!$zbp->CheckRights('root')) {$zbp->ShowError(6);exit();}
if (!$zbp->CheckPlugin('DPlayer')) {$zbp->ShowError(48);die();}
$blogtitle="DPlayer for Z-BlogPHP - 插件配置";
$blogtitle='<a href="https://app.zblogcn.com/?id=1033" target="_blank">DPlayer for Z-BlogPHP</a> - 插件配置';
require $blogpath . 'zb_system/admin/admin_header.php';
require $blogpath . 'zb_system/admin/admin_top.php';

Expand Down Expand Up @@ -32,6 +32,40 @@
$zbp->Config('DPlayer')->dmserver = '';
$zbp->ShowHint('bad', '弹幕服务器地址为空,弹幕设置将失效');
}
if (!$hidermmenu == ($zbp->Config('DPlayer')->hidermmenu)){
$dpjs = file_get_contents(dirname(__FILE__)."/DPlayer.min.js");
if ($hidermmenu == '1') {
$dpjs = str_replace('<div class="dplayer-menu">','<!--<div class="dplayer-menu">',$dpjs);
$dpjs = str_replace('About DPlayer")+"</a></span></div>\n </div>\n','About DPlayer")+"</a></span></div>\n </div>-->\n',$dpjs);
} else {
$dpjs = str_replace('<!--<div class="dplayer-menu">','<div class="dplayer-menu">',$dpjs);
$dpjs = str_replace('About DPlayer")+"</a></span></div>\n </div>-->\n','About DPlayer")+"</a></span></div>\n </div>\n',$dpjs);
}
file_put_contents(dirname(__FILE__)."/DPlayer.min.js",$dpjs);
$zbp->Config('DPlayer')->hidermmenu = $hidermmenu;
$tips .= '附加设置已应用,如有请刷新播放器js缓存以生效;';
}
if (!$fixcodekey == ($zbp->Config('DPlayer')->fixcodekey)){
$dpjs = file_get_contents(dirname(__FILE__)."/DPlayer.min.js");
if ($fixcodekey == '1') {
$dpjs = str_replace('a.preventDefault(),e.toggle();','/*fixcodekey32*/',$dpjs);
} elseif ($fixcodekey == '2') {
$dpjs = str_replace('a.preventDefault(),e.toggle();','/*fixcodekey32*/',$dpjs);
$dpjs = str_replace('a.preventDefault(),e.audio.currentTime=e.audio.currentTime-5;','/*fixcodekey37*/',$dpjs);
$dpjs = str_replace('a.preventDefault(),e.audio.currentTime=e.audio.currentTime+5;','/*fixcodekey39*/',$dpjs);
$dpjs = str_replace('a.preventDefault(),r=e.audio.volume+.1,r=r>0?r:0,r=r<1?r:1,e.updateBar("volume",r,"width"),e.audio.volume=r,e.audio.muted&&(e.audio.muted=!1),b();','/*fixcodekey38*/',$dpjs);
$dpjs = str_replace('a.preventDefault(),r=e.audio.volume-.1,r=r>0?r:0,r=r<1?r:1,e.updateBar("volume",r,"width"),e.audio.volume=r,e.audio.muted&&(e.audio.muted=!1),b()','/*fixcodekey40*/',$dpjs);
} else {
$dpjs = str_replace('/*fixcodekey32*/','a.preventDefault(),e.toggle();',$dpjs);
$dpjs = str_replace('/*fixcodekey37*/','a.preventDefault(),e.audio.currentTime=e.audio.currentTime-5;',$dpjs);
$dpjs = str_replace('/*fixcodekey39*/','a.preventDefault(),e.audio.currentTime=e.audio.currentTime+5;',$dpjs);
$dpjs = str_replace('/*fixcodekey38*/','a.preventDefault(),r=e.audio.volume+.1,r=r>0?r:0,r=r<1?r:1,e.updateBar("volume",r,"width"),e.audio.volume=r,e.audio.muted&&(e.audio.muted=!1),b();',$dpjs);
$dpjs = str_replace('/*fixcodekey40*/','a.preventDefault(),r=e.audio.volume-.1,r=r>0?r:0,r=r<1?r:1,e.updateBar("volume",r,"width"),e.audio.volume=r,e.audio.muted&&(e.audio.muted=!1),b()',$dpjs);
}
file_put_contents(dirname(__FILE__)."/DPlayer.min.js",$dpjs);
$zbp->Config('DPlayer')->fixcodekey = $fixcodekey;
$tips .= '附加设置已应用,如有请刷新播放器js缓存以生效;';
}
$zbp->Config('DPlayer')->theme = $_POST['theme'];
$zbp->SaveConfig('DPlayer');
if(isset($tips)){$zbp->ShowHint('good', $tips);}
Expand Down Expand Up @@ -60,9 +94,12 @@
<td><b><label><p align="center">本站地址</p></label></b></td>
<td><p align="left"><input name="seturl" type="text" size="100%" value="<?php echo $zbp->Config('DPlayer')->seturl;?>" /></p></td>
</tr><tr>
<td><b><label><p align="center">弹幕后端服务器</p></label></b></td>
<td><b><label><p align="center">弹幕服务器</p></label></b></td>
<td><p align="left"><input name="dmserver" type="text" size="100%" value="<?php echo $zbp->Config('DPlayer')->dmserver;?>" /></p></td>
</tr>
</tr><tr>
<td><b><label><p align="center">附加设置</p></label></b></td>
<td><?php $useue = $zbp->Config('DPlayer')->useue;$hidermmenu = $zbp->Config('DPlayer')->hidermmenu;$fixcodekey = $zbp->Config('DPlayer')->fixcodekey; ?><p align="left">适配 UEditor:开发中</p><p align="left">---------------------------------------------------------------------</p><p align="left">去除右键菜单:<input type="radio" name="hidermmenu" value="1" <?php if ($hidermmenu == '1') echo 'checked="checked"'; ?>/>true&nbsp;&nbsp;&nbsp;<input type="radio" name="hidermmenu" value="0" <?php if ($hidermmenu == '0') echo 'checked="checked"'; ?>/>false</p><p align="left">---------------------------------------------------------------------</p><p align="left">去除全局按建检测:<input type="radio" name="fixcodekey" value="0" <?php if ($fixcodekey == '0') echo 'checked="checked"'; ?>/>不去除&nbsp;&nbsp;<input type="radio" name="fixcodekey" value="1" <?php if ($fixcodekey == '1') echo 'checked="checked"'; ?>/>仅空格&nbsp;&nbsp;<input type="radio" name="fixcodekey" value="2" <?php if ($fixcodekey == '2') echo 'checked="checked"'; ?>/>所有按键</p><p align="left">(切换其他状态前,请先设置为 “不去除” 并应用,再切换应用其他状态!)</p><p align="left">---------------------------------------------------------------------</p><p align="left">支持作者:</p><p align="left">*SATA: The Star And Thank Author License</p><p align="left">DPlayer 采用 *<a href="https://github.com/DIYgod/DPlayer/blob/master/LICENSE" target="_blank" >SATA</a> 授权协议,用前请先 <a href="https://github.com/DIYgod/DPlayer" target="_blank" >+1star</a> =-=</p></td>
</tr>
</table>
<table width="100%" border="1" width="100%" class="tableBorder">
<tr>
Expand Down
4 changes: 2 additions & 2 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<url></url>
</source>
<adapted>140614</adapted>
<version>1.3</version>
<version>1.4</version>
<pubdate>2016-05-30</pubdate>
<modified>2016-06-03</modified>
<modified>2016-07-17</modified>
<price>0</price>
<advanced>
<dependency></dependency>
Expand Down

0 comments on commit 1ec935f

Please sign in to comment.