改进getBlackboards

This commit is contained in:
FoundTheWOUT 2021-03-28 19:10:29 +08:00
parent c22e9e932b
commit ad9352ca5a

View File

@ -7,8 +7,9 @@ export interface Blackboard {
export const getBlackboards = async (): Promise<Blackboard[]> => { export const getBlackboards = async (): Promise<Blackboard[]> => {
if (dq('.international-home')) { if (dq('.international-home')) {
const initData = await SpinQuery.condition(() => unsafeWindow['__INITIAL_STATE__'], it => it !== undefined) const initData = await SpinQuery.condition(() => unsafeWindow['__INITIAL_STATE__'], it => it !== undefined)
let half = dqa('.home-slide .item').length / 2
return dqa('.home-slide .item') return dqa('.home-slide .item')
.slice(0, 5) .slice(0, half)
.map((it, index) => { .map((it, index) => {
const locID = it.querySelector('a')!.getAttribute('data-loc-id')! const locID = it.querySelector('a')!.getAttribute('data-loc-id')!
return { return {