Skip to content

Commit

Permalink
feat: show unknown location for previous comments(#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxchang3 committed Jun 25, 2023
1 parent 21310a5 commit 940dcbe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/processors/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const hookBbComment = async (type: Symbol) => {
const [item] = args
const result: string = Reflect.apply(target, thisArg, args)
const replyTimeRegex = /<span class="reply-time">(.*?)<\/span>/
return result.replace(replyTimeRegex, `<span class="reply-time">$1&nbsp;&nbsp;${item.reply_control.location}</span>`)
return result.replace(replyTimeRegex, `<span class="reply-time">$1&nbsp;&nbsp;${item.reply_control.location ?? "IP属地:未知"}</span>`)
}
bbComment.prototype._createListCon = new Proxy(createListCon, { apply: applyHandler })
bbComment.prototype._createSubReplyItem = new Proxy(createSubReplyItem, { apply: applyHandler })
Expand Down
2 changes: 1 addition & 1 deletion src/processors/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const getIPAddress = (replyItemEl: HTMLDivElement): string => {
? replyItemEl.querySelector('.reply-content')
: replyItemEl
) as ReplyItem)?.__vnode?.ctx?.props?.reply?.reply_control?.location
return IPString ? `&nbsp;&nbsp;${IPString}` : ""
return `&nbsp;&nbsp;${IPString ?? "IP属地:未知"}`
}


Expand Down

0 comments on commit 940dcbe

Please sign in to comment.