Skip to content

Commit

Permalink
Add download folder button (refined-github#951)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante authored Jan 17, 2018
1 parent 9d37a8a commit 2335a3f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ GitHub Enterprise is also supported. More info in the options.
- [Adds a link in a user's profile to their public gists](https://user-images.githubusercontent.com/11544418/34268306-1c974fd2-e678-11e7-9e82-861dfe7add22.png)
- [Adds a 'Jump to bottom' link to discussion pages](https://user-images.githubusercontent.com/4331946/34298950-93876584-e720-11e7-898a-96f85e31aefe.png)
- [Adds a 'Your repositories' link to user profile dropdown](https://user-images.githubusercontent.com/4201088/34920280-479e2454-f996-11e7-8e24-ad69793b9d9b.png)
- [Adds a 'Download folder' button to repos](https://user-images.githubusercontent.com/1402241/35044451-fd3e2326-fbc2-11e7-82e1-61ec7bee612b.png)

### More info at a glance

Expand Down
2 changes: 2 additions & 0 deletions source/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import extendDiffExpander from './features/extend-diff-expander';
import sortIssuesByUpdateTime from './features/sort-issues-by-update-time';
import makeDiscussionSidebarSticky from './features/make-discussion-sidebar-sticky';
import shortenLinks from './features/shorten-links';
import addDownloadFolderButton from './features/add-download-folder-button';
import hideUselessNewsfeedEvents from './features/hide-useless-newsfeed-events';

import * as pageDetect from './libs/page-detect';
Expand Down Expand Up @@ -145,6 +146,7 @@ function ajaxedPagesHandler() {
enableFeature(sortIssuesByUpdateTime);
enableFeature(shortenLinks);
enableFeature(linkifyCode);
enableFeature(addDownloadFolderButton);

if (pageDetect.isIssueSearch() || pageDetect.isPRSearch()) {
enableFeature(addYoursMenuItem);
Expand Down
17 changes: 17 additions & 0 deletions source/features/add-download-folder-button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {h} from 'dom-chef';
import select from 'select-dom';
import * as pageDetect from '../libs/page-detect';

export default () => {
if (pageDetect.isRepoTree()) {
const buttonGroup = select(`.file-navigation .BtnGroup.float-right`);
if (buttonGroup) {
buttonGroup.prepend(
<a
class="btn btn-sm BtnGroup-item"
href={`https://download-directory.github.io/?url=${location.href}`}>
Download
</a>);
}
}
};

0 comments on commit 2335a3f

Please sign in to comment.