Skip to content

Commit

Permalink
Merge pull request #31 from kachick/achivements-highlights
Browse files Browse the repository at this point in the history
Hide "Achivements" and "Highlights"
  • Loading branch information
kachick authored Jul 8, 2023
2 parents 70de962 + 0602403 commit 6fb2877
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
12 changes: 11 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,20 @@ Available tasks:
```console
> deno task build
...
Built to out/depop-0.0.0.12.zip:
Built to out/depop-0.0.0.13.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)
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -25,16 +25,18 @@ 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
- Repository detail
- Pinned Repositories
- "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)

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
13 changes: 13 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
1 change: 1 addition & 0 deletions static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 6fb2877

Please sign in to comment.