Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules/
github-usernames.user-srcipt.js
github-usernames.user-script.js
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ https://github.com/orgs/community/discussions/61959

The script available here swaps usernames with preferred names from profiles ex. Jim Helper, Jim H. (if available). It allows you to set custom names for picked users and limit these options only to users with specific patterns in their usernames. For instance limit to `dundermifflin` would swap names only for this organization.

## Instalation
## Installation

1. Install https://www.tampermonkey.net/ - It is a very popular browser extension that allows you to add custom scripts to selected domains.

Expand All @@ -21,7 +21,7 @@ The script available here swaps usernames with preferred names from profiles ex.

2. Go to https://deykun.github.io/github-usernames/github-usernames.user.js

![Instalation demo](docs/demo-install.gif)
![Installation demo](docs/demo-install.gif)

### Saving users names

Expand Down
10 changes: 6 additions & 4 deletions docs/CONTRIBUTION.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Contribution

# One-time setup
1. Install `src/user-script/dev.user-srcipt.js`.
## One-time setup

1. Install `src/user-script/dev.user-script.js`.
2. In the "Settings" tab of Tampermonkey, check the box for waiting on update.
3. Provide the address `http://localhost:1234/server.user-script.js`.
4. Install dependecies `npm ci`
4. Install dependencies `npm ci`

## Using the script

# Using the script
1. Run `npm run dev-us` in one terminal - It builds the script from base files and watches changes
2. Run `npm run dev-us-server` in another terminal - serves the dev script as a dependency
3. [make changes to scripts]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "github-usernames",
"private": true,
"version": "1.1.2",
"version": "1.1.3",
"type": "module",
"author": "Szymon Tondowski",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion processes/dev-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ console.log('(An updated version of the script will be downloaded when you check
console.log('');

userScriptApp.get('/server.user-script.js', (req, res) => {
const devScript = fs.readFileSync('src/user-script/dev.user-srcipt.js', 'utf-8');
const devScript = fs.readFileSync('src/user-script/dev.user-script.js', 'utf-8');

const version = `2.${Math.floor((new Date()).getTime() / 1000)}`;

Expand Down
3 changes: 0 additions & 3 deletions processes/utils.ts

This file was deleted.

10 changes: 5 additions & 5 deletions public/github-usernames.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @description Replace ambiguous usernames with actual names from user profiles.
// @namespace deykun
// @author deykun
// @version 1.1.2
// @version 1.1.3
// @include https://github.com*
// @grant none
// @run-at document-start
Expand Down Expand Up @@ -31,12 +31,12 @@ const getUsersByUsernamesFromLS = () => getFromLocalStorage('u2n-users');
const getCustomNamesByUsernamesFromLS = () => getFromLocalStorage('u2n-users-names');

window.U2N = {
version: '1.1.2',
version: '1.1.3',
isDevMode: false,
cache: {
HTML: {},
CSS: {},
inited: false,
wasInited: false,
status: null,
location: location.href,
},
Expand Down Expand Up @@ -84,11 +84,11 @@ const domReady = (fn) => {
};

const initU2N = async () => {
if (window.U2N.cache.inited) {
if (window.U2N.cache.wasInited) {
return;
}

window.U2N.cache.inited = true;
window.U2N.cache.wasInited = true;

try {
const updateStatus = ({ type = '', text = '', durationInSeconds = 4 }) => {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/user-script/parts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ window.U2N = {
cache: {
HTML: {},
CSS: {},
inited: false,
wasInited: false,
status: null,
location: location.href,
},
Expand Down
2 changes: 1 addition & 1 deletion src/user-script/parts/helpers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { upperCaseFirstLetter } from './helpers';

describe('upperCaseFirstLetter', () => {
it('upperCaseFirstLetter() - should capitalize', () => {
expect(upperCaseFirstLetter('jonh')).toBe('Jonh');
expect(upperCaseFirstLetter('john')).toBe('John');
});
});
4 changes: 2 additions & 2 deletions src/user-script/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ const domReady = (fn) => {
};

const initU2N = async () => {
if (window.U2N.cache.inited) {
if (window.U2N.cache.wasInited) {
return;
}

window.U2N.cache.inited = true;
window.U2N.cache.wasInited = true;

try {
/* import @/db.js */
Expand Down