From 120543a1264128fca0929357a7afab83e5237037 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 8 Jul 2023 14:54:42 +0900 Subject: [PATCH 1/3] Hide "Achievements" --- CONTRIBUTING.md | 10 ++++++++++ README.md | 1 + static/style.css | 1 + 3 files changed, 12 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f437877..421af2f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,6 +26,16 @@ Built to out/depop-0.0.0.12.zip: ... ``` +## How to struggle with CSS selector? + +In the Chrome Developer Tools, type the following in the console. + +```javascript +document.querySelectorAll("div:has(> h2 a[href$='?tab=achievements'])"); +``` + +Then expand the `NodeList(2)`, and hover to them, chrome tells us where the element is. + ## Release 1. Bump version in [manifest file](manifest.json) diff --git a/README.md b/README.md index b109c30..1396da8 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Some features can be hidden by enabling them on the [Options page](https://devel - Pinned Repositories - "Explore repositories" and/or the stars - Sponsors +- Achievements # 0.0.0.13+ ### Covered third party features diff --git a/static/style.css b/static/style.css index 42efe46..e1b1b9c 100644 --- a/static/style.css +++ b/static/style.css @@ -14,6 +14,7 @@ a:has(> img[data-canonical-src^='https://github-readme-stats.vercel.app/api?']) } li:has(> a[href$='/followers']), +div:has(> h2 a[href$='?tab=achievements']), div[aria-label='Explore repositories'] div:has(> svg[aria-label='star']) { display: none !important; } From 7ae4d7f6f591a21c737d0fd8bb9b3c6f20a3b9be Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 8 Jul 2023 15:06:20 +0900 Subject: [PATCH 2/3] Hide "Highlights" --- README.md | 7 ++++--- src/main.ts | 13 +++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1396da8..4bcf673 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![CI](https://github.com/kachick/depop/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/kachick/depop/actions/workflows/ci.yml?query=event%3Apush++) -A Chrome Extension to hide stars, followers and watchers in GitHub +A Chrome Extension to hide stars, followers, watchers, sponsors, and other stats on GitHub ![Screen Shot](assets/screenshot-overview.png) @@ -25,7 +25,7 @@ Some features can be hidden by enabling them on the [Options page](https://devel ![Screen Shot](assets/screenshot-options.png) -## Covered GitHub features +## Suppressable GitHub stats - User - Repository index @@ -34,8 +34,9 @@ Some features can be hidden by enabling them on the [Options page](https://devel - "Explore repositories" and/or the stars - Sponsors - Achievements # 0.0.0.13+ +- Highlights # 0.0.0.13+ -### Covered third party features +### Suppressable third party stats - [GitHub Readme Stats](https://github.com/anuraghazra/github-readme-stats) diff --git a/src/main.ts b/src/main.ts index ab55b7b..2a1ff0d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -38,3 +38,16 @@ chrome.storage.sync.get([ } } }); + +const highlightsH2Node = document.evaluate( + '/html/body//div[@class=\'Layout-sidebar\']//h2[text()=\'Highlights\']', + document, + null, + XPathResult.FIRST_ORDERED_NODE_TYPE, + null, +).singleNodeValue; + +const highlightsComponent = highlightsH2Node?.parentElement; +if (highlightsComponent) { + hide(highlightsComponent); +} From 06024037214299470233fcba6e9770e3f2430d65 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 8 Jul 2023 15:07:03 +0900 Subject: [PATCH 3/3] Bump version to 0.0.0.13 --- CONTRIBUTING.md | 2 +- manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 421af2f..f180552 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ Available tasks: ```console > deno task build ... -Built to out/depop-0.0.0.12.zip: +Built to out/depop-0.0.0.13.zip: ... ``` diff --git a/manifest.json b/manifest.json index d5e0bb4..a74be5e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "depop", "description": "Hide stars, followers and watchers in GitHub", - "version": "0.0.0.12", + "version": "0.0.0.13", "manifest_version": 3, "homepage_url": "https://github.com/kachick/depop", "permissions": [