Skip to content

Commit

Permalink
0.8.16.18
Browse files Browse the repository at this point in the history
fix bugs
  • Loading branch information
Ruo committed Mar 9, 2017
1 parent dfbcaf7 commit 9512c27
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 87 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bilibili_helper.zip
node_modules/
dest/
.vscode/launch.json
136 changes: 68 additions & 68 deletions src/bilibili_injected.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,23 +230,23 @@
}
//biliHelper.mainBlock.downloaderSection.find('p').append($('<a class="b-btn" target="_blank" href="http://bilibili.audio/' + biliHelper.avid + '/' + biliHelper.page + '"></a>').text('抽出并下载音频'));
}
if (biliHelper.playbackUrls && biliHelper.playbackUrls.length == 1) {
biliHelper.mainBlock.switcherSection.find('a[type="html5"]').removeClass('hidden');
}
$('#loading-notice').fadeOut(300);
if (biliHelper.favorHTML5 && localStorage.getItem('bilimac_player_type') != 'force' && biliHelper.cid && biliHelper.playbackUrls && biliHelper.playbackUrls.length == 1 && biliHelper.playbackUrls[0].url.indexOf('m3u8') < 0) {
$('#loading-notice').fadeOut(300, function() {
biliHelper.switcher.html5();
});
} else if (biliHelper.replacePlayer) {
$('#loading-notice').fadeOut(300, function() {
biliHelper.switcher.swf();
});
} else {
$('#loading-notice').fadeOut(300, function() {
biliHelper.switcher.original();
});
}
// if (biliHelper.playbackUrls && biliHelper.playbackUrls.length == 1) {
// biliHelper.mainBlock.switcherSection.find('a[type="html5"]').removeClass('hidden');
// }
// $('#loading-notice').fadeOut(300);
// if (biliHelper.favorHTML5 && localStorage.getItem('bilimac_player_type') != 'force' && biliHelper.cid && biliHelper.playbackUrls && biliHelper.playbackUrls.length == 1 && biliHelper.playbackUrls[0].url.indexOf('m3u8') < 0) {
// $('#loading-notice').fadeOut(300, function() {
// biliHelper.switcher.html5();
// });
// } else if (biliHelper.replacePlayer) {
// $('#loading-notice').fadeOut(300, function() {
// biliHelper.switcher.swf();
// });
// } else {
// $('#loading-notice').fadeOut(300, function() {
// biliHelper.switcher.original();
// });
// }
});
}

Expand Down Expand Up @@ -309,8 +309,8 @@
biliHelper.switcher = {
current: "original",
set: function(newMode) {
biliHelper.mainBlock.switcherSection.find('a.b-btn[type="' + this.current + '"]').addClass('w');
biliHelper.mainBlock.switcherSection.find('a.b-btn[type="' + newMode + '"]').removeClass('w');
// biliHelper.mainBlock.switcherSection.find('a.b-btn[type="' + this.current + '"]').addClass('w');
// biliHelper.mainBlock.switcherSection.find('a.b-btn[type="' + newMode + '"]').removeClass('w');
this.current = newMode;
},
original: function() {
Expand Down Expand Up @@ -420,22 +420,22 @@
biliHelper.mainBlock.dblclick(function(e) {
if (e.shiftKey) biliHelper.mainBlock.infoSection.toggleClass('hidden');
});
if (biliHelper.redirectUrl && biliHelper.redirectUrl != "undefined") {
biliHelper.mainBlock.redirectSection = $('<div class="section redirect"><h3>生成页选项</h3><p><a class="b-btn w" href="' + biliHelper.redirectUrl + '">前往原始跳转页</a></p></div>');
biliHelper.mainBlock.append(biliHelper.mainBlock.redirectSection);
}
biliHelper.mainBlock.switcherSection = $('<div class="section switcher"><h3>播放器切换</h3><p></p></div>');
biliHelper.mainBlock.switcherSection.find('p').append($('<a class="b-btn w" type="original">原始播放器</a><a class="b-btn w hidden" type="bilimac">Mac 客户端</a><a class="b-btn w hidden" type="swf">SWF 播放器</a><a class="b-btn w hidden" type="iframe">Iframe 播放器</a><a class="b-btn w hidden" type="html5">HTML5 播放器</a>').click(function() {
biliHelper.switcher[$(this).attr('type')]();
}));
if (biliHelper.redirectUrl) {
biliHelper.mainBlock.switcherSection.find('a[type="original"]').addClass('hidden');
biliHelper.mainBlock.switcherSection.find('a[type="swf"],a[type="iframe"]').removeClass('hidden');
}
if (localStorage.getItem('bilimac_player_type')) {
biliHelper.mainBlock.switcherSection.find('a[type="bilimac"]').removeClass('hidden');
}
biliHelper.mainBlock.append(biliHelper.mainBlock.switcherSection);
// if (biliHelper.redirectUrl && biliHelper.redirectUrl != "undefined") {
// biliHelper.mainBlock.redirectSection = $('<div class="section redirect"><h3>生成页选项</h3><p><a class="b-btn w" href="' + biliHelper.redirectUrl + '">前往原始跳转页</a></p></div>');
// biliHelper.mainBlock.append(biliHelper.mainBlock.redirectSection);
// }
// biliHelper.mainBlock.switcherSection = $('<div class="section switcher"><h3>播放器切换</h3><p></p></div>');
// biliHelper.mainBlock.switcherSection.find('p').append($('<a class="b-btn w" type="original">原始播放器</a><a class="b-btn w hidden" type="bilimac">Mac 客户端</a><a class="b-btn w hidden" type="swf">SWF 播放器</a><a class="b-btn w hidden" type="iframe">Iframe 播放器</a><a class="b-btn w hidden" type="html5">HTML5 播放器</a>').click(function() {
// biliHelper.switcher[$(this).attr('type')]();
// }));
// if (biliHelper.redirectUrl) {
// biliHelper.mainBlock.switcherSection.find('a[type="original"]').addClass('hidden');
// biliHelper.mainBlock.switcherSection.find('a[type="swf"],a[type="iframe"]').removeClass('hidden');
// }
// if (localStorage.getItem('bilimac_player_type')) {
// biliHelper.mainBlock.switcherSection.find('a[type="bilimac"]').removeClass('hidden');
// }
// biliHelper.mainBlock.append(biliHelper.mainBlock.switcherSection);
biliHelper.mainBlock.downloaderSection = $('<div class="section downloder"><h3>视频下载</h3><p><span></span>视频地址获取中,请稍等…</p></div>');
biliHelper.mainBlock.append(biliHelper.mainBlock.downloaderSection);
biliHelper.mainBlock.querySection = $('<div class="section query"><h3>弹幕发送者查询</h3><p><span></span>正在加载全部弹幕, 请稍等…</p></div>');
Expand All @@ -459,39 +459,39 @@
if (localStorage.getItem('bilimac_player_type') == 'force') {
biliHelper.switcher.set('bilimac');
}
if (!biliHelper.genPage && biliHelper.replaceEnabled && localStorage.getItem('bilimac_player_type') != 'force' &&
(($('#bofqi object').length > 0 && $('#bofqi object').attr('data') != 'http://static.hdslb.com/play.swf' && $('#bofqi object').attr('data') != 'https://static-s.bilibili.com/play.swf' && $('#bofqi object').attr('data') != 'http://static.hdslb.com/letv.swf' && $('#bofqi object').attr('data') != 'http://static.hdslb.com/play_old.swf')&& $('#bofqi object').attr('data') != 'http://static.hdslb.com/play196.swf' ||
($('#bofqi embed').length > 0 && $('#bofqi embed').attr('src') != 'http://static.hdslb.com/play.swf' && $('#bofqi embed').attr('src') != 'https://static-s.bilibili.com/play.swf' && $('#bofqi embed').attr('src') != 'http://static.hdslb.com/letv.swf' && $('#bofqi embed').attr('src') != 'http://static.hdslb.com/play_old.swf') && $('#bofqi embed').attr('data') != 'http://static.hdslb.com/play196.swf' ||
($('#bofqi iframe').length > 0 && ($('#bofqi iframe').attr('src').indexOf('bilibili.com') < 0 || $('#bofqi iframe').attr('src').indexOf('iqiyi') > 0)) || ($('#bofqi object').length + $('#bofqi embed').length + $('#bofqi iframe').length == 0))) {
biliHelper.replacePlayer = true;
biliHelper.mainBlock.switcherSection.find('a[type="iframe"],a[type="swf"]').removeClass('hidden');
} else {
biliHelper.replacePlayer = false;
}
if (!biliHelper.genPage && biliHelper.favorHTML5) {
$('#bofqi').html('<div id="player_placeholder" class="player"></div>');
$('#bofqi').find('#player_placeholder').css({
background: 'url(' + biliHelper.videoPic + ') 50% 50% / cover no-repeat',
'-webkit-filter': 'blur(20px)',
overflow: 'hidden',
visibility: 'visible'
});
}
if (biliHelper.replacePlayer || biliHelper.favorHTML5 && localStorage.getItem('bilimac_player_type') != 'force' && !biliHelper.genPage) {
var replaceNotice = $('<div id="loading-notice">正在尝试替换播放器…<span id="cancel-replacing">取消</span></div>');
replaceNotice.find('#cancel-replacing').click(function() {
$('#loading-notice').fadeOut(300);
if (biliHelper.favorHTML5) {
if (biliHelper.replacePlayer && !biliHelper.redirectUrl && !biliHelper.genPage) {
biliHelper.switcher.swf();
} else {
biliHelper.switcher.original();
}
biliHelper.favorHTML5 = false;
}
});
$('#bofqi').append(replaceNotice);
}
// if (!biliHelper.genPage && biliHelper.replaceEnabled && localStorage.getItem('bilimac_player_type') != 'force' &&
// (($('#bofqi object').length > 0 && $('#bofqi object').attr('data') != 'http://static.hdslb.com/play.swf' && $('#bofqi object').attr('data') != 'https://static-s.bilibili.com/play.swf' && $('#bofqi object').attr('data') != 'http://static.hdslb.com/letv.swf' && $('#bofqi object').attr('data') != 'http://static.hdslb.com/play_old.swf')&& $('#bofqi object').attr('data') != 'http://static.hdslb.com/play196.swf' ||
// ($('#bofqi embed').length > 0 && $('#bofqi embed').attr('src') != 'http://static.hdslb.com/play.swf' && $('#bofqi embed').attr('src') != 'https://static-s.bilibili.com/play.swf' && $('#bofqi embed').attr('src') != 'http://static.hdslb.com/letv.swf' && $('#bofqi embed').attr('src') != 'http://static.hdslb.com/play_old.swf') && $('#bofqi embed').attr('data') != 'http://static.hdslb.com/play196.swf' ||
// ($('#bofqi iframe').length > 0 && ($('#bofqi iframe').attr('src').indexOf('bilibili.com') < 0 || $('#bofqi iframe').attr('src').indexOf('iqiyi') > 0)) || ($('#bofqi object').length + $('#bofqi embed').length + $('#bofqi iframe').length == 0))) {
// biliHelper.replacePlayer = true;
// biliHelper.mainBlock.switcherSection.find('a[type="iframe"],a[type="swf"]').removeClass('hidden');
// } else {
biliHelper.replacePlayer = false;
// }
// if (!biliHelper.genPage && biliHelper.favorHTML5) {
// $('#bofqi').html('<div id="player_placeholder" class="player"></div>');
// $('#bofqi').find('#player_placeholder').css({
// background: 'url(' + biliHelper.videoPic + ') 50% 50% / cover no-repeat',
// '-webkit-filter': 'blur(20px)',
// overflow: 'hidden',
// visibility: 'visible'
// });
// }
// if (biliHelper.replacePlayer || biliHelper.favorHTML5 && localStorage.getItem('bilimac_player_type') != 'force' && !biliHelper.genPage) {
// var replaceNotice = $('<div id="loading-notice">正在尝试替换播放器…<span id="cancel-replacing">取消</span></div>');
// replaceNotice.find('#cancel-replacing').click(function() {
// $('#loading-notice').fadeOut(300);
// if (biliHelper.favorHTML5) {
// if (biliHelper.replacePlayer && !biliHelper.redirectUrl && !biliHelper.genPage) {
// biliHelper.switcher.swf();
// } else {
// biliHelper.switcher.original();
// }
// biliHelper.favorHTML5 = false;
// }
// });
// $('#bofqi').append(replaceNotice);
// }

biliHelper.work = function() {
chrome.extension.sendMessage({
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"options_page": "options.html",
"permissions": [ "downloads", "alarms", "contextMenus", "cookies", "notifications", "storage", "tabs", "webRequest", "webRequestBlocking", "http://*/", "https://*/" ],
"update_url": "https://clients2.google.com/service/update2/crx",
"version": "0.8.16.17",
"version": "0.8.16.18",
"content_security_policy":"script-src 'unsafe-eval'; object-src 'self'",
"web_accessible_resources": [ "bilibili-helper.woff", "template.html", "imgs/icon-32.png", "imgs/loading.gif", "imgs/jinkela.png", "imgs/loading.gif", "imgs/helper-neko.png","imgs/icon.png", "options.html", "imgs/menu-icon.png", "live.min.css", "live-content-script.min.js"]
}
4 changes: 2 additions & 2 deletions src/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class="button dynamic" option="on">开启功能</div>
<div class="button dynamic" option="off">关闭功能</div>
</li>
<li class="category">
<!--<li class="category">
<p>播放器切换</p>
<div class="button replace" option="on">开启功能</div>
<div class="button replace" option="off">关闭功能</div>
Expand All @@ -32,7 +32,7 @@
<p>HTML5优先</p>
<div class="button html5" option="on">开启功能</div>
<div class="button html5" option="off">关闭功能</div>
</li>
</li>-->
<li class="category">
<p>获取视频下载地址格式</p>
<div class="button dlquality" option="flv">FLV优先</div>
Expand Down
28 changes: 14 additions & 14 deletions src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ $(document).ready(function () {
$("#menu_title").text(chrome.i18n.getMessage('extShortName'));
$("#version").html(bkg_page.version);
$("#ad_opacity_opt").hide();
$("div[option=\"" + bkg_page.getOption("replace") + "\"].replace").addClass("on");
$("div[option=\"" + bkg_page.getOption("html5") + "\"].html5").addClass("on");
// $("div[option=\"" + bkg_page.getOption("replace") + "\"].replace").addClass("on");
// $("div[option=\"" + bkg_page.getOption("html5") + "\"].html5").addClass("on");
$("div[option=\"" + bkg_page.getOption("contextmenu") + "\"].contextmenu").addClass("on");
$("div[option=\"" + bkg_page.getOption("dynamic") + "\"].dynamic").addClass("on");
$("div[option=\"" + bkg_page.getOption("giftpackage") + "\"].giftpackage").addClass("on");
Expand Down Expand Up @@ -132,18 +132,18 @@ $(document).ready(function () {
$(this).addClass('on');
bkg_page.setOption("dynamic", $(this).attr("option"));
});
$('.replace').click(function () {
if ($(this).hasClass('on')) return false;
$('.replace').removeClass('on');
$(this).addClass('on');
bkg_page.setOption("replace", $(this).attr("option"));
});
$('.html5').click(function () {
if ($(this).hasClass('on')) return false;
$('.html5').removeClass('on');
$(this).addClass('on');
bkg_page.setOption("html5", $(this).attr("option"));
});
// $('.replace').click(function () {
// if ($(this).hasClass('on')) return false;
// $('.replace').removeClass('on');
// $(this).addClass('on');
// bkg_page.setOption("replace", $(this).attr("option"));
// });
// $('.html5').click(function () {
// if ($(this).hasClass('on')) return false;
// $('.html5').removeClass('on');
// $(this).addClass('on');
// bkg_page.setOption("html5", $(this).attr("option"));
// });
$('.contextmenu').click(function () {
if ($(this).hasClass('on')) return false;
$('.contextmenu').removeClass('on');
Expand Down
4 changes: 2 additions & 2 deletions src/resource.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9512c27

Please sign in to comment.