mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
parent
404de5d867
commit
07b557df52
2
min/dark.min.css
vendored
2
min/dark.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
min/feeds-apis.min.js
vendored
2
min/feeds-apis.min.js
vendored
File diff suppressed because one or more lines are too long
@ -190,6 +190,7 @@ class FeedsCardsManager extends EventTarget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
async parseCard(element: HTMLElement): Promise<FeedsCard> {
|
async parseCard(element: HTMLElement): Promise<FeedsCard> {
|
||||||
|
const getVueData = (el: any) => el.parentElement.__vue__
|
||||||
const getSimpleText = async (selector: string) => {
|
const getSimpleText = async (selector: string) => {
|
||||||
const subElement = await SpinQuery.condition(
|
const subElement = await SpinQuery.condition(
|
||||||
() => element.querySelector(selector),
|
() => element.querySelector(selector),
|
||||||
@ -210,24 +211,29 @@ class FeedsCardsManager extends EventTarget {
|
|||||||
if (type === feedsCardTypes.bangumi) {
|
if (type === feedsCardTypes.bangumi) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
const el = await SpinQuery.condition(() => element, (it: any) => Boolean(it.__vue__ || !element.parentNode))
|
const el = await SpinQuery.condition(() => element, it => Boolean(getVueData(it) || !element.parentNode))
|
||||||
if (element.parentNode === null) {
|
if (element.parentNode === null) {
|
||||||
// console.log('skip detached node:', element)
|
// console.log('skip detached node:', element)
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
if (el === null) {
|
if (el === null) {
|
||||||
console.warn(el)
|
console.warn(el, element, getVueData(el), element.parentNode)
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
// if (!el.__vue__.card.origin) {
|
// if (!el.__vue__.card.origin) {
|
||||||
// return ''
|
// return ''
|
||||||
// }
|
// }
|
||||||
|
const vueData = getVueData(el)
|
||||||
if (type === feedsCardTypes.repost) {
|
if (type === feedsCardTypes.repost) {
|
||||||
const originalCard = JSON.parse(el.__vue__.card.origin)
|
const currentText = vueData.card.item.content
|
||||||
const originalText = el.__vue__.originCardData.pureText
|
// 被转发动态已失效
|
||||||
|
if (vueData.card.origin === undefined) {
|
||||||
|
return currentText
|
||||||
|
}
|
||||||
|
const originalCard = JSON.parse(vueData.card.origin)
|
||||||
|
const originalText = vueData.originCardData.pureText
|
||||||
const originalDescription = _.get(originalCard, 'item.description', '')
|
const originalDescription = _.get(originalCard, 'item.description', '')
|
||||||
const originalTitle = originalCard.title
|
const originalTitle = originalCard.title
|
||||||
const currentText = el.__vue__.card.item.content
|
|
||||||
return [
|
return [
|
||||||
currentText,
|
currentText,
|
||||||
originalText,
|
originalText,
|
||||||
@ -235,8 +241,8 @@ class FeedsCardsManager extends EventTarget {
|
|||||||
originalTitle
|
originalTitle
|
||||||
].filter(it => Boolean(it)).join('\n')
|
].filter(it => Boolean(it)).join('\n')
|
||||||
}
|
}
|
||||||
const currentText = el.__vue__.originCardData.pureText
|
const currentText = vueData.originCardData.pureText
|
||||||
const currentTitle = el.__vue__.originCardData.title
|
const currentTitle = vueData.originCardData.title
|
||||||
return [
|
return [
|
||||||
currentText,
|
currentText,
|
||||||
currentTitle,
|
currentTitle,
|
||||||
@ -271,7 +277,8 @@ class FeedsCardsManager extends EventTarget {
|
|||||||
element.setAttribute('data-type', card.type.id.toString())
|
element.setAttribute('data-type', card.type.id.toString())
|
||||||
if (card.type === feedsCardTypes.repost) {
|
if (card.type === feedsCardTypes.repost) {
|
||||||
const currentUsername = card.username
|
const currentUsername = card.username
|
||||||
const repostUsername = _.get(card, 'element.__vue__.card.origin_user.info.uname', '')
|
const vueData = getVueData(card.element)
|
||||||
|
const repostUsername = _.get(vueData, 'card.origin_user.info.uname', '')
|
||||||
if (currentUsername === repostUsername) {
|
if (currentUsername === repostUsername) {
|
||||||
element.setAttribute('data-self-repost', 'true')
|
element.setAttribute('data-self-repost', 'true')
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user