Skip to content
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ Thanks for contributing! 🦋🙌
- [](# "show-open-prs-of-forks") [In your forked repos, shows number of your open PRs to the original repo.](https://user-images.githubusercontent.com/1922624/76398271-e0648500-637c-11ea-8210-53dda1be9d51.png)
- [](# "go-to-action-from-file") [Adds a link to access the past runs of a GitHub Action workflow when seeing the workflow configuration file.](https://user-images.githubusercontent.com/1402241/80146153-ab6d6400-85b1-11ea-9f38-e87950692a62.png)
- [](# "fork-source-link-same-view") [Points the “Forked from user/repository” link to current folder or file in the upstream repository.](https://user-images.githubusercontent.com/1402241/84795784-3722d000-aff8-11ea-9b34-97c01acf4fd4.png)
- [](# "cleanup-repo-filelist-actions") [Replaces the labels of some simple buttons on repository filelists with icons, making them take less space.](https://user-images.githubusercontent.com/44045911/88551471-7a3f7c80-d055-11ea-82f1-c558b7871824.png)

<!-- Refer to style guide above. Keep this message between sections. -->

Expand Down
47 changes: 47 additions & 0 deletions source/features/cleanup-repo-filelist-actions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from 'dom-chef';
import select from 'select-dom';
import PlusIcon from 'octicon/plus.svg';
import SearchIcon from 'octicon/search.svg';
import * as pageDetect from 'github-url-detection';

import features from '.';
import {groupButtons} from '../github-helpers/group-buttons';

function init(): void {
const searchButton = select('.btn[data-hotkey="t"]')!;
searchButton.classList.add('tooltipped', 'tooltipped-ne');
searchButton.setAttribute('aria-label', 'Go to file');
searchButton.firstChild!.replaceWith(<SearchIcon/>);

const addButtonWrapper = searchButton.nextElementSibling!;
const addButton = select('.dropdown-caret', addButtonWrapper)?.parentElement;
if (addButton) {
addButton.classList.add('d-md-block', 'tooltipped', 'tooltipped-ne');
addButton.classList.remove('d-md-flex', 'ml-2');
addButton.setAttribute('aria-label', 'Add file');
addButton.textContent = '';
addButton.append(<PlusIcon/>);

searchButton.classList.remove('mr-2');
groupButtons([searchButton, addButtonWrapper]);
}

const downloadButton = select('get-repo details');
if (downloadButton) {
downloadButton.classList.add('tooltipped', 'tooltipped-ne');
downloadButton.setAttribute('aria-label', 'Clone or download');
select('.octicon-download', downloadButton)!.nextSibling!.remove();
}
}

void features.add({
id: __filebasename,
description: 'Replaces the labels of some simple buttons on repository filelists with icons, making them take less space.',
screenshot: 'https://user-images.githubusercontent.com/44045911/88551471-7a3f7c80-d055-11ea-82f1-c558b7871824.png'
}, {
include: [
pageDetect.isRepoTree,
pageDetect.isSingleFile
],
init
});
1 change: 1 addition & 0 deletions source/refined-github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ import './features/pr-jump-to-first-non-viewed-file';
import './features/keyboard-navigation';
import './features/vertical-front-matter';
import './features/use-first-commit-message-for-new-prs';
import './features/cleanup-repo-filelist-actions';

// Add global for easier debugging
(window as any).select = select;