Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jjj201200 committed Nov 29, 2018
1 parent 4f0e942 commit 9196f1c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/js/modules/chatFilter/UI/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ChatFilterUI extends UI {

load = (containers, settings) => {
return new Promise(resolve => {
this.interval('.aside-area .control-panel-icon-row').then((container) => {
this.interval('.aside-area .control-panel-icon-row', 1000).then((container) => {
if (container) {
const panel = container.find('.icon-left-part');
const chatFilter = $('<span />').attr({
Expand Down
33 changes: 14 additions & 19 deletions src/js/modules/videoAnchor/UI/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,21 @@ export class VideoAnchorUI extends UI {
} else ++retryTime;
}, 1000);
} else { // 老的番剧页面
this.observer(containerSelectors).then((container) => {
let timer;
let timeout = false;
timer = setTimeout(() => {
timeout = true;
container.length > 0 && addUI(container);
}, 700);
container.length > 0 && new MutationObserver(function(mutationList, observer) {
if (timeout) observer.disconnect();
if (!!timer) clearTimeout(timer);
if ($('.fav-box .num').text() !== 0 || $('.coin-box .num').text() !== '--') {
observer.disconnect();
addUI(container);
this.interval(containerSelectors).then((container) => {
const retryMax = 10;
let retryTime = 0;
let timer = setInterval(() => {
if (retryTime > retryMax) {
clearInterval(timer);
return console.error(`title for view has not changed!`);
}
}).observe(container[0], {
childList: true,
attributes: true,
attributeOldValue: true,
subtree: true,
});
const favNum = container.find('.fav-box .num').text();
const coinNum = container.find('.coin-box .num').text();
if (favNum !== 0 && coinNum !== '--') {
clearInterval(timer);
addUI($('#arc_toolbar_report, #bangumi_detail .func-module'));
} else ++retryTime;
}, 1000);
});
}
});
Expand Down

0 comments on commit 9196f1c

Please sign in to comment.