Skip to content

Commit

Permalink
Change HTML injection to wait until "Files changed" tab is open. (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevennoto authored and Brent Yates committed Jan 31, 2018
1 parent ccba64c commit 6f7acc8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions github.com.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ var repositoryName;
var repositoryAuthor;
var autoCollapseExpressions;

function htmlIsInjected() {
return $('.pretty-pull-requests-inserted').length > 0;
function htmlShouldBeInjected() {
return $('a[href$="/files"].tabnav-tab.selected').length > 0 && $('.pretty-pull-requests-inserted').length <= 0;
}

function injectHtml() {
Expand Down Expand Up @@ -197,7 +197,7 @@ chrome.storage.sync.get({url: '', saveCollapsedDiffs: true, tabSwitchingEnabled:
autoCollapseExpressions = items.autoCollapseExpressions;

var injectHtmlIfNecessary = function () {
if (!htmlIsInjected()) {
if (htmlShouldBeInjected()) {
collectUniquePageInfo();
injectHtml();
initDiffs();
Expand Down

0 comments on commit 6f7acc8

Please sign in to comment.