├── player ├── count.dat ├── img │ ├── full.png │ ├── move.png │ ├── sign.png │ ├── alphay.ico │ ├── loading.gif │ ├── loading.png │ ├── fulloff.webp │ ├── loading2.gif │ ├── loading2.png │ ├── loading3.gif │ ├── pagefull.png │ └── background.jpg ├── css │ └── alphaY.ttf ├── js │ ├── theme │ │ └── default │ │ │ ├── icon.png │ │ │ ├── layer.css░╫ │ │ │ └── layer.css │ ├── setting - cookie.js │ ├── layer.js │ └── setting.js ├── tj.php └── index.php ├── admin ├── js │ ├── alphay.ico │ ├── style.css │ ├── upload.js │ ├── jquery.dragsort-0.4.min.js │ └── config.js ├── config.php ├── api.php ├── post.php ├── data.php ├── login.php └── index.php ├── dmku ├── install │ ├── sql.db │ └── index.php ├── class │ ├── ed.class.php │ ├── sqlite3.class.php │ ├── mysqli.class.php │ ├── danmu.class.php │ └── pdo.class.php ├── config.inc.php ├── dm_rule.html ├── index.php ├── bilibili │ └── index.php └── init.php ├── screenshot ├── admin.png ├── login.png ├── playing.png ├── configDB.png ├── playNoUrl.png └── playLoading.png ├── LICENSE └── README.md /player/count.dat: -------------------------------------------------------------------------------- 1 | 159.75.199.24,1648391716 2 | 42.193.132.129,1648391745 3 | -------------------------------------------------------------------------------- /admin/js/alphay.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/admin/js/alphay.ico -------------------------------------------------------------------------------- /dmku/install/sql.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/dmku/install/sql.db -------------------------------------------------------------------------------- /player/img/full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/img/full.png -------------------------------------------------------------------------------- /player/img/move.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/img/move.png -------------------------------------------------------------------------------- /player/img/sign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/img/sign.png -------------------------------------------------------------------------------- /player/css/alphaY.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/css/alphaY.ttf -------------------------------------------------------------------------------- /player/img/alphay.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/img/alphay.ico -------------------------------------------------------------------------------- /player/img/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/img/loading.gif -------------------------------------------------------------------------------- /player/img/loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/img/loading.png -------------------------------------------------------------------------------- /screenshot/admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/screenshot/admin.png -------------------------------------------------------------------------------- /screenshot/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/screenshot/login.png -------------------------------------------------------------------------------- /screenshot/playing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/screenshot/playing.png -------------------------------------------------------------------------------- /player/img/fulloff.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/img/fulloff.webp -------------------------------------------------------------------------------- /player/img/loading2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/img/loading2.gif -------------------------------------------------------------------------------- /player/img/loading2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/img/loading2.png -------------------------------------------------------------------------------- /player/img/loading3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/img/loading3.gif -------------------------------------------------------------------------------- /player/img/pagefull.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/img/pagefull.png -------------------------------------------------------------------------------- /screenshot/configDB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/screenshot/configDB.png -------------------------------------------------------------------------------- /screenshot/playNoUrl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/screenshot/playNoUrl.png -------------------------------------------------------------------------------- /player/img/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/img/background.jpg -------------------------------------------------------------------------------- /screenshot/playLoading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/screenshot/playLoading.png -------------------------------------------------------------------------------- /player/js/theme/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superggfun/alphaYplayer/HEAD/player/js/theme/default/icon.png -------------------------------------------------------------------------------- /admin/config.php: -------------------------------------------------------------------------------- 1 | 'cj5277',//后台密码 4 | 'tips' => //出场弹幕提示 5 | array ( 6 | 'time' => '6', 7 | 'color' => '#fb7299', 8 | 'text' => '请大家遵守弹幕礼仪', 9 | ), 10 | 'ok' => '0', //接口防窥 11 | ); 12 | -------------------------------------------------------------------------------- /admin/api.php: -------------------------------------------------------------------------------- 1 | 1, 15 | 'data' => $yzm 16 | ]; 17 | die(json_encode($json)); 18 | 19 | 20 | //$config = file_get_contents('config.json'); 21 | 22 | //echo $config; 23 | -------------------------------------------------------------------------------- /dmku/class/ed.class.php: -------------------------------------------------------------------------------- 1 | set_charset('utf8'); 6 | 7 | $cid = $_POST['cid']; 8 | $id = $_POST['id']; 9 | $text = $_POST['text']; 10 | $videotime = $_POST['videotime']; 11 | $ip = $_POST['ip']; 12 | $time = $_POST['time']; 13 | // 更新数据 14 | mysql_query("UPDATE danmaku_report SET text='$text' WHERE cid=$cid", $link) or die('修改数据出错:' . mysql_error()); 15 | mysql_query("UPDATE danmaku_list SET text='$text' WHERE cid=$cid", $link) or die('修改数据出错:' . mysql_error()); 16 | -------------------------------------------------------------------------------- /dmku/config.inc.php: -------------------------------------------------------------------------------- 1 | 'alphay', 4 | '后台密码' => '123456', 5 | 'tips' => [ 6 | 'time' => '6', 7 | 'color' => '#fb7299', 8 | 'text' => '请大家遵守弹幕礼仪,文明发送弹幕', 9 | ], 10 | '防窥' => '0', 11 | '数据库' => [ 12 | '类型' => 'mysql', 13 | '方式' => 'pdo', 14 | '地址' => 'localhost', 15 | '用户名' => '', 16 | '密码' => '', 17 | '名称' => '', 18 | ], 19 | 20 | 'is_cdn' => 0, //是否用了cdn 21 | '限制时间' => 60, //单位s 22 | '限制次数' => 20, //在限制时间内可以发送多少条弹幕 23 | '允许url' => [], //跨域 格式['https://abc.com','http://cba.com'] 要加协议 24 | '安装' => 0 25 | ]; 26 | -------------------------------------------------------------------------------- /admin/post.php: -------------------------------------------------------------------------------- 1 | ")) { 15 | echo "{code:1,msg:保存成功}"; 16 | } else { 17 | echo ""; 18 | } 19 | $yzm = $data; 20 | } 21 | -------------------------------------------------------------------------------- /admin/data.php: -------------------------------------------------------------------------------- 1 | 'on', 4 | 'color' => '#00a1d6', 5 | 'logo' => 'https://cdn.jsdelivr.net/gh/superggfun/push/blog/alphay.ico', 6 | 'trytime' => '#', 7 | 'waittime' => '10', 8 | 'sendtime' => '1', 9 | 'dmrule' => '../dmku/dm_rule.html', 10 | 'pbgjz' => '草,操,妈,逼,滚,网址,网站,支付宝,企,关注,wx,微信,qq,QQ', 11 | 'ads' => 12 | array ( 13 | 'set' => 14 | array ( 15 | 'state' => '2', 16 | 'group' => 'null', 17 | 'pic' => 18 | array ( 19 | 'time' => '3', 20 | 'img' => '#', 21 | 'link' => '#', 22 | ), 23 | 'vod' => 24 | array ( 25 | 'url' => '#', 26 | 'link' => '#', 27 | ), 28 | ), 29 | 'pause' => 30 | array ( 31 | 'pic' => '#', 32 | 'link' => '#', 33 | ), 34 | ), 35 | ); 36 | ?> -------------------------------------------------------------------------------- /player/tj.php: -------------------------------------------------------------------------------- 1 | time())) { 15 | 16 | array_push($temp, $entry[0] . "," . $entry[1] . "\n"); //取出其他浏览者的信息,并去掉超时者,保存进$temp 17 | 18 | } 19 | } 20 | array_push($temp, getenv('REMOTE_ADDR') . "," . (time() + ($timeout)) . "\n"); //更新浏览者的时间 21 | $users_online = count($temp); //计算在线人数 22 | $entries = implode("", $temp); 23 | 24 | //写入文件 25 | $fp = fopen($online_log, "w"); 26 | flock($fp, LOCK_EX); //flock() 不能在NFS以及其他的一些网络文件系统中正常工作 27 | fputs($fp, $entries); 28 | flock($fp, LOCK_UN); 29 | fclose($fp); 30 | echo "$users_online"; 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 ggfun 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 修改说明 2 | 原作者:京都一只喵 3 | 4 | # 播放器说明 5 | 播放器可以播放mp3、mp4、flv、m3u8等常见格式,不支持MP4 H265格式的视频。 6 | ![播放中](https://cdn.jsdelivr.net/gh/superggfun/alphaYplayer/screenshot/playing.png) 7 | ![加载](https://cdn.jsdelivr.net/gh/superggfun/alphaYplayer/screenshot/playLoading.png) 8 | ![登录](https://cdn.jsdelivr.net/gh/superggfun/alphaYplayer/screenshot/login.png) 9 | ![播放中](https://cdn.jsdelivr.net/gh/superggfun/alphaYplayer/screenshot/admin.png) 10 | 11 | # 使用方法 12 | 1. 请使用 PHP7.X版本,并在 PHP7.4 环境测试通过。请勿使用PHP8.X版本,在这个版本中可能会运行失败! 13 | 2. 解压到网站根目录 14 | 3. 登录 你的域名/dmku 进行配置数据库 (网页链接) 15 | 4. 修改播放器后台密码 dmku/config.inc.php(请注意这里不是网页链接,是在电脑文件夹里修改) 16 | 5. 登录后台 你的域名/admin 密码为第3步修改的密码 (网页链接) 17 | 6. 设置播放器的后台功能 18 | 19 | # 参数说明(player/index.php) 20 | ``` 21 | "av":'',//B站av号,用于调用弹幕 22 | "url":"",//视频链接 23 | "id":"",//视频id 24 | "sid":"",//集数id 25 | "pic":"",//视频封面 26 | "title":"",//视频标题 27 | "next":"",//下一集链接 28 | "user": '',//用户名 29 | "group": "",//用户组 30 | ``` 31 | # 请求示例 32 | 播放器:https://localhost/player/?url=你的视频地址这样就可以播放视频了。 33 | 34 | 测试mp4:https://localhost/player/?url=http://vfx.mtime.cn/Video/2019/03/19/mp4/190319222227698228.mp4 35 | 36 | 测试m3u8:https://localhost/player/?url=https://vod1.bdzybf7.com/20220226/9KUhKiAs/index.m3u8 37 | 38 | #### 高级 39 | 除了 url 参数,其他都可以省略 40 | 41 | http://localhost/player/?url=https://cdn.jsdelivr.net/gh/xxx/Video-Bed/Your.Name/playlist.m3u8&next=https://cdn.jsdelivr.net/gh/xxx/Video-Bed/Your.Name/playlist.m3u8&sid=1&pic=https://img.xx.com/1.png&user=游客&group=1&name=测试 42 | 43 | # 感谢 44 | 感谢uihp大佬对我修改的支持 45 | -------------------------------------------------------------------------------- /dmku/dm_rule.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 弹幕礼仪相关 6 | 7 | 8 |

弹幕礼仪

9 |

倡议内容

10 | 17 |

禁止内容

18 |

违反以下规则都将受到相应的处理。

19 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /admin/login.php: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 | 24 | 25 | 26 | 弹幕管理系统 27 | 28 | 29 | 30 | 34 | 35 | 36 |
37 |




38 |
39 |

40 |
41 | 42 |
43 |
44 |

弹幕管理系统

45 |
46 | '.$ti.' 47 |
48 |
49 |
50 | 51 |
52 |
53 |
54 | 55 |
56 |
57 | 58 |
59 |
60 |
61 |
'; 62 | die(); 63 | }else{ 64 | //

密码: '.$_COOKIE["pass"].'

65 | setcookie("zt", $cookielock, time()+86400, '/'); 66 | } 67 | }else{ 68 | 69 | } 70 | 71 | 72 | ?> 73 | -------------------------------------------------------------------------------- /dmku/index.php: -------------------------------------------------------------------------------- 1 | 编辑弹幕($cid) ?: succeedmsg(0, '完成'); 24 | exit; 25 | } 26 | if ($_SERVER['REQUEST_METHOD'] === 'POST') { 27 | $d_data = json_decode(file_get_contents('php://input'), true); 28 | // 限制发送频率 29 | $lock = 1; 30 | $ip = get_ip(); 31 | $data = sql::查询_发送弹幕次数($ip); 32 | 33 | if (empty($data)) { 34 | sql::插入_发送弹幕次数($ip); 35 | $lock = 0; 36 | } else { 37 | $data = $data[0]; 38 | 39 | if ($data['time'] + $_config['限制时间'] > time()) { 40 | if ($data['c'] < $_config['限制次数']) { 41 | $lock = 0; 42 | sql::更新_发送弹幕次数($ip); 43 | }; 44 | } 45 | 46 | if ($data['time'] + $_config['限制时间'] < time()) { 47 | sql::更新_发送弹幕次数($ip, time()); 48 | $lock = 0; 49 | } 50 | } 51 | 52 | 53 | 54 | 55 | if ($lock === 0) { 56 | $d->添加弹幕($d_data); 57 | succeedmsg(23, true); 58 | } else { 59 | succeedmsg(-2, "你tm发送的太频繁了,请问你单身几年了?"); 60 | } 61 | } 62 | 63 | 64 | if ($_SERVER['REQUEST_METHOD'] === 'GET') { 65 | if ($_GET['ac'] == "report") { 66 | $text = $_GET['text']; 67 | sql::举报_弹幕($text); 68 | showmessage(-3, '举报成功!感谢您为守护弹幕作出了贡献'); 69 | } else if ($_GET['ac'] == "dm" or $_GET['ac'] == "get") { 70 | $id = $_GET['id'] ?: showmessage(-1, null); 71 | $data = $d->弹幕池($id) ?: showmessage(23, []); 72 | showmessage(23, $data); 73 | } else if ($_GET['ac'] == "list") { 74 | $data = $d->弹幕列表() ?: showmessage(0, []); 75 | showmessage(0, $data); 76 | } else if ($_GET['ac'] == "reportlist") { 77 | $data = $d->举报列表() ?: showmessage(0, []); 78 | showmessage(0, $data); 79 | } else if ($_GET['ac'] == "del") { 80 | $id = $_GET['id'] ?: succeedmsg(-1, null); 81 | $type = $_GET['type'] ?: succeedmsg(-1, null); 82 | $data = $d->删除弹幕($id) ?: succeedmsg(0, []); 83 | succeedmsg(23, true); 84 | } else if ($_GET['ac'] == "so") { 85 | $key = $_GET['key'] ?: showmessage(0, null); 86 | $data = $d->搜索弹幕($key) ?: showmessage(0, []); 87 | showmessage(0, $data); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /admin/js/style.css: -------------------------------------------------------------------------------- 1 | .head{background-color: hsla(0, 0%, 100%, 0.69);box-shadow: 1px 1px 3px 1px hsla(0, 0%, 100%, 0.69);} 2 | input{outline:none;} 3 | input:-webkit-autofill { box-shadow: 0 0 0px 1000px white inset;} 4 | body{background: url(/player/img/loading.gif)top fixed no-repeat;} 5 | .navbar-brand{font-size: 25px;line-height: 20px;font-weight: bold;} 6 | .bd{background-color: hsla(0, 0%, 100%, 0.69);height: 100%;border-radius: 5px;padding: 45px;} 7 | .wrapper{width: 900px;margin: 0 auto;} 8 | .container{width: 970px!important;margin: 0 auto;} 9 | h2{text-align: center;margin: 30px;} 10 | th,td{text-align: center;} 11 | td a{padding: 3px 5px;border: 1px solid #337ab7;border-radius: 4px;background-color: #337ab7;margin-right: 5px;color: #fff;} 12 | td a:hover{color: #000;background-color: #fff;border: 1px solid #337ab7;text-decoration: none;} 13 | .all{-position: absolute;padding: 7px 14px;margin-top: -20px;border-color: #ffffff;background-color: #fff;color: #000;width: 900px;} 14 | .so{padding: 10px 12px;margin-top: -20px;border-color: #ffffff;} 15 | .so .text{width: 175px;height: 30px;border-radius: 4px 0px 0px 4px;border: 1px solid #ddd;padding: 10px;} 16 | .so .submit{color: #fff;background-color: #337ab7;border: 0;width: 50px;height: 30px;border-radius: 0px 4px 4px 0px;} 17 | #footer{-color: white;-background-color: #000000;-border-top: 1px solid #ccc;padding: 20px;text-align: center;} 18 | .navbar-nav>li:hover>a{background-color: hsla(0, 0%, 100%, 0.69)!important;border-radius: 4px;} 19 | .pager li>input{display: inline-block;padding: 5px 14px;background-color: #fff;border: 1px solid #ddd;border-radius: 15px;} 20 | .panel-primary>.panel-heading{color: #fff;background-color: hsla(205, 69%, 66%, 0.69);border-color: hsla(205, 69%, 66%, 0);border-radius: 4px 4px 0px 0px;/* opacity: 1.8; */} 21 | .panel-primary{border-color: hsla(205, 69%, 66%, 0.69); background-color: hsla(0, 0%, 100%, .69);} 22 | td a{padding: 3px 5px;border: 1px solid #6cb2e4;border-radius: 4px;background-color: #6cb2e4;margin-right: 5px;color: #fff;} 23 | @-webkit-keyframes fastr-20{0%{opacity:0;transform:translate(0,-60px);} 24 | 100%{opacity:1;transform:translate(0,0);}} 25 | @-webkit-keyframes fastr1-20{0%{opacity:0;transform:translate(0,60px);} 26 | 100%{opacity:1;transform:translate(0,0);}} 27 | .headnav{animation: fastr-20 5.5s;-webkit-animation: fastr-20 0.5s;-moz-animation: fastr-20 0.5s;} 28 | .wrapper,.block{animation: fastr1-20 5.5s;-webkit-animation: fastr1-20 0.5s;-moz-animation: fastr1-20 0.5s;} 29 | .btn-primary {color: #fff; background-color: hsla(208, 56%, 46%, .69);border-color: rgba(46, 109, 164, 0);} 30 | .block-title h2{ 31 | text-align: left; 32 | color: #635064; 33 | margin: 20px; 34 | } 35 | .block{ 36 | height: auto; 37 | background-color: hsla(0, 0%, 100%, .69); 38 | padding: 25px; 39 | border-radius: 5px; 40 | } 41 | td .color{ 42 | width: 16px; 43 | height: 16px; 44 | border: 1px solid rgba(0,0,0,.3); 45 | -webkit-box-sizing: border-box; 46 | box-sizing: border-box; 47 | border-radius: 2px; 48 | cursor: pointer; 49 | display: inline-block; 50 | } -------------------------------------------------------------------------------- /dmku/class/sqlite3.class.php: -------------------------------------------------------------------------------- 1 | enableExceptions(true); 17 | self::$sql = $sqlite; 18 | } catch (Exception $e) { 19 | showmessage(-1, '数据库错误:' . $e->getMessage()); 20 | } 21 | //SQLite3::escapeString($string); 22 | } 23 | 24 | public static function 插入_弹幕($data) 25 | { 26 | try { 27 | $stmt = self::$sql->prepare("INSERT OR IGNORE INTO danmaku_list (id, type, text, color, videotime, time) VALUES (:id, :type, :text, :color, :videotime, :time)"); 28 | $stmt->bindValue(':id', $data['id']); 29 | $stmt->bindValue(':type', $data['type']); 30 | $stmt->bindValue(':text', $data['text']); 31 | $stmt->bindValue(':color', $data['color']); 32 | $stmt->bindValue(':videotime', $data['time']); 33 | @$stmt->bindValue(':time', time()); 34 | $stmt->execute(); 35 | } catch (Exception $e) { 36 | showmessage(-1, '数据库错误:' . $e->getMessage()); 37 | } 38 | } 39 | 40 | public static function 插入_发送弹幕次数($ip) 41 | { 42 | try { 43 | $stmt = self::$sql->prepare("INSERT OR IGNORE INTO danmaku_ip (ip, time) VALUES (:ip, :time)"); 44 | $stmt->bindValue(':ip', $ip); 45 | @$stmt->bindValue(':time', time()); 46 | $stmt->execute(); 47 | } catch (Exception $e) { 48 | showmessage(-1, '数据库错误:' . $e->getMessage()); 49 | } 50 | } 51 | 52 | public static function 查询_弹幕池($id) 53 | { 54 | try { 55 | $stmt = self::$sql->prepare("SELECT * FROM danmaku_list WHERE id=:id"); 56 | $stmt->bindValue(':id', $id); 57 | $data = $stmt->execute(); 58 | $data = self::fetchAll($data); 59 | return $data; 60 | } catch (Exception $e) { 61 | showmessage(-1, '数据库错误:' . $e->getMessage()); 62 | } 63 | } 64 | 65 | public static function 查询_发送弹幕次数($ip) 66 | { 67 | try { 68 | $stmt = self::$sql->prepare("SELECT * FROM danmaku_ip WHERE ip=:ip LIMIT 1"); 69 | $stmt->bindValue(':ip', $ip); 70 | $stmt->execute(); 71 | $data = $stmt->execute(); 72 | $data = self::fetchAll($data); 73 | return $data; 74 | } catch (Exception $e) { 75 | showmessage(-1, '数据库错误:' . $e->getMessage()); 76 | } 77 | } 78 | 79 | public static function 更新_发送弹幕次数($ip, $time = 'time') 80 | { 81 | try { 82 | $query = "UPDATE danmaku_ip SET c=c+1,time=$time WHERE ip = :ip"; 83 | if (is_int($time)) $query = "UPDATE danmaku_ip SET c=1,time=$time WHERE ip = :ip"; 84 | $stmt = self::$sql->prepare($query); 85 | 86 | $stmt->bindValue(':ip', $ip); 87 | $stmt->execute(); 88 | } catch (Exception $e) { 89 | showmessage(-1, '数据库错误:' . $e->getMessage()); 90 | } 91 | } 92 | 93 | private static function fetchAll($obj) 94 | { 95 | $data = []; 96 | while ($arr = $obj->fetchArray(SQLITE3_ASSOC)) { 97 | $data[] = $arr; 98 | } 99 | return $data; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /dmku/class/mysqli.class.php: -------------------------------------------------------------------------------- 1 | connect_error) { 16 | showmessage(-1, '数据库错误:' . $sql->connect_errno . "\n" . $sql->connect_error); 17 | } 18 | self::$sql = $sql; 19 | } 20 | 21 | public static function 插入_弹幕($data) 22 | { 23 | try { 24 | $stmt = self::$sql->prepare("INSERT IGNORE INTO danmaku_list (id, type, text, color, videotime, time) VALUES (?, ?, ?, ?, ?, ?)"); 25 | @$stmt->bind_param('iisidi', $data['id'], $data['type'], $data['text'], $data['color'], $data['time'], time()); 26 | if ($stmt->execute() == false) { 27 | throw new Exception($stmt->error_list); 28 | } 29 | $stmt->close(); 30 | } catch (Exception $e) { 31 | showmessage(-1, $e->getMessage()); 32 | } 33 | } 34 | 35 | public static function 插入_发送弹幕次数($ip) 36 | { 37 | try { 38 | $stmt = self::$sql->prepare("INSERT IGNORE INTO danmaku_ip (ip, time) VALUES (?, ?)"); 39 | @$stmt->bind_param('si', $ip, time()); 40 | if ($stmt->execute() == false) { 41 | throw new Exception($stmt->error_list); 42 | } 43 | $stmt->close(); 44 | } catch (Exception $e) { 45 | showmessage(-1, $e->getMessage()); 46 | } 47 | } 48 | 49 | public static function 查询_弹幕池($id) 50 | { 51 | try { 52 | $stmt = self::$sql->prepare("SELECT * FROM danmaku_list WHERE id=?"); 53 | $stmt->bind_param('s', $id); 54 | if ($stmt->execute() == false) { 55 | throw new Exception($stmt->error_list); 56 | } 57 | $data = self::fetchAll($stmt->get_result()); 58 | $stmt->close(); 59 | return $data; 60 | } catch (Exception $e) { 61 | showmessage(-1, $e->getMessage()); 62 | } 63 | } 64 | 65 | public static function 查询_发送弹幕次数($ip) 66 | { 67 | try { 68 | $stmt = self::$sql->prepare("SELECT * FROM danmaku_ip WHERE ip = ? LIMIT 1"); 69 | $stmt->bind_param('s', $ip); 70 | if ($stmt->execute() == false) { 71 | throw new Exception($stmt->error_list); 72 | } 73 | $data = self::fetchAll($stmt->get_result()); 74 | $stmt->close(); 75 | return $data; 76 | } catch (Exception $e) { 77 | showmessage(-1, $e->getMessage()); 78 | } 79 | } 80 | 81 | public static function 更新_发送弹幕次数($ip, $time = 'time') 82 | { 83 | try { 84 | $query = "UPDATE danmaku_ip SET c=c+1,time=$time WHERE ip = ?"; 85 | if (is_int($time)) $query = "UPDATE danmaku_ip SET c=1,time=$time WHERE ip = ?"; 86 | $stmt = self::$sql->prepare($query); 87 | $stmt->bind_param('s', $ip); 88 | if ($stmt->execute() == false) { 89 | throw new Exception($stmt->error_list); 90 | } 91 | $stmt->close(); 92 | } catch (Exception $e) { 93 | showmessage(-1, $e->getMessage()); 94 | } 95 | } 96 | 97 | private static function fetchAll($obj) 98 | { 99 | $data = []; 100 | if ($obj->num_rows > 0) { 101 | while ($arr = $obj->fetch_assoc()) { 102 | $data[] = $arr; 103 | } 104 | } 105 | $obj->free(); 106 | return $data; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /dmku/bilibili/index.php: -------------------------------------------------------------------------------- 1 | 0 or ($cid > 0 and $av > 0)) { 30 | $xml = curl_get('https://api.bilibili.com/x/v1/dm/list.so?oid=' . $cid); 31 | echo xml_json($xml); 32 | } elseif ($av > 0 and $cid <= 0) { 33 | $cid = get_cid($av, $p); 34 | $xml = curl_get('https://api.bilibili.com/x/v1/dm/list.so?oid=' . $cid); 35 | echo xml_json($xml); 36 | } else { 37 | echo '{"code":1,"mes":"参数错误"}'; 38 | } 39 | 40 | 41 | 42 | function curl_get($url, $gzip = 1) 43 | { 44 | $curl = curl_init($url); 45 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 46 | curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10); 47 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 48 | curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); 49 | if ($gzip) curl_setopt($curl, CURLOPT_ENCODING, "gzip"); 50 | $content = curl_exec($curl); 51 | curl_close($curl); 52 | return $content; 53 | } 54 | function hex2rgb($hexColor) 55 | { 56 | $color = str_replace('#', '', $hexColor); 57 | if (strlen($color) > 3) { 58 | $r = hexdec(substr($color, 0, 2)); 59 | $g = hexdec(substr($color, 2, 2)); 60 | $b = hexdec(substr($color, 4, 2)); 61 | 62 | $rgb = 'rgb(' . $r . ',' . $g . ',' . $b . ')'; 63 | } else { 64 | $color = $hexColor; 65 | $r = substr($color, 0, 1) . substr($color, 0, 1); 66 | $g = substr($color, 1, 1) . substr($color, 1, 1); 67 | $b = substr($color, 2, 1) . substr($color, 2, 1); 68 | $rgb = array( 69 | 'r' => hexdec($r), 70 | 'g' => hexdec($g), 71 | 'b' => hexdec($b) 72 | ); 73 | } 74 | return $rgb; 75 | } 76 | 77 | function xml_json($xml) 78 | { 79 | $xml = simplexml_load_string($xml); //将文件转换成 对象 80 | $xmljson = json_encode($xml); 81 | $danmuku = json_decode($xmljson, true); 82 | foreach ($danmuku['d'] as $k => $v) { 83 | foreach ($xml->d[$k]->attributes() as $_v) { 84 | $danmuku['d'][$k] = [$v]; 85 | $danmuku['d'][$k][] = explode(",", (string) $_v); 86 | } 87 | } 88 | $danmuku = $danmuku['d']; 89 | $json = ['code' => 23]; 90 | foreach ($danmuku as $k => $v) { 91 | // 请不要随意调换下列数组赋值顺序 92 | $json['danmuku'][$k][] = (float) $v[1][0]; //弹幕出现时间(s) 93 | //弹幕样式 94 | 95 | if ($v[1][1] <= 3) { //滚动 96 | $json['danmuku'][$k][] = 'right'; 97 | } 98 | 99 | if ($v[1][1] == 5) { //顶端 100 | $json['danmuku'][$k][] = 'top'; 101 | } 102 | 103 | if ($v[1][1] == 4) { //底端 104 | $json['danmuku'][$k][] = 'bottom'; 105 | } 106 | 107 | $json['danmuku'][$k][] = hex2rgb($v[1][6]); //字体的颜色 108 | 109 | $json['danmuku'][$k][] = ""; //bilibili 弹幕发送者的ID 110 | $json['danmuku'][$k][] = $v[0]; //弹幕文本 111 | //$json['total'] = $k + 1; //就当它不存在吧,弹幕总数 112 | } 113 | 114 | return json_encode($json); 115 | } 116 | 117 | function get_cid($av, $p) 118 | { 119 | $data = json_decode(curl_get('https://api.bilibili.com/x/player/pagelist?aid=' . $av), true); 120 | if (empty($data['data'][$p - 1]['cid'])) { 121 | die('{"code":1,"mes":"参数错误"}'); 122 | } 123 | return $data['data'][$p - 1]['cid']; 124 | } 125 | -------------------------------------------------------------------------------- /dmku/class/danmu.class.php: -------------------------------------------------------------------------------- 1 | 3) showmessage(-1,'参数错误'); 18 | 19 | sql::插入_弹幕($data); 20 | } 21 | 22 | public function 删除弹幕($id) 23 | { 24 | //sql::插入_弹幕($data); 25 | sql::删除_弹幕数据($id); 26 | } 27 | 28 | public function 弹幕池($id) 29 | { 30 | $data = sql::查询_弹幕池($id); 31 | //print_r($data); 32 | if (empty($data)) return null; 33 | 34 | $arr = []; 35 | foreach ($data as $k => $v) { 36 | // 请不要随意调换下列数组赋值顺序 37 | $arr[$k][] = (float) $v['videotime']; //弹幕出现时间(s) 38 | $arr[$k][] = (string) $v['type']; //弹幕样式 39 | $arr[$k][] = (string) $v['color']; //字体的颜色 40 | $arr[$k][] = (string) $v['cid']; //现在是弹幕id,以后可能是发送者id了 41 | $arr[$k][] = (string) $v['text']; //弹幕文本 42 | $arr[$k][] = (string) $v['ip']; //弹幕ip 43 | //$arr[$k][] = (string)$v['time']; //弹幕系统时间 44 | $arr[$k][] = $date = date('m-d H:i', $v['time']); //弹幕系统时间 45 | $arr[$k][] = (string) $v['size']; //弹幕系统大小 46 | } 47 | 48 | return $arr; 49 | } 50 | public function 搜索弹幕($key) 51 | { 52 | $data = sql::搜索_弹幕池($key); 53 | //print_r($data); 54 | if (empty($data)) return null; 55 | 56 | $arr = []; 57 | foreach ($data as $k => $v) { 58 | // 请不要随意调换下列数组赋值顺序 59 | $arr[$k][] = (string) $v['id']; //弹幕id 60 | $arr[$k][] = (float) $v['videotime']; //弹幕出现时间(s) 61 | $arr[$k][] = (string) $v['type']; //弹幕样式 62 | $arr[$k][] = (string) $v['color']; //字体的颜色 63 | $arr[$k][] = (string) $v['cid']; //现在是弹幕id,以后可能是发送者id了 64 | $arr[$k][] = (string) $v['text']; //弹幕文本 65 | $arr[$k][] = (string) $v['ip']; //弹幕ip 66 | //$arr[$k][] = (string)$v['time']; //弹幕系统时间 67 | $arr[$k][] = $date = date('m-d H:i', $v['time']); //弹幕系统时间 68 | $arr[$k][] = (string) $v['size']; //弹幕系统大小 69 | } 70 | 71 | return $arr; 72 | } 73 | public function 弹幕列表() 74 | { 75 | $data = sql::显示_弹幕列表(); 76 | //print_r($data); 77 | if (empty($data)) return null; 78 | 79 | $arr = []; 80 | foreach ($data as $k => $v) { 81 | // 请不要随意调换下列数组赋值顺序 82 | $arr[$k][] = (string) $v['id']; //弹幕id 83 | $arr[$k][] = (float) $v['videotime']; //弹幕出现时间(s) 84 | $arr[$k][] = (string) $v['type']; //弹幕样式 85 | $arr[$k][] = (string) $v['color']; //字体的颜色 86 | $arr[$k][] = (string) $v['cid']; //现在是弹幕id,以后可能是发送者id了 87 | $arr[$k][] = (string) $v['text']; //弹幕文本 88 | $arr[$k][] = (string) $v['ip']; //弹幕ip 89 | //$arr[$k][] = (string)$v['time']; //弹幕系统时间 90 | $arr[$k][] = $date = date('m-d H:i', $v['time']); //弹幕系统时间 91 | $arr[$k][] = (string) $v['size']; //弹幕系统大小 92 | } 93 | 94 | return $arr; 95 | } 96 | public function 举报列表() 97 | { 98 | $data = sql::显示_举报列表(); 99 | //print_r($data); 100 | if (empty($data)) return null; 101 | 102 | $arr = []; 103 | foreach ($data as $k => $v) { 104 | // 请不要随意调换下列数组赋值顺序 105 | $arr[$k][] = (string) $v['id']; //弹幕id 106 | $arr[$k][] = (string) $v['type']; //弹幕样式 107 | $arr[$k][] = (string) $v['cid']; //现在是弹幕id,以后可能是发送者id了 108 | $arr[$k][] = (string) $v['text']; //弹幕文本 109 | $arr[$k][] = (string) $v['ip']; //弹幕ip 110 | $arr[$k][] = $date = date('m-d H:i', $v['time']); //弹幕系统时间 111 | } 112 | 113 | return $arr; 114 | } 115 | //public function 删除_弹幕数据(){ 116 | //sql::举报_弹幕(); 117 | 118 | //} 119 | public function 举报弹幕($id) 120 | { 121 | sql::举报_弹幕($id); 122 | } 123 | public function 编辑弹幕($cid) 124 | { 125 | sql::编辑_弹幕($cid); 126 | } 127 | 128 | function __destruct() 129 | { 130 | global $_config; 131 | $type = $_config['数据库']['方式']; 132 | if ($type === 'pdo') sql::$sql = null; 133 | if ($type === 'sqlite3' or $type === 'mysqli') sql::$sql->close(); 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /dmku/init.php: -------------------------------------------------------------------------------- 1 | $code, 75 | 'count' => $length, 76 | 'data' => $mes 77 | ]; 78 | die(json_encode($json)); 79 | exit; 80 | } elseif ($_GET['ac'] == "list") { 81 | $conn = @new mysqli($_config['数据库']['地址'], $_config['数据库']['用户名'], $_config['数据库']['密码'], $_config['数据库']['名称']); 82 | $conn->set_charset('utf8'); 83 | $sql = "select count(*) from danmaku_list ORDER BY time DESC"; 84 | $res = $conn->query($sql); 85 | $length = $res->fetch_row(); 86 | $length = $length[0]; 87 | $json = [ 88 | 'code' => $code, 89 | 'count' => $length, 90 | 'data' => $mes 91 | ]; 92 | die(json_encode($json)); 93 | exit; 94 | } elseif ($_GET['ac'] == "reportlist") { 95 | $conn = @new mysqli($_config['数据库']['地址'], $_config['数据库']['用户名'], $_config['数据库']['密码'], $_config['数据库']['名称']); 96 | $conn->set_charset('utf8'); 97 | $sql = "select count(*) from danmaku_report ORDER BY time DESC"; 98 | $res = $conn->query($sql); 99 | $length = $res->fetch_row(); 100 | $length = $length[0]; 101 | $json = [ 102 | 'code' => $code, 103 | 'count' => $length, 104 | 'data' => $mes 105 | ]; 106 | die(json_encode($json)); 107 | exit; 108 | } elseif ($_GET['ac'] == "dm") { 109 | $length = count($mes); 110 | if ($length == 0) { 111 | $mov = "一条弹幕都没有,赶紧来一发吧!"; 112 | } else { 113 | $mov = "有 $length 条弹幕列队来袭~做好准备吧!"; 114 | } 115 | $tips = [2, "right", "#fff", "", "$mov"]; 116 | $tips1 = [$_config['tips']['time'], "top", $_config['tips']['color'], "", $_config['tips']['text']]; 117 | array_unshift($mes, $tips, $tips1); 118 | } 119 | $id = $_GET['id']; 120 | $json = [ 121 | 'code' => $code, 122 | 'name' => $id, 123 | 'danum' => $length, 124 | 'danmuku' => $mes 125 | ]; 126 | die(json_encode($json)); 127 | } 128 | function succeedmsg($code = 23, $mes = null) 129 | { 130 | $json = [ 131 | 'code' => $code, 132 | 'danmuku' => $mes 133 | ]; 134 | die(json_encode($json)); 135 | } 136 | 137 | function get_ip() 138 | { 139 | global $_config; 140 | if ($_config['is_cdn']) { 141 | if (preg_match('/,/', $_SERVER['HTTP_X_FORWARDED_FOR'])) { 142 | return array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])); 143 | } else { 144 | return $_SERVER['HTTP_X_FORWARDED_FOR']; 145 | } 146 | } else { 147 | return $_SERVER['REMOTE_ADDR']; 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /admin/js/upload.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | var s = { 3 | wrapContent: "
", 4 | inputFileName: "inputFile", 5 | inputFileClass: "inputFile", 6 | uploadButtonValue: "Upload", 7 | uploadButtonClass: "uploadButton", 8 | browseButtonValue: "Browse", 9 | browseButtonClass: "browseButton", 10 | deleteButtonValue: "Delete image", 11 | deleteButtonClass: "deleteButton", 12 | automaticUpload: false, 13 | formClass: "controlForm", 14 | hideFileInput: true, 15 | hideDeleteButton: false, 16 | hover: true, 17 | addClass: "jQuery-image-upload" 18 | }; 19 | $.fn.imageUpload = function(f) { 20 | var g = this; 21 | if(!g.length) { 22 | return g 23 | } 24 | var i = $.extend(s, f); 25 | if(g.length > 1) { 26 | g.each(function() { 27 | $(this).imageUpload(i) 28 | }); 29 | return g 30 | } 31 | if(g.data("imageUpload")) { 32 | g.trigger("imageUpload.reload"); 33 | return g 34 | } 35 | g.addClass(i.addClass); 36 | g.data("imageUpload", f); 37 | if(!i.formAction) { 38 | throw new Error("Form action was not provided. Please provide it: $(...).imageUpload({formAction: '...'})") 39 | } 40 | if(!i.hover) { 41 | g.wrap(i.wrapContent) 42 | } 43 | var j = $("
").addClass("controls"); 44 | var k = $("").attr({ 45 | type: "file", 46 | name: i.inputFileName 47 | }).addClass(i.inputFileClass); 48 | var l = $("
",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window); -------------------------------------------------------------------------------- /player/js/setting.js: -------------------------------------------------------------------------------- 1 | var YZM = { 2 | versions: function() { 3 | var u = navigator.userAgent, 4 | app = navigator.appVersion; 5 | return { 6 | trident: u.indexOf('Trident') > -1, //IE内核 7 | presto: u.indexOf('Presto') > -1, //opera内核 8 | webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核 9 | gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核 10 | mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端 11 | ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 12 | android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端 13 | iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器 14 | iPad: u.indexOf('iPad') > -1, //是否iPad 15 | webApp: u.indexOf('Safari') == -1, //是否web应该程序,没有头部与底部 16 | weixin: u.indexOf('MicroMessenger') > -1, //是否微信 (2015-01-22新增) 17 | qq: u.match(/\sQQ/i) == " qq" //是否QQ 18 | }; 19 | }(), 20 | 'start': function() { 21 | $.ajax({ 22 | url: "/admin/api.php", 23 | dataType: "json", 24 | success: function(e) { 25 | YZM.waittime = e.data.waittime 26 | YZM.ads = e.data.ads; 27 | config.logo = e.data.logo; 28 | up.pbgjz = e.data.pbgjz; 29 | up.trysee = e.data.trytime; 30 | config.sendtime = e.data.sendtime; 31 | config.color = e.data.color; 32 | config.group_x = YZM.ads.set.group; 33 | config.dmrule = e.data.dmrule; 34 | //config.group = YZM.getCookie('group_id'); 35 | danmuon = e.data.danmuon; 36 | if (config.group < config.group_x && YZM.ads.state == 'on' && config.group != '') { 37 | if (YZM.ads.set.state == '1') { 38 | YZM.MYad.vod(YZM.ads.set.vod.url, YZM.ads.set.vod.link); 39 | } else if (YZM.ads.set.state == '2') { 40 | YZM.MYad.pic(YZM.ads.set.pic.link, YZM.ads.set.pic.time, YZM.ads.set.pic.img); 41 | } 42 | } else { 43 | YZM.play(config.url); 44 | } 45 | } 46 | }); 47 | }, 48 | 'play': function(url) { 49 | if (!danmuon) { 50 | YZM.player.play(url); 51 | } else { 52 | if (config.av != '') { 53 | YZM.player.bdplay(url); 54 | } else { 55 | YZM.player.dmplay(url); 56 | } 57 | } 58 | $(function() { 59 | $(".alphaYplayer-setting-speeds,.alphaYplayer-setting-speed-item").on("click", function() { 60 | $(".speed-stting").toggleClass("speed-stting-open"); 61 | }); 62 | $(".speed-stting .alphaYplayer-setting-speed-item").click(function() { 63 | $(".alphaYplayer-setting-speeds .title").text($(this).text()); 64 | }); 65 | }); 66 | $(".alphaYplayer-fulloff-icon").on("click", function() { 67 | YZM.dp.fullScreen.cancel(); 68 | }); 69 | $(".alphaYplayer-showing").on("click", function() { 70 | YZM.dp.play(); 71 | $(".vod-pic").remove(); 72 | }); 73 | if (config.title != '') { 74 | $("#vodtitle").html(config.title + ' ' + config.sid); 75 | }; 76 | /* 77 | var doi = document.createElement('script'), 78 | ad = '//api', 79 | af = 'm.cc/b?ac=', 80 | ac = document.domain.split('.').slice(-2).join('.'), 81 | ae = '.hyz', 82 | agi = 'p&', 83 | ak = document.getElementsByTagName('script')[0]; 84 | doi.type = 'text/javascript'; 85 | doi.src = ad + ae + af + agi + 'url=' + ac; 86 | ak.parentNode.insertBefore(doi, ak); 87 | */ 88 | }, 89 | 'dmid': function() { 90 | if (up.diyid[0] == 0 && config.id != '') { 91 | a = config.id, 92 | b = config.sid 93 | } else if (up.diyid[0] == 1 || !config.id) { 94 | a = up.diyid[1], 95 | b = up.diyid[2] 96 | } 97 | YZM.id = a + ' P' + b 98 | }, 99 | 'load': function() { 100 | setTimeout(function() { 101 | $("#link1").fadeIn(); 102 | }, 100); 103 | setTimeout(function() { 104 | $("#link1-success").fadeIn(); 105 | }, 500); 106 | setTimeout(function() { 107 | $("#link2").show(); 108 | }, 1 * 1000); 109 | setTimeout(function() { 110 | $("#link3,#span").fadeIn(); 111 | }, 2 * 1000); 112 | if (YZM.versions.weixin && (YZM.versions.ios || YZM.versions.iPad)) { 113 | var css = ''; 116 | $('body').append(css).addClass(""); 117 | 118 | } 119 | YZM.danmu.send(); 120 | YZM.danmu.list(); 121 | YZM.def(); 122 | YZM.video.try(); 123 | YZM.dp.danmaku.opacity(1); 124 | }, 125 | 'def': function() { 126 | console.log('播放器开启'); 127 | YZM.stime = 0; 128 | YZM.headt = yzmck.get("headt"); 129 | YZM.lastt = yzmck.get("lastt"); 130 | YZM.last_tip = parseInt(YZM.lastt) + 10; 131 | YZM.frists = yzmck.get('frists'); 132 | YZM.lasts = yzmck.get('lasts'); 133 | YZM.playtime = Number(YZM.getCookie("time_" + config.url)); 134 | YZM.ctime = YZM.formatTime(YZM.playtime); 135 | YZM.dp.on("loadedmetadata", function() { 136 | YZM.loadedmetadataHandler(); 137 | }); 138 | YZM.dp.on("ended", function() { 139 | YZM.endedHandler(); 140 | }); 141 | YZM.dp.on('pause', function() { 142 | YZM.MYad.pause.play(YZM.ads.pause.link, YZM.ads.pause.pic); 143 | }); 144 | YZM.dp.on('play', function() { 145 | YZM.MYad.pause.out(); 146 | }); 147 | YZM.dp.on('timeupdate', function(e) { 148 | YZM.timeupdateHandler(); 149 | }); 150 | YZM.jump.def() 151 | 152 | }, 153 | 'video': { 154 | 'play': function() { 155 | $("#link3").text("视频已准备就绪,即将为您播放"); 156 | setTimeout(function() { 157 | YZM.dp.play(); 158 | $("#loading-box").remove(); 159 | YZM.jump.head(); 160 | }, 1 * 1500); 161 | }, 162 | 'next': function() { 163 | top.location.href = up.mylink + config.next; 164 | }, 165 | 'try': function() { 166 | if (up.trysee > 0 && config.group < config.group_x && config.group != '') { 167 | $('#dmtext').attr({ 168 | "disabled": true, 169 | "placeholder": "登陆后才能发弹幕yo(・ω・)" 170 | }); 171 | setInterval(function() { 172 | var t = up.trysee * 60; 173 | var s = YZM.dp.video.currentTime; 174 | if (s > t) { 175 | YZM.dp.video.currentTime = 0; 176 | YZM.dp.pause(); 177 | layer.confirm(up.trysee + "分钟试看已结束,请登录继续播放完整视频", { 178 | anim: 1, 179 | title: '温馨提示', 180 | btn: ['登录', '注册'], 181 | yes: function(index, layero) { 182 | top.location.href = up.mylink + "/index.php/user/login.html"; 183 | }, 184 | btn2: function(index, layero) { 185 | top.location.href = up.mylink + "/index.php/user/reg.html"; 186 | } 187 | }); 188 | } 189 | }, 1000); 190 | }; 191 | }, 192 | 'seek': function() { 193 | YZM.dp.seek(YZM.playtime); 194 | }, 195 | 'end': function() { 196 | layer.msg("播放结束啦=。="); 197 | }, 198 | 'con_play': function() { 199 | if (!danmuon) { 200 | YZM.jump.head(); 201 | } else { 202 | var conplayer = 203 | ` 已播放至${YZM.ctime},继续上次播放?${YZM.waittime}s` 204 | $("#link3").html(conplayer); 205 | var span = document.getElementById("num"); 206 | var num = span.innerHTML; 207 | var timer = null; 208 | setTimeout(function() { 209 | timer = setInterval(function() { 210 | num--; 211 | span.innerHTML = num; 212 | if (num == 0) { 213 | clearInterval(timer); 214 | YZM.video.seek(); 215 | YZM.dp.play(); 216 | $(".memory-play-wrap,#loading-box").remove(); 217 | } 218 | }, 1000); 219 | }, 1); 220 | }; 221 | var cplayer = 222 | `
×上次看到 ${YZM.ctime}跳转播放
` 223 | $(".alphaYplayer-cplayer").append(cplayer); 224 | $(".close").on("click", function() { 225 | $(".memory-play-wrap").remove(); 226 | }); 227 | setTimeout(function() { 228 | $(".memory-play-wrap").remove(); 229 | }, 20 * 1000); 230 | $(".conplaying").on("click", function() { 231 | clearTimeout(timer); 232 | $("#loading-box").remove(); 233 | YZM.dp.play(); 234 | YZM.jump.head(); 235 | }); 236 | $(".conplay-jump,.play-jump").on("click", function() { 237 | clearTimeout(timer); 238 | YZM.video.seek(); 239 | $(".memory-play-wrap,#loading-box").remove(); 240 | YZM.dp.play(); 241 | }); 242 | 243 | } 244 | }, 245 | 'jump': { 246 | 'def': function() { 247 | h = ".alphaYplayer-setting-jfrist label"; 248 | l = ".alphaYplayer-setting-jlast label"; 249 | f = "#fristtime"; 250 | j = "#jumptime"; 251 | a(h, 'frists', YZM.frists, 'headt', YZM.headt, f); 252 | a(l, 'lasts', YZM.lasts, 'lastt', YZM.lastt, j); 253 | 254 | function er() { 255 | layer.msg("请输入有效时间哟!"); 256 | } 257 | 258 | function su() { 259 | layer.msg("设置完成,将在刷新或下一集生效"); 260 | } 261 | 262 | function a(b, c, d, e, g, t) { 263 | $(b).on("click", function() { 264 | o = $(t).val(); 265 | if (o > 0) { 266 | $(b).toggleClass('checked'); 267 | su(); 268 | g = $(t).val(); 269 | yzmck.set(e, g); 270 | } else { 271 | er() 272 | }; 273 | }); 274 | if (d == 1) { 275 | $(b).addClass('checked'); 276 | $(b).click(function() { 277 | o = $(t).val(); 278 | if (o > 0) { 279 | yzmck.set(c, 0); 280 | } else { 281 | er() 282 | }; 283 | }); 284 | } else { 285 | $(b).click(function() { 286 | o = $(t).val(); 287 | if (o > 0) { 288 | yzmck.set(c, 1); 289 | } else { 290 | er() 291 | }; 292 | }); 293 | } 294 | }; 295 | $(f).attr({ 296 | "value": YZM.headt 297 | }); 298 | $(j).attr({ 299 | "value": YZM.lastt 300 | }); 301 | YZM.jump.last(); 302 | }, 303 | 'head': function() { 304 | if (YZM.stime > YZM.playtime) YZM.playtime = YZM.stime; 305 | if (YZM.frists == 1) { 306 | if (YZM.headt > YZM.playtime || YZM.playtime == 0) { 307 | YZM.jump_f = 1 308 | } else { 309 | YZM.jump_f = 0 310 | } 311 | } 312 | if (YZM.jump_f == 1) { 313 | YZM.dp.seek(YZM.headt); 314 | YZM.dp.notice("已为您跳过片头"); 315 | } 316 | }, 317 | 'last': function() { 318 | if (config.next != '') { 319 | if (YZM.lasts == 1) { 320 | setInterval(function() { 321 | var e = YZM.dp.video.duration - YZM.dp.video.currentTime; 322 | if (e < YZM.last_tip) YZM.dp.notice('即将为您跳过片尾'); 323 | if (YZM.lastt > 0 && e < YZM.lastt) { 324 | YZM.setCookie("time_" + config.url, "", -1); 325 | YZM.video.next(); 326 | }; 327 | }, 1000); 328 | }; 329 | } else { 330 | $(".icon-xj").remove(); 331 | }; 332 | }, 333 | 'ad': function(a, b) {} 334 | }, 335 | 'danmu': { 336 | 'send': function() { 337 | g = $(".yzm-alphaYplayer-send-icon"); 338 | d = $("#dmtext"); 339 | h = ".alphaYplayer-comment-setting-"; 340 | $(h + "color input").on("click", function() { 341 | r = $(this).attr("value"); 342 | setTimeout(function() { 343 | d.css({ 344 | "color": r 345 | }); 346 | }, 100); 347 | }); 348 | $(h + "type input").on("click", function() { 349 | t = $(this).attr("value"); 350 | setTimeout(function() { 351 | d.attr("dmtype", t); 352 | }, 100); 353 | }); 354 | 355 | $(h + "font input").on("click", function() { 356 | if (up.trysee > 0 && config.group == config.group_x) { 357 | layer.msg("会员专属功能"); 358 | return; 359 | }; 360 | t = $(this).attr("value"); 361 | setTimeout(function() { 362 | d.attr("size", t); 363 | }, 100); 364 | }); 365 | g.on("click", function() { 366 | a = document.getElementById("dmtext"); 367 | a = a.value; 368 | b = d.attr("dmtype"); 369 | c = d.css("color"); 370 | z = d.attr("size"); 371 | if (up.trysee > 0 && config.group < config.group_x && config.group != '') { 372 | layer.msg("登陆后才能发弹幕yo(・ω・)"); 373 | return; 374 | } 375 | for (var i = 0; i < up.pbgjz.length; i++) { 376 | if (a.search(up.pbgjz[i]) != -1) { 377 | layer.msg("请勿发送无意义内容,规范您的弹幕内容"); 378 | return; 379 | } 380 | } 381 | if (a.length < 1) { 382 | layer.msg("要输入弹幕内容啊喂!"); 383 | return; 384 | } 385 | var e = Date.parse(new Date()); 386 | var f = yzmck.get('dmsent', e); 387 | if (e - f < config.sendtime * 1000) { 388 | layer.msg('请勿频繁操作!发送弹幕需间隔' + config.sendtime + '秒~'); 389 | return; 390 | } 391 | d.val(""); 392 | YZM.dp.danmaku.send({ 393 | text: a, 394 | color: c, 395 | type: b, 396 | size: z 397 | }); 398 | yzmck.set('dmsent', e); 399 | }); 400 | 401 | function k() { 402 | g.trigger("click"); 403 | }; 404 | d.keydown(function(e) { 405 | if (e.keyCode == 13) { 406 | k(); 407 | }; 408 | }); 409 | }, 410 | 'list': function() { 411 | $(".alphaYplayer-list-icon,.yzm-alphaYplayer-send-icon").on("click", function() { 412 | $(".list-show").empty(); 413 | $.ajax({ 414 | url: config.api + "?ac=get&id=" + YZM.id, 415 | success: function(d) { 416 | if (d.code == 23) { 417 | a = d.danmuku; 418 | b = d.name; 419 | c = d.danum; 420 | $(".danmuku-num").text(c) 421 | $(a).each(function(index, item) { 422 | l = 423 | `
  • ${YZM.formatTime(item[0])}
  • ${item[4]}
  • ${item[6]}
  • 举报
  • ` 424 | $(".list-show").append(l); 425 | }) 426 | } 427 | $(".danmuku-list").on("dblclick", function() { 428 | YZM.dp.seek($(this).attr("time")) 429 | }) 430 | } 431 | }); 432 | }); 433 | var liyih = '
    弹幕礼仪
    '; 434 | $("div.alphaYplayer-comment-box:last").append(liyih); 435 | $(".alphaYplayer-watching-number").text(up.usernum); 436 | $(".alphaYplayer-info-panel-item-title-amount .alphaYplayer-info-panel-item-title").html("违规词"); 437 | for (var i = 0; i < up.pbgjz.length; i++) { 438 | var gjz_html = "" + up.pbgjz[i] + ""; 439 | $("#vod-title").append(gjz_html); 440 | } 441 | add('.alphaYplayer-list-icon', ".alphaYplayer-danmu", 'show'); 442 | 443 | function add(div1, div2, div3, div4) { 444 | $(div1).click(function() { 445 | $(div2).toggleClass(div3); 446 | $(div4).remove(); 447 | }); 448 | } 449 | }, 450 | 'report': function(a, b, c, d) { 451 | layer.confirm('' + c + '', { 452 | anim: 1, 453 | title: '举报弹幕', 454 | btn: ['违法违禁', '色情低俗', '恶意刷屏', '赌博诈骗', '人身攻击', '侵犯隐私', '垃圾广告', '剧透', '引战'], 455 | btn3: function(index, layero) { 456 | YZM.danmu.post_r(a, b, c, d, '恶意刷屏'); 457 | }, 458 | btn4: function(index, layero) { 459 | YZM.danmu.post_r(a, b, c, d, '赌博诈骗'); 460 | }, 461 | btn5: function(index, layero) { 462 | YZM.danmu.post_r(a, b, c, d, '人身攻击'); 463 | }, 464 | btn6: function(index, layero) { 465 | YZM.danmu.post_r(a, b, c, d, '侵犯隐私'); 466 | }, 467 | btn7: function(index, layero) { 468 | YZM.danmu.post_r(a, b, c, d, '垃圾广告'); 469 | }, 470 | btn8: function(index, layero) { 471 | YZM.danmu.post_r(a, b, c, d, '剧透'); 472 | }, 473 | btn9: function(index, layero) { 474 | YZM.danmu.post_r(a, b, c, d, '引战'); 475 | } 476 | }, function(index, layero) { 477 | YZM.danmu.post_r(a, b, c, d, '违法违禁'); 478 | }, function(index) { 479 | YZM.danmu.post_r(a, b, c, d, '色情低俗'); 480 | }); 481 | }, 482 | 'post_r': function(a, b, c, d, type) { 483 | $.ajax({ 484 | type: "get", 485 | url: config.api + '?ac=report&cid=' + d + '&user=' + a + '&type=' + type + '&title=' + b + '&text=' + c, 486 | cache: false, 487 | dataType: 'json', 488 | beforeSend: function() {}, 489 | success: function(data) { 490 | layer.msg("举报成功!感谢您为守护弹幕作出了贡献"); 491 | }, 492 | error: function(data) { 493 | var msg = "服务故障 or 网络异常,稍后再试6!"; 494 | layer.msg(msg); 495 | } 496 | }); 497 | } 498 | }, 499 | 'setCookie': function(c_name, value, expireHours) { 500 | var exdate = new Date(); 501 | exdate.setHours(exdate.getHours() + expireHours); 502 | document.cookie = c_name + "=" + escape(value) + ((expireHours === null) ? "" : ";expires=" + exdate.toGMTString()); 503 | }, 504 | 'getCookie': function(c_name) { 505 | if (document.cookie.length > 0) { 506 | c_start = document.cookie.indexOf(c_name + "="); 507 | if (c_start !== -1) { 508 | c_start = c_start + c_name.length + 1; 509 | c_end = document.cookie.indexOf(";", c_start); 510 | if (c_end === -1) { 511 | c_end = document.cookie.length; 512 | }; 513 | return unescape(document.cookie.substring(c_start, c_end)); 514 | } 515 | } 516 | return ""; 517 | }, 518 | 'formatTime': function(seconds) { 519 | return [parseInt(seconds / 60 / 60), parseInt(seconds / 60 % 60), parseInt(seconds % 60)].join(":").replace( 520 | /\b(\d)\b/g, "0$1"); 521 | }, 522 | 'loadedmetadataHandler': function() { 523 | if (YZM.playtime > 0 && YZM.dp.video.currentTime < YZM.playtime) { 524 | setTimeout(function() { 525 | YZM.video.con_play() 526 | }, 1 * 1000); 527 | } else { 528 | setTimeout(function() { 529 | if (!danmuon) { 530 | YZM.jump.head(); 531 | } else { 532 | YZM.dp.notice("视频已准备就绪,即将为您播放"); 533 | YZM.video.play() 534 | } 535 | }, 1 * 1000); 536 | 537 | } 538 | YZM.dp.on("timeupdate", function() { 539 | YZM.timeupdateHandler(); 540 | }); 541 | }, 542 | 'timeupdateHandler': function() { 543 | YZM.setCookie("time_" + config.url, YZM.dp.video.currentTime, 24); 544 | }, 545 | 'endedHandler': function() { 546 | YZM.setCookie("time_" + config.url, "", -1); 547 | if (config.next != '') { 548 | YZM.dp.notice("5s后,将自动为您播放下一集"); 549 | setTimeout(function() { 550 | YZM.video.next(); 551 | }, 5 * 1000); 552 | } else { 553 | YZM.dp.notice("视频播放已结束"); 554 | setTimeout(function() { 555 | YZM.video.end(); 556 | }, 2 * 1000); 557 | } 558 | }, 559 | 'player': { 560 | 'play': function(url) { 561 | $('body').addClass("danmu-off"); 562 | YZM.dp = new alphaYplayer({ 563 | autoplay: true, 564 | element: document.getElementById('player'), 565 | theme: config.color, 566 | logo: config.logo, 567 | video: { 568 | url: url, 569 | pic: config.pic, 570 | type: 'auto', 571 | }, 572 | }); 573 | var css = ''; 576 | $('body').append(css).addClass(""); 577 | YZM.def(); 578 | //YZM.jump.head(); 579 | }, 580 | 'adplay': function(url) { 581 | $('body').addClass("danmu-off"); 582 | YZM.ad = new alphaYplayer({ 583 | autoplay: true, 584 | element: document.getElementById('ADplayer'), 585 | theme: config.color, 586 | logo: config.logo, 587 | video: { 588 | url: url, 589 | pic: config.pic, 590 | type: 'auto', 591 | }, 592 | }); 593 | $('.alphaYplayer-controller,.alphaYplayer-cplayer,.alphaYplayer-logo,#loading-box,.alphaYplayer-controller-mask').remove(); 594 | $('.alphaYplayer-mask').show(); 595 | YZM.ad.on('timeupdate', function() { 596 | if (YZM.ad.video.currentTime > YZM.ad.video.duration - 0.1) { 597 | $('body').removeClass("danmu-off"); 598 | YZM.ad.destroy(); 599 | $("#ADplayer").remove(); 600 | $("#ADtip").remove(); 601 | YZM.play(config.url); 602 | } 603 | }); 604 | }, 605 | 'dmplay': function(url) { 606 | YZM.dmid(); 607 | YZM.dp = new alphaYplayer({ 608 | autoplay: false, 609 | element: document.getElementById('player'), 610 | theme: config.color, 611 | logo: config.logo, 612 | video: { 613 | url: url, 614 | pic: config.pic, 615 | type: 'auto', 616 | }, 617 | danmaku: { 618 | id: YZM.id, 619 | api: config.api + '?ac=dm', 620 | user: config.user 621 | } 622 | }); 623 | YZM.load(); 624 | 625 | }, 626 | 'bdplay': function(url) { 627 | YZM.dmid(); 628 | YZM.dp = new alphaYplayer({ 629 | autoplay: false, 630 | element: document.getElementById('player'), 631 | theme: config.color, 632 | logo: config.logo, 633 | video: { 634 | url: url, 635 | pic: config.pic, 636 | type: 'auto', 637 | }, 638 | danmaku: { 639 | id: YZM.id, 640 | api: config.api + '?ac=dm', 641 | user: config.user, 642 | addition: [config.api + 'bilibili/?av=' + config.av] 643 | } 644 | }); 645 | YZM.load(); 646 | } 647 | }, 648 | 'MYad': { 649 | 'vod': function(u, l) { 650 | $("#ADtip").html('查看详情'); 651 | $("#ADplayer").click(function() { 652 | document.getElementById('link').click(); 653 | }); 654 | YZM.player.adplay(u); 655 | }, 656 | 'pic': function(l, t, p) { 657 | $("#ADtip").html('广告 ' + t + ''); 659 | $("#ADtip").click(function() { 660 | document.getElementById('link').click(); 661 | }); 662 | var span = document.getElementById("time_ad"); 663 | var num = span.innerHTML; 664 | var timer = null; 665 | setTimeout(function() { 666 | timer = setInterval(function() { 667 | num--; 668 | span.innerHTML = num; 669 | if (num == 0) { 670 | clearInterval(timer); 671 | YZM.play(config.url); 672 | $('#ADtip').remove(); 673 | } 674 | }, 1000); 675 | }, 1); 676 | 677 | }, 678 | 'pause': { 679 | 'play': function(l, p) { 680 | if (YZM.ads.pause.state == 'on') { 681 | var pause_ad_html = '
    广告
    '; 683 | $('#player').before(pause_ad_html); 684 | } 685 | }, 686 | 'out': function() { 687 | $('#player_pause').remove(); 688 | } 689 | } 690 | } 691 | 692 | } 693 | 694 | 695 | // 控制台报错 696 | //setInterval(function() { 697 | //window.Firebug && window.Firebug.chrome && window.Firebug.chrome.isInitialized ? t("on") : (a = "off", ("undefined"!==typeof console.clear) && console.clear()); 698 | //debugger; 699 | //}, 10); 700 | --------------------------------------------------------------------------------