Skip to content

Commit

Permalink
美化 添加屏蔽弹幕
Browse files Browse the repository at this point in the history
  • Loading branch information
haocity committed Feb 28, 2018
1 parent e030703 commit 1624fd3
Show file tree
Hide file tree
Showing 5 changed files with 19,309 additions and 24 deletions.
3 changes: 1 addition & 2 deletions dist/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ if(info) {
pageInfo.videoId=e.danmakuId;
window.cid = pageInfo.videoId;
if(e.sourceType == 'zhuzhan') {
document.querySelector('#player').innerHTML = null;
tdvidplay({
ele: '#player',
vid: e.danmakuId,
Expand All @@ -46,7 +45,7 @@ if(info) {
})
} else if(e.sourceType == 'youku') {
//优酷规则
document.querySelector('#player').innerHTML = null;

tdvidplay({
ele: '#player',
ab: true,
Expand Down
19,272 changes: 19,271 additions & 1 deletion dist/tdplayer.js

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions src/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ const html = {
</div>
<ul class="tp-rightmenu">
<li class="tp-copy-warp">
<textarea rows="1" class="tp-copy-input">复制弹幕</textarea>
<a class="tp-copy-t">复制</a>
<textarea rows="1" class="tp-copy-input">弹幕</textarea>
</li>
<li class="tp-search-user"></li>
<li class="tp-speend-con">播放速度
<li class="tp-speend-con"><a>播放速度 正常</a>
<ul class="tp-speend">
<li>0.5</li>
<li>0.75</li>
Expand All @@ -22,9 +23,10 @@ const html = {
</li>
<li class="tp-definition">清晰度 <span></span></li>
<li class="tp-ratio">视频比例 默认</li>
<li class="tp-screenshot">截图</li>
<a href="https://github.com/haocity/tdplayer/issues" target="_blank">
<li>意见反馈</li></a>
<li>
<a class="tp-screenshot">截图</a>
<a href="https://github.com/haocity/tdplayer/issues" target="_blank">意见反馈</a>
</li>
<a href="https://github.com/haocity/tdplayer" target="_blank">
<li>About tdplayer</li></a>
</ul>
Expand Down
36 changes: 23 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ window.tdvidplay = function(options) {
}
})
}else{
xhr("https://api.haotown.cn/pyapi/vid/" + options.vid).then(t => JSON.parse(t)).then(function(json) {
fetch("https://api.haotown.cn/pyapi/vid/" + options.vid).then(function(t) {
return t.json();
}).then(function(json) {
let vobj = new Object
let vv
for(let i = 0; i < json.stream.length; i++) {
Expand Down Expand Up @@ -168,22 +170,20 @@ window.tdvidplay = function(options) {
acvid: options.vid,
ab:options.ab
});
} else {
if(document.querySelector(".noflash-alert")) {
document.querySelector(".noflash-alert").style.display = "block";
}
try {
}
}).catch((e)=>{
console.log('解析失败',e)
if(document.querySelector(".noflash-alert")) {
document.querySelector(".noflash-alert").style.display = "block";
}
try {
$c('object')[0].style.display = 'block'
e.style.display = 'none'
document.querySelector('.tp-loding').style.display = 'none'
document.querySelector('.tp-img-back').style.display = 'none'
$.info.error('替换失败 本视频不支持')
backimg.style.display = 'none'
acflash.style.display = 'block'
} catch(e) {
} catch(e) {
console.log('本视频不支持')
}
}


})
}

Expand Down Expand Up @@ -1081,14 +1081,17 @@ class Tplayer {
for(let i = 0; i < _this.videoelearr.length; i++) {
_this.videoelearr[i].playbackRate = t;
}
_this.ele.tp_speend_con.querySelector('a').innerHTML="播放速度 "+this.innerHTML
};
} else {
e.onclick = function() {
for(let i = 0; i < _this.videoelearr.length; i++) {
_this.videoelearr[i].playbackRate = 1;
}
_this.ele.tp_speend_con.querySelector('a').innerHTML="播放速度 "+this.innerHTML
};
}

}
//视频比例设置
this.ele.video_ratio.ratio = 1;
Expand Down Expand Up @@ -1961,6 +1964,13 @@ class Tplayer {
if(target.user) {
this.ele.searchuser.style.display = 'block';
this.ele.searchuser.innerHTML = `<a href="http://www.acfun.cn/u/${target.user}.aspx#page=1" target="_blank">查询发送者</a>`
let p=document.createElement('a')
p.style.marginLeft='10px'
p.innerHTML='屏蔽'
p.onclick=function(){
target.parentNode.removeChild(target)
}
this.ele.searchuser.appendChild(p)
}
this.ele.copytext.innerHTML = target.innerHTML;
this.ele.copy.style.display = "block";
Expand Down
10 changes: 7 additions & 3 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ section.player{
.tp-rightmenu li {
padding: 2px 0 2px 8px;
cursor: pointer;
position: relative;
}
.tp-rightmenu li:hover {
padding-left: 7px;
Expand All @@ -733,7 +734,9 @@ ul.tp-speend {
display: none;
margin: 4px 0 4px 30px;
}

.tp-copy-t{
position: absolute;
}
.tp-copy-input{
display: block;
width: 100%;
Expand All @@ -746,10 +749,11 @@ ul.tp-speend {
color: #fff;
resize: none;
cursor: pointer;
font-size: 15px;
line-height: 21px;
font-size: 14px;
line-height: 23px;
overflow:hidden;
font-family: Avenir Next,Helvetica,Arial,Lantinghei SC,Microsoft YaHei,sans-serif;
padding-left: 29px;
}
.tp-control-alltime-phone{
display: none;
Expand Down

0 comments on commit 1624fd3

Please sign in to comment.