Skip to content

Commit

Permalink
change address detect method
Browse files Browse the repository at this point in the history
  • Loading branch information
zacyu committed Dec 4, 2015
1 parent 40fa5eb commit 16b567c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ function resolvePlaybackLink(avPlaybackLink, callback) {
return false;
}
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("HEAD", avPlaybackLink.durl[0].url, true);
xmlhttp.open("GET", avPlaybackLink.durl[0].url, true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.readyState == 2) {
var url = xmlhttp.responseURL || avPlaybackLink.durl[0].url;
var videoHost = new URL(url).origin + '/*';
if (videoPlaybackHosts.indexOf(videoHost) < 0) {
Expand All @@ -209,6 +209,7 @@ function resolvePlaybackLink(avPlaybackLink, callback) {
}
avPlaybackLink.durl[0].url = url;
if (typeof callback == "function") callback(avPlaybackLink);
xmlhttp.abort();
}
}
xmlhttp.send();
Expand Down
12 changes: 7 additions & 5 deletions template.html
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,13 @@

<script type="text/javascript" src="http://static.hdslb.com/tag/js/tag.core.js"></script>
<script type="text/javascript" src="http://static.hdslb.com/tag/js/manage.tag.js"></script>
<script src="http://interface.bilibili.com/count?aid=%aid%&mid=%mid%" type="text/javascript" language="javascript"></script>
<script src="http://interface.bilibili.com/count?aid=%avid%&mid=%mid%" type="text/javascript" language="javascript"></script>
<script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<script language="javascript">
var aid='%avid%';var typeid='%tid%';var mid='%mid%';var pageno = '%page%';var totalpage = '1';var wb_title='%title%';var wb_desc = '%title% 分享自#哔哩哔哩助手#播放页';var wb_info='%title% 分享自#哔哩哔哩助手#播放页';var wb_url='http://www.bilibili.com/video/av%avid%/';var wb_full_url='http://www.bilibili.com/video/av%avid%/';var wb_img='%pic%';var spid = %spid%;
var aid='%avid%';var typeid='%tid%';var mid='%mid%';var pageno = '%page%';var totalpage = '1';var wb_title='%title%';var wb_desc = '%title% 分享自#哔哩哔哩助手#播放页';var wb_info='%title% 分享自#哔哩哔哩助手#播放页';var wb_url='http://www.bilibili.com/video/av%avid%/';var wb_full_url='http://www.bilibili.com/video/av%avid%/';var wb_img='%pic%';

var spid = parseInt('%spid%');
var isSpFav="0";
var isSpAtt="0";

Expand All @@ -583,8 +585,8 @@
upUid: mid,
allowAdd: 1
});
loadHTML5(%avid%,%page%);
kwtags(%tags%,[]);
loadHTML5(parseInt(aid),parseInt(pageno));
kwtags(JSON.parse('%tags%'),[]);
lrurl();
if (spid) {
if (window.AttentionList) {
Expand All @@ -597,7 +599,7 @@
}
}
showSpAdbtn();
new bbBangumiSp(aid, spid, %season_id%, "%sp_title_uri%", pageno, 1);
new bbBangumiSp(aid, spid, parseInt('%season_id%'), "%sp_title_uri%", pageno, 1);
showSpAdbtn(isSpFav);
VideoPart.collapse(pageno);
lrurl();
Expand Down

0 comments on commit 16b567c

Please sign in to comment.