()
| 399 | document.head.appendChild(style) |
| 400 | |
| 401 | function remove() { |
| 402 | // 无需确认的元素 |
| 403 | const selectors = [ |
| 404 | //dashboard 同上css |
| 405 | '.copilotPreview__container', |
| 406 | |
| 407 | //dashboard 同上css |
| 408 | '.copilot-dashboard-entrypoint', |
| 409 | |
| 410 | // 左侧边栏 |
| 411 | 'a[data-analytics-event*="COPILOT"]', |
| 412 | |
| 413 | // 右侧边栏 |
| 414 | 'a[href="/settings/copilot"]', |
| 415 | |
| 416 | // commits 页面 询问差异 Copilot |
| 417 | 'li[role="menuitem"].prc-ActionList-ActionListItem-uq6I7' |
| 418 | |
| 419 | ] |
| 420 | selectors.forEach(selector => { |
| 421 | document.querySelectorAll(selector).forEach(element => element.remove()) |
| 422 | }) |
| 423 | // https://github.com/outslept/userscripts/blob/master/dont-wanna-see-copilot/userscript.js |
| 424 | //! 需要判断的元素 |
| 425 | // issue |
| 426 | document.querySelectorAll('div[data-testid="sidebar-section"]').forEach(s => { |
| 427 | if (s.textContent.includes('Development')) s.remove() |
| 428 | }) |
| 429 | |
| 430 | document.querySelectorAll('.flash-messages .flash-warn').forEach(w => { |
| 431 | if (w.textContent.includes('Copilot')) w.remove() |
| 432 | }) |
| 433 | |
| 434 | const m = document.querySelector('.flash-messages') |
| 435 | if (m && !m.children.length) m.remove() |
| 436 | |
| 437 | // 可自定义开启或者关闭的元素 |
| 438 | const ButtonGroup = document.querySelector('#repos-sticky-header [class*=\'ButtonGroup\']') |
| 439 | const CopilotChat = document.querySelector('.AppHeader-CopilotChat') |
| 440 | if (FUCK_FILE_COPILOT && ButtonGroup) ButtonGroup.style.display = 'none' |
| 441 | if (FUCK_HEAD_COPILOT && CopilotChat) CopilotChat.style.display = 'none' |
| 442 | |
| 443 | } |
| 444 | |
| 445 | new MutationObserver(remove).observe(document.body, { |
| 446 | childList: true, |
nothing calls this directly
no outgoing calls
no test coverage detected