()
| 181 | } |
| 182 | |
| 183 | function findInboxLink() { |
| 184 | const selectors = [ |
| 185 | 'a[href*="#inbox"]', |
| 186 | 'a[aria-label*="收件箱"]', |
| 187 | 'a[aria-label*="Inbox"]', |
| 188 | ]; |
| 189 | |
| 190 | for (const selector of selectors) { |
| 191 | const candidates = Array.from(document.querySelectorAll(selector)); |
| 192 | const visible = candidates.find(isVisibleElement); |
| 193 | if (visible) return visible; |
| 194 | if (candidates[0]) return candidates[0]; |
| 195 | } |
| 196 | |
| 197 | return Array.from(document.querySelectorAll('a, [role="link"]')).find((element) => { |
| 198 | const text = normalizeText( |
| 199 | element.getAttribute('aria-label') |
| 200 | || element.getAttribute('title') |
| 201 | || element.textContent |
| 202 | ); |
| 203 | return /收件箱|Inbox/i.test(text); |
| 204 | }) || null; |
| 205 | } |
| 206 | |
| 207 | const GMAIL_CATEGORY_LABELS = { |
| 208 | primary: [/^primary$/i, /^inbox$/i, /^主要$/], |
no test coverage detected