Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix focus effect on up-tree #3

Merged
merged 3 commits into from
Aug 13, 2016
Merged
Changes from 1 commit
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: 2 additions & 0 deletions src/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ var domUtils = {
addFileSizeAndDownloadLink: function () {
var links = document.querySelectorAll('tr.js-navigation-item > td.content a');
var ns = document.querySelectorAll('tr.js-navigation-item > td.age');
var uptree = document.querySelectorAll('tr.up-tree > td');

if (ns.length && ns.length === links.length) { // verify length for showing in-sync
apiUtils.getRepoContent(function (data) {
Copy link
Owner

@softvar softvar Aug 13, 2016

Choose a reason for hiding this comment

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

Add this


if (uptree && uptree[3]) {
  uptree[3].insertAdjacentHTML('afterend', '<td class="download"></td>');
}

just after the if line statement

Also, class="download" is necessary because when one navigates and comes back, the old element should be removed before adding the new one which is ensured by utils.removePrevInstancesOf('.download');

Expand Down Expand Up @@ -235,6 +236,7 @@ var domUtils = {
ns[i].insertAdjacentHTML('afterend', '<td></td>');
}
}
uptree[3].insertAdjacentHTML('afterend', '<td></td>');
Copy link
Owner

Choose a reason for hiding this comment

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

This will throw error if uptree is not defined, which is a valid case

});
}
}
Expand Down