{"id":13430058,"url":"https://github.com/maxchang3/Bilibili-Web-Show-IP-Location","last_synced_at":"2025-03-16T05:30:24.258Z","repository":{"id":168582222,"uuid":"644335737","full_name":"maxchang3/Bilibili-Web-Show-IP-Location","owner":"maxchang3","description":"Show IP location on the Bilibili web version. 显示哔哩哔哩 Web 端 IP 属地。目前支持的场景有：视频（普通视频、番剧（影视）、收藏列表播放页）、动态、个人主页动态、专栏（文章） 、拜年祭、课程、小黑屋等。","archived":false,"fork":false,"pushed_at":"2025-03-10T14:24:40.000Z","size":1428,"stargazers_count":131,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T18:06:55.638Z","etag":null,"topics":["bilibili","tampermonkey","tampermonkey-userscript","userscript"],"latest_commit_sha":null,"homepage":"https://greasyfork.org/scripts/466815","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxchang3.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-23T09:59:36.000Z","updated_at":"2025-03-12T10:36:28.000Z","dependencies_parsed_at":"2024-01-17T19:08:48.595Z","dependency_job_id":"8c834d85-91a3-41f8-9853-bf0f74c3f131","html_url":"https://github.com/maxchang3/Bilibili-Web-Show-IP-Location","commit_stats":{"total_commits":247,"total_committers":4,"mean_commits":61.75,"dds":"0.28744939271255066","last_synced_commit":"126d8e8d3cce6e83d4b2f2dda9df2c94e0025ba7"},"previous_names":["maxchang3/bilibili-web-show-ip-address","maxchang3/bilibili-web-show-ip-location"],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxchang3%2FBilibili-Web-Show-IP-Location","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxchang3%2FBilibili-Web-Show-IP-Location/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxchang3%2FBilibili-Web-Show-IP-Location/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxchang3%2FBilibili-Web-Show-IP-Location/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxchang3","download_url":"https://codeload.github.com/maxchang3/Bilibili-Web-Show-IP-Location/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830912,"owners_count":20354848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bilibili","tampermonkey","tampermonkey-userscript","userscript"],"created_at":"2024-07-31T02:00:49.637Z","updated_at":"2025-03-16T05:30:24.252Z","avatar_url":"https://github.com/maxchang3.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","篡改猴脚本"],"sub_categories":["主站脚本"],"readme":"\u003e [!IMPORTANT]\n\u003e 由于本脚本的逻辑是根据不同的 URL 路由来对应相应的场景，而 B 站前端的评论区代码实际上混合了三种不同的实现方式，因此每次 B 站前端更新都有可能导致原有逻辑失效。如果遇到相关场景无法正常显示的情况，欢迎及时反馈。\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./assets/banner.svg\" width = \"50%\"\u003e\n    \u003cimg src=\"./assets/preview.png\" width = \"50%\"\u003e\n\u003c/p\u003e\n\n# 哔哩哔哩网页版显示 IP 属地\n\n# Bilibili-Web-Show-IP-Location\n\n\u003e 我不喜欢 IP 属地，但是你手机都显示了，为什么电脑不显示呢？\n\n目前支持的场景有（未作特殊说明均支持新旧版）：\n\n- 视频（普通视频、番剧（影视）、收藏列表播放页）评论区\n- 动态评论区\n- 个人主页动态评论区\n- 专栏（文章）作者 \u0026 评论区\n- 节日页（festival）评论区（如「拜年祭」」\n- 活动页（blackboard）评论区（如「拜年祭预约页）」\n- 课程评论区\n- 小黑屋评论区\n- 漫画详情页评论区\n\n    **受限于接口限制，个人主页 IP 显示目前不在考虑范围内**\n\n仅测试于 Chrome 113+ ([tampermonkey](https://github.com/Tampermonkey/tampermonkey)) / Safari 16.4+ ([Stay](https://github.com/shenruisi/Stay))。**需要使用支持 [unsafeWindow](https://www.tampermonkey.net/documentation.php#api:unsafeWindow) API 的脚本管理器**\n\n## 安装\n\n[[Greasy Fork](https://greasyfork.org/zh-CN/scripts/466815)] [[Github Release](https://github.com/MaxChang3/Bilibili-Web-Show-IP-Location/releases/latest/download/bilibili-web-show-ip-location.user.js)]\n\n## 常见问题\n\n- **我的评论区没有显示 IP 属地？**\n    - 请确定你所在的场景是否支持，脚本是否为最新版本，脚本是否正常运行。\n    - 请关闭同页面内的其他相关脚本，排除脚本冲突的可能。\n    - B 站的 IP 属地功能上线之前的评论将不会显示 IP 属地。\n    - 排除以上情况后，可能是脚本逻辑失效，欢迎反馈。\n- **个人主页的 IP 属地 没有显示？**\n    - 个人主页的 IP 属地显示需要调用移动端的接口，目前没有找到合适的方法，所以暂时不支持。\n\n## 原理\n\n目前，哔哩哔哩前端的评论区实现方式有三种：\n\n- 旧版评论：基于 Vue 2 实现，目前仅在旧版页面和部分场景存在。\n\n    - 策略：通过 Hook `window.bbComment` ，重写评论插入事件，插入 IP 属地。\n\n- 新版评论：基于 Vue 3 实现（comment-pc-vue.next.js），目前存在于新版的大部分场景。新版设计较旧版更加紧凑和扁平化，字体也更大。\n\n    - 策略：通过 [Hook Vue3 app](https://greasyfork.org/scripts/449444)（自 V1.5.8+，之前无须挂载） 挂载不同的 `__vue__` 到相应元素。通过 `MutationObserver` 监听评论插入事件，获取评论元素中的 IP 属地并插入。\n\n- 新·新版评论：基于 Lit 的 Web Component（comment-pc-elements.next.js），目前存在于部分新版页面。\n    - 策略：通过 Hook `window.customElements.define` 的方式，拦截 `ActionButtonsRender`，继承并重写 `update()` 方法，插入 IP 属地。\n\n## 感谢\n\n- [B站评论区开盒](https://greasyfork.org/zh-CN/scripts/448434)\n\n    - 灵感来源\n    - 参考了部分代码\n\n- [vite-plugin-monkey](https://github.com/lisonge/vite-plugin-monkey)\n\n    - 提供最佳开发体验\n\n- [Hook Vue3 app](https://greasyfork.org/scripts/449444)\n\n    - 提供了继续保持原有脚本逻辑的底层支持\n\n- 帮助测试 \u0026 提供反馈的朋友们\n\n## Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/maxchang3/Bilibili-Web-Show-IP-Location.svg?variant=adaptive)](https://starchart.cc/maxchang3/Bilibili-Web-Show-IP-Location)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxchang3%2FBilibili-Web-Show-IP-Location","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxchang3%2FBilibili-Web-Show-IP-Location","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxchang3%2FBilibili-Web-Show-IP-Location/lists"}