Skip to content

Commit

Permalink
Chrome extension v2
Browse files Browse the repository at this point in the history
  • Loading branch information
payne911 committed Jan 17, 2023
1 parent 6cb30be commit 63b9a3c
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 333 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Sometimes, a project might be abandoned, or someone had a different idea of how
## Table of Content
* [Releases](#releases)
* [Online tool](#online-tool)
* [Chrome extension](#chrome-extension-wip) (WIP)
* [Chrome extension](#chrome-extension)
* [`refined-github`](#refined-github)
* [Bookmarklet](#bookmarklet)
* [How it works](#how-it-works)
Expand All @@ -26,8 +26,8 @@ Sometimes, a project might be abandoned, or someone had a different idea of how

## Releases
The project is released as:
1. A website: great for people that just want to use this tool occasionally.
2. A Chrome extension: has the advantage of always performing the search whenever you open a project's GitHub Forks page.
1. A website
2. A Chrome extension
3. A feature in [`refined-github`](https://github.com/sindresorhus/refined-github)
4. A bookmarklet

Expand All @@ -38,19 +38,20 @@ You can query repository directly with the URL. Here is an example: https://usef

![website example](media/website_demo.gif)

### Chrome extension (WIP)
### Chrome extension
Not published yet. If you want to install it:
1. Clone this repository
2. Change the [script file](plugin/useful-forks.js#L1) so that `GITHUB_ACCESS_TOKEN`'s value is that of an [Access Token](https://github.com/settings/tokens/new?description=useful-forks%20(no%20scope%20required))
3. Go to the `chrome://extensions` URL
4. Enable `Developer mode` (switch at the top-right)
5. Click `Load unpacked` (button at the top-left)
6. Select the [`plugin` folder](plugin)
2. Go to the `chrome://extensions` URL
3. Enable `Developer mode` (switch at the top-right)
4. Click `Load unpacked` (button at the top-left)
5. Select the [`plugin` folder](plugin)

Once it's activated, the extension will automatically trigger itself whenever you open a Fork page, as shown by the GIF below:
Once it's activated, the extension will automatically add a new "Useful" button, as shown by the GIF below:

![example](media/chrome_extension_demo.gif)

This button will only appear when you visit GitHub repositories, and clicking it opens a new tab that will automatically trigger a search using [the online tool](#online-tool).

### `refined-github`
[`refined-github`](https://github.com/sindresorhus/refined-github) is an ensemble of tools and tweaks aimed at improving your GitHub experience.

Expand Down Expand Up @@ -97,5 +98,5 @@ Whenever you want to test changes to the `src/queries-logic.js` file, you will n
* Implement authenticated requests to the GitHub API (which increases the limit of calls)
* Added some minimal feedback for certain edge-cases
* Created an actual website for the feature
* Position the chrome extension's results where they won't move the other links of the page
* The Chrome extension leads to the (more powerful) website
* Thanks to [`star-history`](https://star-history.t9t.io/#useful-forks/useful-forks.github.io)'s [open-source website](https://github.com/bytebase/star-history/tree/c0e7aa7cc01d5bab9188fc7d2a2bac409d2915ec/website) which I adapted for this project
Binary file modified media/chrome_extension_demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin/images/useful-forks-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin/images/useful-forks-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin/images/useful-forks-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugin/images/useful-forks-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions plugin/jquery-3.6.0.min.js

This file was deleted.

15 changes: 9 additions & 6 deletions plugin/manifest.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
{
"name": "Useful Forks",
"version": "1.7",
"description": "Displays GitHub forks ordered by stars, with additional information and automatic filtering of irrelevant ones.",
"version": "2.0",
"description": "To list GitHub forks ordered by stars, with additional information and automatic filtering of irrelevant ones.",
"permissions": [
"*://github.com/*",
"*://api.github.com/*",
"storage"
"*://github.com/*"
],
"icons": {
"16": "images/useful-forks-16.png",
"32": "images/useful-forks-32.png",
"48": "images/useful-forks-32.png",
"128": "images/useful-forks-128.png"
},
"content_scripts": [
{
"matches": [
"*://github.com/*/*"
],
"js": [
"jquery-3.6.0.min.js",
"useful-forks.js"
],
"run_at": "document_idle",
Expand Down
Loading

1 comment on commit 63b9a3c

@payne911
Copy link
Collaborator Author

@payne911 payne911 commented on 63b9a3c Jan 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Celebrating the 900th star!

  • Entirely rewrote the plugin: no more duplicated code!
  • The functionality makes a lot more sense now
  • A lot less code to maintain
  • jQuery is not needed anymore
  • Shiny new set of (the same) icon

Motivation: accessing the "forks list" page is harder than before, so the extension had lost a lot of value. This is now a much better approach.

Please sign in to comment.