From b97f5e522ece418aa02d6d952609b79932fddaaf Mon Sep 17 00:00:00 2001 From: DrowsyFlesh Date: Mon, 25 May 2020 00:12:55 +0800 Subject: [PATCH] 1.2.18 --- package.json | 197 +++++----- src/js/modules/cvImages/UI/styles.scss | 2 +- src/js/modules/danmu/UI/danmu.js | 129 +++++-- src/js/modules/danmu/apis.js | 3 +- src/js/modules/danmu/danmuDecoder.js | 44 +++ src/js/modules/danmu/index.js | 28 +- .../modules/liveChatMode/UI/LiveChatMode.js | 8 +- src/js/modules/treasure/UI/Treasure.js | 3 + src/js/modules/videoDownload/index.js | 2 +- src/manifest.json | 338 +++++++++--------- src/styles/scss/video.scss | 2 +- 11 files changed, 458 insertions(+), 298 deletions(-) create mode 100644 src/js/modules/danmu/danmuDecoder.js diff --git a/package.json b/package.json index c9a4099..3a620f3 100644 --- a/package.json +++ b/package.json @@ -1,100 +1,101 @@ { - "name": "bilibili-helper-master", - "version": "1.2.18.1", - "description": "bilibili-helper", - "main": "index.js", - "dependencies": { - "color": "^3.0.0", - "fetch-progress": "^1.2.0", - "ffmpeg.js": "^3.1.9001", - "history": "^4.7.2", - "jquery": "^3.4.0", - "lodash": "^4.17.10", - "md5": "^2.2.1", - "measurement-protocol": "^0.1.0", - "mobx": "^5.0.3", - "mobx-react": "^5.2.3", - "mobx-react-router": "^4.0.4", - "moment": "^2.22.2", - "npm": "^6.6.0", - "ocradjs-browser.js": "^1.0.2", - "prop-types": "^15.6.2", - "react": "^16.4.1", - "react-dom": "^16.4.1", - "react-ga": "^2.7.0", - "react-router": "^4.3.1", - "react-transition-group": "^1.2.1", - "react-virtualized": "^9.21.0", - "store": "^2.0.12", - "styled-components": "^4.1.2", - "systemjs": "^2.1.1", - "universal-analytics": "^0.4.20", - "url-parse": "^1.4.3" - }, - "devDependencies": { - "babel-core": "^6.26.3", - "babel-eslint": "^10.0.1", - "babel-loader": "^7.1.4", - "babel-plugin-add-module-exports": "^0.2.1", - "babel-plugin-import": "^1.6.5", - "babel-plugin-lodash": "^3.3.2", - "babel-plugin-styled-components": "^1.4.0", - "babel-plugin-syntax-dynamic-import": "^6.18.0", - "babel-plugin-transform-builtin-classes": "^0.6.1", - "babel-plugin-transform-class-properties": "^6.24.1", - "babel-plugin-transform-decorators": "^6.24.1", - "babel-plugin-transform-decorators-legacy": "^1.3.5", - "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", - "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-transform-es3-member-expression-literals": "^6.22.0", - "babel-plugin-transform-es3-property-literals": "^6.22.0", - "babel-plugin-transform-function-bind": "^6.22.0", - "babel-plugin-transform-object-assign": "^6.22.0", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-plugin-transform-react-jsx": "^6.24.1", - "babel-plugin-transform-runtime": "^6.23.0", - "babel-polyfill": "^6.26.0", - "babel-preset-env": "^1.7.0", - "babel-preset-es2015": "^6.24.1", - "babel-preset-react": "^6.24.1", - "babel-preset-stage-0": "^6.24.1", - "clean-webpack-plugin": "^0.1.19", - "concurrently": "^4.1.0", - "copy-webpack-plugin": "^4.5.1", - "css-loader": "^2.1.0", - "cssnano": "^4.0.3", - "eslint": "^5.9.0", - "eslint-loader": "^2.1.1", - "eslint-plugin-react": "^7.11.1", - "html-webpack-plugin": "^4.0.0-alpha", - "json-loader": "^0.5.7", - "load-grunt-tasks": "^3.5.2", - "merge-jsons-webpack-plugin": "^1.0.18", - "mini-css-extract-plugin": "^0.4.0", - "node-sass": "^4.9.0", - "optimize-css-assets-webpack-plugin": "^5.0.0", - "react-hot-loader": "^4.3.3", - "sass-loader": "^7.0.3", - "style-loader": "^0.21.0", - "uglifyjs-webpack-plugin": "^1.2.7", - "webpack": "^4.10.2", - "webpack-bundle-analyzer": "^3.1.0", - "webpack-cli": "^3.0.3", - "webpack-dev-server": "^3.1.4", - "write-json-webpack-plugin": "^1.1.0", - "zip-webpack-plugin": "^3.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-beta.49" - }, - "scripts": { - "grunt": "grunt", - "watch": "webpack --env.DEBUG=true --config=webpack.config.development.js --watch --progress", - "build": "webpack --production --progress", - "build:test": "webpack --env.DEBUG=true --production --progress" - }, - "author": "zacyu & drowsyflesh", - "license": "MIT", - "repository": "https://github.com/zacyu/bilibili-helper", - "readme": "/source/README.md" + "name": "bilibili-helper-master", + "version": "1.2.18", + "description": "bilibili-helper", + "main": "index.js", + "dependencies": { + "color": "^3.0.0", + "fetch-progress": "^1.2.0", + "ffmpeg.js": "^3.1.9001", + "history": "^4.7.2", + "jquery": "^3.4.0", + "lodash": "^4.17.10", + "md5": "^2.2.1", + "measurement-protocol": "^0.1.0", + "mobx": "^5.0.3", + "mobx-react": "^5.2.3", + "mobx-react-router": "^4.0.4", + "moment": "^2.22.2", + "npm": "^6.6.0", + "ocradjs-browser.js": "^1.0.2", + "prop-types": "^15.6.2", + "protobufjs": "^6.9.0", + "react": "^16.4.1", + "react-dom": "^16.4.1", + "react-ga": "^2.7.0", + "react-router": "^4.3.1", + "react-transition-group": "^1.2.1", + "react-virtualized": "^9.21.0", + "store": "^2.0.12", + "styled-components": "^4.1.2", + "systemjs": "^2.1.1", + "universal-analytics": "^0.4.20", + "url-parse": "^1.4.3" + }, + "devDependencies": { + "babel-core": "^6.26.3", + "babel-eslint": "^10.0.1", + "babel-loader": "^7.1.4", + "babel-plugin-add-module-exports": "^0.2.1", + "babel-plugin-import": "^1.6.5", + "babel-plugin-lodash": "^3.3.2", + "babel-plugin-styled-components": "^1.4.0", + "babel-plugin-syntax-dynamic-import": "^6.18.0", + "babel-plugin-transform-builtin-classes": "^0.6.1", + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-decorators": "^6.24.1", + "babel-plugin-transform-decorators-legacy": "^1.3.5", + "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", + "babel-plugin-transform-es2015-modules-umd": "^6.24.1", + "babel-plugin-transform-es3-member-expression-literals": "^6.22.0", + "babel-plugin-transform-es3-property-literals": "^6.22.0", + "babel-plugin-transform-function-bind": "^6.22.0", + "babel-plugin-transform-object-assign": "^6.22.0", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-plugin-transform-react-jsx": "^6.24.1", + "babel-plugin-transform-runtime": "^6.23.0", + "babel-polyfill": "^6.26.0", + "babel-preset-env": "^1.7.0", + "babel-preset-es2015": "^6.24.1", + "babel-preset-react": "^6.24.1", + "babel-preset-stage-0": "^6.24.1", + "clean-webpack-plugin": "^0.1.19", + "concurrently": "^4.1.0", + "copy-webpack-plugin": "^4.5.1", + "css-loader": "^2.1.0", + "cssnano": "^4.0.3", + "eslint": "^5.9.0", + "eslint-loader": "^2.1.1", + "eslint-plugin-react": "^7.11.1", + "html-webpack-plugin": "^4.0.0-alpha", + "json-loader": "^0.5.7", + "load-grunt-tasks": "^3.5.2", + "merge-jsons-webpack-plugin": "^1.0.18", + "mini-css-extract-plugin": "^0.4.0", + "node-sass": "^4.9.0", + "optimize-css-assets-webpack-plugin": "^5.0.0", + "react-hot-loader": "^4.3.3", + "sass-loader": "^7.0.3", + "style-loader": "^0.21.0", + "uglifyjs-webpack-plugin": "^1.2.7", + "webpack": "^4.10.2", + "webpack-bundle-analyzer": "^3.1.0", + "webpack-cli": "^3.0.3", + "webpack-dev-server": "^3.1.4", + "write-json-webpack-plugin": "^1.1.0", + "zip-webpack-plugin": "^3.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-beta.49" + }, + "scripts": { + "grunt": "grunt", + "watch": "webpack --env.DEBUG=true --config=webpack.config.development.js --watch --progress", + "build": "webpack --production --progress", + "build:test": "webpack --env.DEBUG=true --production --progress" + }, + "author": "zacyu & drowsyflesh", + "license": "MIT", + "repository": "https://github.com/zacyu/bilibili-helper", + "readme": "/source/README.md" } \ No newline at end of file diff --git a/src/js/modules/cvImages/UI/styles.scss b/src/js/modules/cvImages/UI/styles.scss index 6b90656..d18fb5b 100644 --- a/src/js/modules/cvImages/UI/styles.scss +++ b/src/js/modules/cvImages/UI/styles.scss @@ -3,7 +3,7 @@ } .bilibili-ct-wrapper, .banner-img-holder { - margin: 0px 5px; + margin: 0px; &:hover { outline: 5px solid #00a1d6; diff --git a/src/js/modules/danmu/UI/danmu.js b/src/js/modules/danmu/UI/danmu.js index 365fa13..d1e1596 100644 --- a/src/js/modules/danmu/UI/danmu.js +++ b/src/js/modules/danmu/UI/danmu.js @@ -19,7 +19,6 @@ import {theme} from 'Styles'; import './styles.scss'; import 'react-virtualized/styles.css'; - export default () => { const {color} = theme; const crcEngine = new Crc32Engine(); @@ -191,11 +190,16 @@ export default () => { addListener = () => { const that = this; chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { - if (message.command === 'loadHistoryDanmu') { // 被通知载入历史弹幕 + if (message.command === 'loadNewTypeDanmu') { // 被通知加载新类型的弹幕 + this.getNewDANMUList(message.oid, message.pid); + sendResponse(true); + } else if (message.command === 'loadHistoryDanmu') { // 被通知载入历史弹幕 if (message.date) { this.getDANMUList(message.cid, message.date); sendResponse(true); - } else console.error(`Error history danmu date: ${message.date}`); + } else { + console.error(`Error history danmu date: ${message.date}`); + } } else if (message.command === 'loadCurrentDanmu') { // 被通知载入当日弹幕 this.getDANMUList(message.cid); sendResponse(true); @@ -219,7 +223,9 @@ export default () => { m = null; } m = setTimeout(() => { - if (document.querySelector('#helper-card')) document.querySelector('#helper-card').style.display = 'block'; + if (document.querySelector('#helper-card')) { + document.querySelector('#helper-card').style.display = 'block'; + } }, 300); if (n) { clearTimeout(n); @@ -232,11 +238,58 @@ export default () => { $(document).on('mouseleave', '[helper-data-usercard-mid], #helper-card, .bilibili-helper-danmu-wrapper', function() { setTimeout(() => { const dom = document.querySelector('#helper-card'); - if (that.removeCardSign && dom) dom.style.display = 'none'; + if (that.removeCardSign && dom) { + dom.style.display = 'none'; + } }, 200); }); }; + getNewDANMUList = (oid, pid) => { + if (!!oid && !this.state.loading) { + const timer = setTimeout(() => { // 请求时长超过800毫秒则显示查询中 + this.setState({ + loading: true, + loadingText: '弹幕加载中~(๑•̀ㅂ•́)و', + }); + }, 800); + const url = new Url(apis.seg); + url.set('query', { + type: 1, + oid, + pid, + segment_index: 1, + }); + chrome.runtime.sendMessage({command: 'fetchNewTypeDanmu', url: url.toString()}, (danmuArray) => { + clearTimeout(timer); + const targetData = danmuArray.map(({id: rowId, content: danmu, midHash: authorHash, mode, progress}) => { + if (mode === 7) { + try { + danmu = danmu.replace(/[\n\r]/g, ''); + danmu = JSON.parse(danmu)[4]; + } catch (e) { + console.error(danmu); + } + } + return {rowId, danmu, authorHash, time: parseTime(progress)}; + }); + const danmuJSON = { + count: targetData.length, + list: targetData, + cid: oid, + }; + this.orderedJSON = {...danmuJSON}; + danmuJSON.list = this.sortJSONByTime(danmuJSON.list); + this.setState({ + danmuJSON: danmuJSON, + loaded: true, + loading: false, + currentCid: oid, + }); + }); + } + }; + // 获取弹幕xml数据源 getDANMUList = (cid, date) => { if (!!cid && !this.state.loading) { @@ -256,7 +309,9 @@ export default () => { chrome.runtime.sendMessage({command: 'fetchDanmu', url: url.toString()}, (danmuDocumentStr) => { clearTimeout(timer); if (danmuDocumentStr) { - if (date) this.danmuDate = date; + if (date) { + this.danmuDate = date; + } const oSerializer = new DOMParser(); this.danmuDocumentStr = danmuDocumentStr; this.danmuDocument = oSerializer.parseFromString(danmuDocumentStr, 'application/xml'); @@ -285,7 +340,9 @@ export default () => { if (res) { // 过滤掉可能是机器人的用户 const {code, data} = JSON.parse(res); if (code === 0) { - if (this.isRobotUser(data)) resolve(false); + if (this.isRobotUser(data)) { + resolve(false); + } const {card, space, follower, following} = data; this.userMap[uid] = {...card, ...space, follower, following}; resolve(uid); @@ -317,8 +374,8 @@ export default () => { }; // 将弹幕数据以时间顺序排序 - sortJSONByTime = (originJSON) => { - return _.sortBy(originJSON, 'time'); + sortJSONByTime = (originJSON, key = 'time') => { + return _.sortBy(originJSON, key); }; // 将xml文档转化为json @@ -330,16 +387,23 @@ export default () => { unknow, // eslint-disable-line authorHash, rowId, ] = d.getAttribute('p').split(','); - let danmu = d.innerHTML; - if (/^\[(".+"?){14}\]$/g.test(danmu)) { - danmu = JSON.parse(danmu)[4].trim(); + let danmuString = d.innerHTML.replace(/[\n\r]/g, ''); + let danmu = danmuString; + try { + danmu = JSON.parse(danmu); + if (!(danmu instanceof Array)) { + danmu = danmuString; + } else { + danmu = danmu[4]; + } + } catch (e) { + e; } list.push({danmuMode, fontSize, color, unixTime, authorHash, rowId, danmu, time: parseTime(time * 1000)}); }); this.setState({loaded: true}); return { cid: Number(document.getElementsByTagName('chatid')[0].innerHTML), - maxLimit: Number(document.getElementsByTagName('maxlimit')[0].innerHTML), count: list.length, list, }; @@ -397,7 +461,9 @@ export default () => { Promise.all(uids.map((uid) => this.getUserInfoByUid(uid))).then((res) => { thisHashMap = thisHashMap.concat(_.compact(res)); }).then(() => { - if (thisHashMap.length > 0) this.authorHashMap[authorHash] = thisHashMap; + if (thisHashMap.length > 0) { + this.authorHashMap[authorHash] = thisHashMap; + } this.setState({loading: false}, () => { this.danmuListRef.recomputeRowHeights(); this.danmuListRef.forceUpdate(); @@ -498,8 +564,11 @@ export default () => { } header.setAttribute('style', `background-image: url(${s_img});`); faceBlock.setAttribute('src', face); - if (sex === '男') sexBlock.setAttribute('class', 'sex man'); - else if (sex === '女') sexBlock.setAttribute('class', 'sex woman'); + if (sex === '男') { + sexBlock.setAttribute('class', 'sex man'); + } else if (sex === '女') { + sexBlock.setAttribute('class', 'sex woman'); + } const levelInner = document.createElement('i'); levelInner.setAttribute('class', `level l${level_info.current_level}`); levelBlock.innerHTML = ''; @@ -507,10 +576,15 @@ export default () => { likeBtn.setAttribute('mid', mid); likeBtn.setAttribute('uname', name); likeBtn.onclick = function() { - if (following) this.userMap[mid].following = false; - else this.userMap[mid].following = true; + if (following) { + this.userMap[mid].following = false; + } else { + this.userMap[mid].following = true; + } }; - if (following) likeBtn.setAttribute('class', 'like liked'); + if (following) { + likeBtn.setAttribute('class', 'like liked'); + } messageBtn.setAttribute('href', '//message.bilibili.com/#whisper/mid' + mid); nameBlock.innerText = name; @@ -522,7 +596,9 @@ export default () => { createCard = (target, mid) => { const userData = this.userMap[mid]; const cardDOM = this.createCardDOM(userData); - if (!document.querySelector('#helper-card')) document.querySelector('body').appendChild(cardDOM); + if (!document.querySelector('#helper-card')) { + document.querySelector('body').appendChild(cardDOM); + } this.setTargetPosition(target, cardDOM); }; @@ -530,14 +606,19 @@ export default () => { setTargetPosition = (targetDOM, cardDOM) => { const {height, top, left} = targetDOM.getBoundingClientRect(); const {height: cardHeight} = cardDOM.getBoundingClientRect(); - if (cardHeight) this.lastHeight = cardHeight; + if (cardHeight) { + this.lastHeight = cardHeight; + } if (top >= cardHeight) { cardDOM.style.top = `${top - this.lastHeight - 2}px`; } else { cardDOM.style.top = `${top + height + 2}px`; } - if (left + 377 <= window.innerWidth) cardDOM.style.left = `${left}px`; - else cardDOM.style.left = `${window.innerWidth - 377}px`; + if (left + 377 <= window.innerWidth) { + cardDOM.style.left = `${left}px`; + } else { + cardDOM.style.left = `${window.innerWidth - 377}px`; + } }; renderHeader = (danmuJSON = this.state.danmuJSON) => ( @@ -593,6 +674,6 @@ export default () => { ); } - } + }; } diff --git a/src/js/modules/danmu/apis.js b/src/js/modules/danmu/apis.js index 2a098a0..68044b8 100644 --- a/src/js/modules/danmu/apis.js +++ b/src/js/modules/danmu/apis.js @@ -7,4 +7,5 @@ export default { list: 'https://api.bilibili.com/x/v1/dm/list.so', historyList: 'https://api.bilibili.com/x/v2/dm/history', card: 'https://api.bilibili.com/x/web-interface/card', -} \ No newline at end of file + seg: 'https://api.bilibili.com/x/v2/dm/web/seg.so', +} diff --git a/src/js/modules/danmu/danmuDecoder.js b/src/js/modules/danmu/danmuDecoder.js new file mode 100644 index 0000000..ff3f3c4 --- /dev/null +++ b/src/js/modules/danmu/danmuDecoder.js @@ -0,0 +1,44 @@ +/** + * Author: DrowsyFlesh + * Create: 2020/5/24 + * Description: + */ +import protobuf from 'protobufjs'; + +const danmuConfig = JSON.parse(`{"id":{"type":"int64","id":1},"progress":{"type":"int32","id":2},"mode":{"type":"int32","id":3},"fontsize":{"type":"int32","id":4},"color":{"type":"uint32","id":5},"midHash":{"type":"string","id":6},"content":{"type":"string","id":7},"ctime":{"type":"int64","id":8},"weight":{"type":"int32","id":9},"action":{"type":"string","id":10},"pool":{"type":"int32","id":11},"idStr":{"type":"string","id":12}}`); +const danmuConfigMap = Object.keys(danmuConfig).reduce((target, key) => { + const config = danmuConfig[key]; + target[config.id] = {key, ...config}; + return target; +}, {}); + +const decoderDanmu = (reader, length) => { + const l = length ? reader.pos + length : reader.len; + const danmu = {}; + while (reader.pos < l) { + const pos = reader.uint32(); + const paramId = pos >>> 3; + let param = danmuConfigMap[paramId]; + if (param) { + danmu[param.key] = reader[param.type](); + } else reader.skipType(pos & 7); + } + return danmu; +}; + +export const DanmuDecoder = (danmuData) => { + const reader = new protobuf.Reader(new Uint8Array(danmuData)); + const danmuList = []; + while (reader.pos < reader.len) { + const currentPos = reader.uint32(); + switch (currentPos >>> 3) { + case 1: { + danmuList.push(decoderDanmu(reader, reader.uint32())); + break; + } + default: + reader.skipType(currentPos & 7); + } + } + return danmuList; +}; diff --git a/src/js/modules/danmu/index.js b/src/js/modules/danmu/index.js index fa0966c..77e686a 100644 --- a/src/js/modules/danmu/index.js +++ b/src/js/modules/danmu/index.js @@ -9,6 +9,7 @@ import {Feature} from 'Libs/feature'; import {MessageStore} from 'Libs/messageStore'; import {GenerateASS} from 'Libs/bilibili_ASS_Danmaku_Downloader'; import {__, fetchFromHelper} from 'Utils'; +import {DanmuDecoder} from './danmuDecoder'; export {DanmuUI} from './UI/index'; @@ -37,6 +38,8 @@ export class Danmu extends Feature { '*://api.bilibili.com/x/player.so?id=cid:*', // 新页面特有,用于标记新页面,加载时特殊处理 '*://interface.bilibili.com/player?id=cid:*', // 老页面特有 + + '*://api.bilibili.com/x/v2/dm/web/seg.so?*', // 最新的protocolBuff格式的数据 ], }; chrome.webRequest.onSendHeaders.addListener((details) => { @@ -47,9 +50,21 @@ export class Danmu extends Feature { } const url = new URLParse(details.url, '', true); const {pathname, query} = url; - if (query && query.requestFrom) return; + if (query && query.requestFrom) { + return; + } // 收到前端页面请求 - if (pathname === '/x/player.so' || pathname === '/player') { // 如果tab请求了当天弹幕 + console.warn(pathname); + if (pathname === '/x/v2/dm/web/seg.so') { // 最新的protocolBuff格式的数据 + const tabData = this.messageStore.createData(tabId); + tabData.data.cid = query.oid; + tabData.queue.push({ // 将监听到的事件添加到队列中 + command: 'loadNewTypeDanmu', + oid: query.oid, + pid: query.pid, + }); + this.messageStore.dealWith(tabId); // 处理queue + } else if (pathname === '/x/player.so' || pathname === '/player') { // 如果tab请求了当天弹幕 const tabData = this.messageStore.createData(tabId); tabData.data.cid = query.id.slice(4); tabData.queue.push({ // 将监听到的事件添加到队列中 @@ -85,6 +100,15 @@ export class Danmu extends Feature { console.error(res); sendResponse(res); }); + } + if (message.command === 'fetchNewTypeDanmu' && message.url) { + fetchFromHelper(message.url) + .then(res => res.arrayBuffer()) + .then(res => { + const danmu = DanmuDecoder(res); + console.warn(danmu); + sendResponse(danmu); + }); } else if (message.command === 'fetchDanmu' && message.url) { fetchFromHelper(message.url) .then(res => res.text()) diff --git a/src/js/modules/liveChatMode/UI/LiveChatMode.js b/src/js/modules/liveChatMode/UI/LiveChatMode.js index 36bbffe..53fa9d5 100644 --- a/src/js/modules/liveChatMode/UI/LiveChatMode.js +++ b/src/js/modules/liveChatMode/UI/LiveChatMode.js @@ -126,7 +126,7 @@ export default () => { height: auto; background-color: unset; pointer-events: none!important; - z-index: 1; + z-index: 9; } .hide-aside-area #chat-control-panel-vm .control-panel-ctnr { height: auto; @@ -141,6 +141,9 @@ export default () => { color: #eee; pointer-events: auto; } + .hide-aside-area #chat-control-panel-vm .dialog-ctnr { + pointer-events: auto; + } .hide-aside-area #chat-control-panel-vm .input-limit-hint { bottom: 10px; right: 12px; @@ -151,6 +154,9 @@ export default () => { .hide-aside-area:not(.fullscreen-fix) .bilibili-live-player-video-controller { bottom: 38px; } + .hide-asize-area .bilibili-live-player-video-danmaku { + pointer-events: none; + } .hide-aside-area .bilibili-live-player-video-controller .bilibili-live-player-video-controller-container { padding: 0 130px 0 80px; } diff --git a/src/js/modules/treasure/UI/Treasure.js b/src/js/modules/treasure/UI/Treasure.js index 7d9e5b1..2e5aa71 100644 --- a/src/js/modules/treasure/UI/Treasure.js +++ b/src/js/modules/treasure/UI/Treasure.js @@ -287,6 +287,9 @@ export default () => { } break; } + case -903: // 已经领取过这个宝箱 + this.getCurrentTask(); + break; case -500: // 稍后登录?还不知道为什么会有这个错误 if (this.retryTime) { this.retryTime = 0; diff --git a/src/js/modules/videoDownload/index.js b/src/js/modules/videoDownload/index.js index 8c5d17f..34d61d0 100644 --- a/src/js/modules/videoDownload/index.js +++ b/src/js/modules/videoDownload/index.js @@ -51,7 +51,7 @@ export class VideoDownload extends Feature { '*://interface.bilibili.com/v2/playurl?cid=*', // 旧版页面必定加载,画质,下载地址 //'*://bangumi.bilibili.com/player/web_api/v2/playurl?cid=*', // 老番剧页面 - '*://api.bilibili.com/pgc/player/web/playurl?avid=*', // 新番剧页面 + '*://api.bilibili.com/pgc/player/web/playurl*', // 新番剧页面 '*://api.bilibili.com/x/player/playurl*', // 新版页面切换清晰度时调用,返回字段和上面相同 '*://interface.bilibili.com/player?id=cid*', diff --git a/src/manifest.json b/src/manifest.json index 161b02c..5bf7b49 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,175 +1,175 @@ { - "version": "1.2.18.1", - "manifest_version": 2, - "minimum_chrome_version": "56.0.0", - "name": "__MSG_extensionName__", - "short_name": "__MSG_ShortName__", - "default_locale": "zh_CN", - "description": "__MSG_extensionDescription__", - "options_ui": { - "page": "config.html", - "open_in_tab": true + "version": "1.2.18", + "manifest_version": 2, + "minimum_chrome_version": "56.0.0", + "name": "__MSG_extensionName__", + "short_name": "__MSG_ShortName__", + "default_locale": "zh_CN", + "description": "__MSG_extensionDescription__", + "options_ui": { + "page": "config.html", + "open_in_tab": true + }, + "options_page": "config.html", + "background": { + "scripts": [ + "vendors.bundle.js", + "features.bundle.js", + "background.js" + ], + "persistent": true + }, + "browser_action": { + "default_icon": { + "19": "statics/imgs/bilibili-cat-256.png", + "38": "statics/imgs/bilibili-cat-256.png" }, - "options_page": "config.html", - "background": { - "scripts": [ - "vendors.bundle.js", - "features.bundle.js", - "background.js" - ], - "persistent": true + "default_popup": "popup.html", + "default_title": "__MSG_ShortName__" + }, + "content_scripts": [ + { + "all_frames": false, + "js": [ + "video.js", + "vendors.bundle.js", + "features.bundle.js" + ], + "css": [ + "styles/vendors.css", + "styles/features.css" + ], + "matches": [ + "*://*.bilibili.com/bangumi/play/ss*", + "*://*.bilibili.com/bangumi/play/ep*", + "*://*.bilibili.com/video/av*", + "*://*.bilibili.com/video/bv*", + "*://*.bilibili.com/video/BV*", + "*://www.bilibili.com/watchlater/*", + "*://www.bilibili.com/medialist/*", + "*://www.bilibili.com/blackboard/*" + ], + "run_at": "document_end" }, - "browser_action": { - "default_icon": { - "19": "statics/imgs/bilibili-cat-256.png", - "38": "statics/imgs/bilibili-cat-256.png" - }, - "default_popup": "popup.html", - "default_title": "__MSG_ShortName__" + { + "all_frames": true, + "js": [ + "vendors.bundle.js", + "live.js", + "features.bundle.js", + "statics/js/ocrad.min.js" + ], + "matches": [ + "*://live.bilibili.com/*", + "*://*.bilibili.com/blackboard/*" + ], + "run_at": "document_end" }, - "content_scripts": [ - { - "all_frames": false, - "js": [ - "video.js", - "vendors.bundle.js", - "features.bundle.js" - ], - "css": [ - "styles/vendors.css", - "styles/features.css" - ], - "matches": [ - "*://*.bilibili.com/bangumi/play/ss*", - "*://*.bilibili.com/bangumi/play/ep*", - "*://*.bilibili.com/video/av*", - "*://*.bilibili.com/video/bv*", - "*://*.bilibili.com/video/BV*", - "*://www.bilibili.com/watchlater/*", - "*://www.bilibili.com/medialist/*", - "*://www.bilibili.com/blackboard/*" - ], - "run_at": "document_end" - }, - { - "all_frames": true, - "js": [ - "vendors.bundle.js", - "live.js", - "features.bundle.js", - "statics/js/ocrad.min.js" - ], - "matches": [ - "*://live.bilibili.com/*", - "*://*.bilibili.com/blackboard/*" - ], - "run_at": "document_end" - }, - { - "all_frames": false, - "js": [ - "vendors.bundle.js", - "website.js", - "features.bundle.js" - ], - "matches": [ - "*://localhost/*", - "*://helper.drowsyflesh.com/*", - "*://bilibili-helper.github.io/*" - ], - "run_at": "document_start" - }, - { - "all_frames": false, - "js": [ - "vendors.bundle.js", - "cv.js", - "features.bundle.js" - ], - "css": [ - "styles/vendors.css", - "styles/features.css" - ], - "matches": [ - "*://www.bilibili.com/read/cv*" - ], - "run_at": "document_end" - }, - { - "all_frames": false, - "js": [ - "vendors.bundle.js", - "tbilibili.js", - "features.bundle.js" - ], - "css": [ - "styles/vendors.css", - "styles/features.css" - ], - "matches": [ - "*://t.bilibili.com/*" - ], - "run_at": "document_end" - }, - { - "all_frames": false, - "js": [ - "vendors.bundle.js", - "videoList.js", - "features.bundle.js" - ], - "css": [ - "styles/vendors.css", - "styles/features.css" - ], - "matches": [ - "*://space.bilibili.com/*/favlist*" - ], - "run_at": "document_end" - }, - { - "all_frames": false, - "js": [ - "vendors.bundle.js", - "vipPrivilege.js", - "features.bundle.js" - ], - "css": [ - "styles/vendors.css", - "styles/features.css" - ], - "matches": [ - "*://*.bilibili.com/*" - ], - "run_at": "document_end" - } - ], - "icons": { - "16": "statics/imgs/bilibili-cat-256.png", - "32": "statics/imgs/bilibili-cat-256.png", - "128": "statics/imgs/bilibili-cat-256.png" + { + "all_frames": false, + "js": [ + "vendors.bundle.js", + "website.js", + "features.bundle.js" + ], + "matches": [ + "*://localhost/*", + "*://helper.drowsyflesh.com/*", + "*://bilibili-helper.github.io/*" + ], + "run_at": "document_start" }, - "permissions": [ - "downloads", - "alarms", - "contextMenus", - "cookies", - "notifications", - "storage", - "tabs", - "webRequest", - "webRequestBlocking", - "*://*.acgvideo.com/*", - "*://*.bilibili.com/*", - "*://bilibili-helper.github.io/*", - "*://*.hdslb.com/*", - "*://*.bilivideo.com/*" - ], - "web_accessible_resources": [ - "statics/*", - "bilibili-helper.woff", - "at.alicdn.com/t/*", - "libs/*", - "js/*" - ] + { + "all_frames": false, + "js": [ + "vendors.bundle.js", + "cv.js", + "features.bundle.js" + ], + "css": [ + "styles/vendors.css", + "styles/features.css" + ], + "matches": [ + "*://www.bilibili.com/read/cv*" + ], + "run_at": "document_end" + }, + { + "all_frames": false, + "js": [ + "vendors.bundle.js", + "tbilibili.js", + "features.bundle.js" + ], + "css": [ + "styles/vendors.css", + "styles/features.css" + ], + "matches": [ + "*://t.bilibili.com/*" + ], + "run_at": "document_end" + }, + { + "all_frames": false, + "js": [ + "vendors.bundle.js", + "videoList.js", + "features.bundle.js" + ], + "css": [ + "styles/vendors.css", + "styles/features.css" + ], + "matches": [ + "*://space.bilibili.com/*/favlist*" + ], + "run_at": "document_end" + }, + { + "all_frames": false, + "js": [ + "vendors.bundle.js", + "vipPrivilege.js", + "features.bundle.js" + ], + "css": [ + "styles/vendors.css", + "styles/features.css" + ], + "matches": [ + "*://*.bilibili.com/*" + ], + "run_at": "document_end" + } + ], + "icons": { + "16": "statics/imgs/bilibili-cat-256.png", + "32": "statics/imgs/bilibili-cat-256.png", + "128": "statics/imgs/bilibili-cat-256.png" + }, + "permissions": [ + "downloads", + "alarms", + "contextMenus", + "cookies", + "notifications", + "storage", + "tabs", + "webRequest", + "webRequestBlocking", + "*://*.acgvideo.com/*", + "*://*.bilibili.com/*", + "*://bilibili-helper.github.io/*", + "*://*.hdslb.com/*", + "*://*.bilivideo.com/*" + ], + "web_accessible_resources": [ + "statics/*", + "bilibili-helper.woff", + "at.alicdn.com/t/*", + "libs/*", + "js/*" + ] } \ No newline at end of file diff --git a/src/styles/scss/video.scss b/src/styles/scss/video.scss index 916d111..5afdaa8 100644 --- a/src/styles/scss/video.scss +++ b/src/styles/scss/video.scss @@ -1,5 +1,5 @@ body { - background-color: white; + //background-color: white; } /** new container for helper