Skip to content
This repository has been archived by the owner on Jan 1, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/V0.0.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
MoeHero committed Apr 30, 2017
2 parents b02d826 + c533b4c commit abde363
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 28 deletions.
9 changes: 2 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var lazypipe = require('lazypipe');
var closureCompiler = require('google-closure-compiler').gulp();
var fs = require('fs');
var pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));

Expand Down Expand Up @@ -36,19 +35,15 @@ gulp.task('live', function() {
.pipe($.order(['Live*.js', 'Module*.class.js', 'Func*.class.js', '!Core.js', 'Core.js']))
.pipe($.jshintChannel())
.pipe($.concat('bilibili_live.js'))
.pipe($.if(path == 'release', closureCompiler({
js_output_file: 'bilibili_live.js',
formatting: 'SINGLE_QUOTES',
assume_function_wrapper: 'true'
})))
.pipe($.if(path == 'release', $.babel({presets: ['babili']})))
.pipe($.rename({suffix: '.min'}))
.pipe(gulp.dest(path + '/src/'));
});

gulp.task('script', function() {
return gulp.src(['./src/**/!(*.min).js', '!src/bilibili_live/*.js'])
.pipe($.jshintChannel())
.pipe($.if(path == 'release', $.uglify()))
.pipe($.if(path == 'release', $.babel({presets: ['babili']})))
.pipe($.rename({suffix: '.min'}))
.pipe(gulp.dest(path + '/src/'));
});
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bilibili-helper",
"description": "Bilibili助手",
"version": "0.0.7",
"version": "0.0.8",
"author": "MoeHero",
"license": "MPL-2.0",
"homepage": "https://github.com/MoeHero/BilibiliHelper#readme",
Expand All @@ -14,7 +14,9 @@
"gulp": "gulp release"
},
"devDependencies": {
"babel-preset-babili": "0.0.12",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-clean-css": "^3.0.4",
"gulp-concat": "^2.6.1",
"gulp-crx-pack": "^1.0.1",
Expand All @@ -25,13 +27,9 @@
"gulp-order": "^1.1.1",
"gulp-rename": "^1.2.2",
"gulp-sequence": "^0.4.6",
"gulp-uglify": "^2.1.2",
"gulp-zip": "^4.0.0",
"jshint": "^2.9.4",
"jshint-stylish": "^2.2.1",
"lazypipe": "^1.0.1"
},
"dependencies": {
"google-closure-compiler": "^20170409.0.0"
}
}
1 change: 1 addition & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var Option = {
live_autoSmallTV: true,
live_giftPackage: true,
live_liveSetting: true,
live_lighten: true,
live: true,
notify_autoSign: true,
notify_autoTreasure: true,
Expand Down
14 changes: 10 additions & 4 deletions src/bilibili_live/FuncGiftPackage.class.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
/* globals ModuleConsole,ModuleDom,ModuleNotify,ModuleStore */
class FuncGiftPackage {//TODO 重构
class FuncGiftPackage {
static init() {
if(!Live.option.live || !Live.option.live_giftPackage) {
return;
}
this.numberGroup = ['1', '5', '10', '50', '100', '5%', '10%', '50%', '80%', 'MAX'];

this.initDOM();
this.addEvent();
}

static initDOM() {
this.package = $('.items-package').clone();
this.packageButton = this.package.find('a');
this.packagePanel = this.package.find('.gifts-package-panel');
Expand All @@ -27,7 +31,8 @@ class FuncGiftPackage {//TODO 重构
this.packagePanel.find('.live-tips').remove();
$('.items-package').after(this.package).remove();
$('#gift-package-send-panel').after(this.sendPanel).remove();

}
static addEvent() {
this.packagePanel.on('click', (event) => event.stopPropagation());
this.sendPanel.on('click', (event) => event.stopPropagation());
$(document).on('click', () => this.packagePanel.fadeOut(200));
Expand All @@ -41,7 +46,7 @@ class FuncGiftPackage {//TODO 重构
if(request.command && request.command == 'openGiftPackage') {
this.openGiftPackage();
}
});//.focus()
});
Live.getMessage((request) => {
if(request.command && request.command == 'sendGiftCallback') {
let result = request.result;
Expand All @@ -61,6 +66,7 @@ class FuncGiftPackage {//TODO 重构
} else {
console.log(result);
}
this.sendPanelCount.focus();
}
});
}
Expand Down
8 changes: 6 additions & 2 deletions src/bilibili_live/FuncLighten.class.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
/* globals ModuleStore,ModuleDom,ModuleNotify,ModuleConsole */
class FuncLighten {
static init() {
if(!Live.option.live || !Live.option.live) {
if(!Live.option.live || !Live.option.live_lighten) {
return;
}
//ModuleDom.smallTV_init();

this.addEvent();
}

static addEvent() {
Live.sendMessage({command: 'getLighten'}, (result) => {
if(!result.showID) {
Live.sendMessage({command: 'setLighten', showID: Live.showID});
Expand All @@ -13,7 +18,6 @@ class FuncLighten {
});
Live.getMessage((request) => {
if(request.cmd && request.cmd == 'SYS_MSG' && request.msg && request.msg.includes('领取应援棒') && request.url) {
console.log(request);
this.join(request.url.match(/com\/(.+)/)[1]);
}
});
Expand Down
5 changes: 4 additions & 1 deletion src/bilibili_live/FuncLiveSetting.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ class FuncLiveSetting {
vip: {name: '老爷进场', click: this.vip_click, state: true},
'super-gift': {name: '礼物连击', click: this.super_gift_click, state: true}
};

this.initDOM();
this.addEvent();
}

static initDOM() {
Expand All @@ -24,7 +26,8 @@ class FuncLiveSetting {
}
this.liveSettingPanel.append(ul);
$('.profile-ctrl').append(this.liveSettingPanel).append(this.liveSettingButton);

}
static addEvnet() {
this.liveSettingPanel.on('click', (event) => event.stopPropagation());
$(document).on('click', () => this.liveSettingPanel.fadeOut(200));

Expand Down
10 changes: 9 additions & 1 deletion src/bilibili_live/FuncSmallTV.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ class FuncSmallTV {
if(!Live.option.live || !Live.option.live_autoSmallTV) {
return;
}
ModuleDom.smallTV_init();
this.countdown = {};
this.awardName = {1: '小电视抱枕', 2: '蓝白胖次', 3: 'B坷垃', 4: '喵娘', 5: '爱心便当', 6: '银瓜子', 7: '辣条'};

this.initDOM();
this.addEvent();
}

static initDOM() {
ModuleDom.smallTV_init();
}
static addEvent() {
Live.sendMessage({command: 'getSmallTV'}, (result) => {
if(!result.showID) {
Live.sendMessage({command: 'setSmallTV', showID: Live.showID});
Expand Down
7 changes: 7 additions & 0 deletions src/bilibili_live/FuncTreasure.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@ class FuncTreasure {
if(!Live.option.live || !Live.option.live_autoTreasure) {
return;
}
this.initDOM();
this.addEvent();
}

static initDOM() {
ModuleDom.treasure_init();
this.canvas = document.createElement('canvas');
this.canvas.width = 120;
this.canvas.height = 40;
this.canvas = this.canvas.getContext('2d');
}
static addEvent() {
Live.sendMessage({command: 'getTreasure'}, (result) => {
if(!result.showID) {
Live.sendMessage({command: 'setTreasure', showID: Live.showID});
Expand Down
3 changes: 3 additions & 0 deletions src/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ <h3 class="am-panel-title">直播功能设置</h3>
<li>
<span class="am-fl">自动参加小电视抽奖</span><span class="am-fr"><input class="live" type="checkbox" id="live_autoSmallTV"></span>
</li>
<li>
<span class="am-fl">自动领取应援棒</span><span class="am-fr"><input class="live" type="checkbox" id="live_lighten"></span>
</li>
<li>
<span class="am-fl">礼物包裹增强</span><span class="am-fr"><input class="live" type="checkbox" id="live_giftPackage"></span>
</li>
Expand Down
15 changes: 7 additions & 8 deletions src/options/updatelog.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<h2>更新日志</h2>
<p class="log-version">V0.0.8</p>
<!--<p><code>新增</code> </p>TODO 赠送礼物增强-->
<p><code>新增</code> 自动领取应援棒支持在设置内开关</p>
<!--<p><code>新增</code> </p>TODO 直播设置支持更多选项-->
<!--<p><code>优化</code> </p>TODO 领取瓜子后瓜子数量动态更新-->
<p><code>修复</code> 工作不正常的问题</p>
<hr>
<p class="log-version">V0.0.7</p>
<p><code>新增</code> 自动领取应援棒</p>
<!--<p><code>新增</code> </p>TODO 直播设置支持更多选项-->
<p><code>新增</code> 直播设置功能支持在设置内开关</p>
<!--<p><code>优化</code> </p>TODO 领取瓜子后瓜子数量动态更新-->
<p><code>优化</code> 改变直播设置后会自动滚动到最底部</p>
<p><code>修复</code> 播放器内礼物包裹按钮不能打开礼物包裹的问题</p>
<hr>
Expand All @@ -14,10 +19,4 @@ <h2>更新日志</h2>
<p><code>修复</code> 小电视领取成功后不计数的问题</p>
<p><code>修复</code> 小电视领取成功后没有提示的问题</p>
<p><code>修复</code> 领瓜子重复倒计时导致瓜子无法领取的问题</p>
<hr>
<p class="log-version">V0.0.5</p>
<p><code>新增</code> 礼物包裹增强</p>
<p><code>优化</code> 自动小电视支持显示当前状态</p>
<p><code>优化</code> 更改标题下方提示信息图标的样式</p>
<p><code>优化</code> 网络差的情况下各项功能的稳定性提升</p>
<hr>

0 comments on commit abde363

Please sign in to comment.