更新迷你资料卡
This commit is contained in:
parent
846abad5b0
commit
a866df68f7
@ -940,32 +940,67 @@
|
||||
}, 1000);
|
||||
|
||||
/**
|
||||
* 浮窗 todo
|
||||
* 小型资料卡 全局
|
||||
* 迷你资料卡 全局 todo
|
||||
*/
|
||||
let tooltip = $('div.ToolTipPortal')[0];
|
||||
let intervalID = setInterval(() => {
|
||||
tooltip = $('div.ToolTipPortal')[0];
|
||||
if (tooltip) {
|
||||
clearInterval(intervalID);
|
||||
new MutationObserver(mutations => {
|
||||
let barDescr = $('div[class^="tooltip"]').children('p[class^="bar-descr"]');
|
||||
if (barDescr.length !== 0) {
|
||||
barDescr[0].childNodes.forEach(i => {
|
||||
if (tooltipDict[i.nodeValue]) i.nodeValue = tooltipDict[i.nodeValue];
|
||||
})
|
||||
const miniProfile = function miniprof() {
|
||||
const miniprofOB = new MutationObserver(_ => {
|
||||
miniprofOB.disconnect();
|
||||
miniprofTrans();
|
||||
miniprofOB.observe($('div.profile-mini-root').get(0), {attributes: true, childList: true, subtree: true});
|
||||
});
|
||||
const miniprofTrans = function miniprofTrans(){
|
||||
// let barDescr = $('div[class^="tooltip"]').children('p[class^="bar-descr"]');
|
||||
// if (barDescr.length !== 0) {
|
||||
// barDescr[0].childNodes.forEach(i => {
|
||||
// if (tooltipDict[i.nodeValue]) i.nodeValue = tooltipDict[i.nodeValue];
|
||||
// })
|
||||
// }
|
||||
// let miniprof_tooltip = $("#body > div.ToolTipPortal > div > div:nth-child(2)");
|
||||
// if (miniprof_tooltip.length !== 0) {
|
||||
// if (tooltipDict[miniprof_tooltip[0].firstChild.nodeValue]) {
|
||||
// miniprof_tooltip[0].firstChild.nodeValue = tooltipDict[miniprof_tooltip[0].firstChild.nodeValue];
|
||||
// }
|
||||
// } else {
|
||||
// //todo 通配符匹配
|
||||
// }
|
||||
};
|
||||
if($('div.profile-mini-root').length>0)
|
||||
miniprofTrans();
|
||||
else {
|
||||
const intervalInit = setInterval(() => {
|
||||
const miniProfileFirst = $('div.profile-mini-root').get(0);
|
||||
if(miniProfileFirst){
|
||||
clearInterval(intervalInit);
|
||||
miniprofTrans();
|
||||
miniprofOB.observe(miniProfileFirst, {attributes: true, childList: true, subtree: true});
|
||||
}
|
||||
let miniprof_tooltip = $("#body > div.ToolTipPortal > div > div:nth-child(2)");
|
||||
if (miniprof_tooltip.length !== 0) {
|
||||
if (tooltipDict[miniprof_tooltip[0].firstChild.nodeValue]) {
|
||||
miniprof_tooltip[0].firstChild.nodeValue = tooltipDict[miniprof_tooltip[0].firstChild.nodeValue];
|
||||
}
|
||||
} else {
|
||||
//todo 通配符匹配
|
||||
}
|
||||
}).observe(tooltip, {attributes: true, childList: true, subtree: true});
|
||||
}, 1000);
|
||||
}
|
||||
}, 1000);
|
||||
// let tooltip = $('div.ToolTipPortal')[0];
|
||||
// let intervalID = setInterval(() => {
|
||||
// tooltip = $('div.ToolTipPortal')[0];
|
||||
// if (tooltip) {
|
||||
// clearInterval(intervalID);
|
||||
// new MutationObserver(mutations => {
|
||||
// let barDescr = $('div[class^="tooltip"]').children('p[class^="bar-descr"]');
|
||||
// if (barDescr.length !== 0) {
|
||||
// barDescr[0].childNodes.forEach(i => {
|
||||
// if (tooltipDict[i.nodeValue]) i.nodeValue = tooltipDict[i.nodeValue];
|
||||
// })
|
||||
// }
|
||||
// let miniprof_tooltip = $("#body > div.ToolTipPortal > div > div:nth-child(2)");
|
||||
// if (miniprof_tooltip.length !== 0) {
|
||||
// if (tooltipDict[miniprof_tooltip[0].firstChild.nodeValue]) {
|
||||
// miniprof_tooltip[0].firstChild.nodeValue = tooltipDict[miniprof_tooltip[0].firstChild.nodeValue];
|
||||
// }
|
||||
// } else {
|
||||
// //todo 通配符匹配
|
||||
// }
|
||||
// }).observe(tooltip, {attributes: true, childList: true, subtree: true});
|
||||
// }
|
||||
// }, 1000);
|
||||
};
|
||||
miniProfile();
|
||||
|
||||
/**
|
||||
* header
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user