From 34ed562c3615b0bc639cd1e294d91360b585886d Mon Sep 17 00:00:00 2001 From: Federico Brigante Date: Sun, 18 Jun 2017 15:15:43 +0800 Subject: [PATCH] Merge identical conditions in init --- src/content.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/content.js b/src/content.js index 6dc10a6..33e6196 100644 --- a/src/content.js +++ b/src/content.js @@ -553,6 +553,11 @@ function init() { if (pageDetect.isPR() || pageDetect.isIssue()) { linkifyIssuesInTitles(); + + markUnread.setup(); + + addOPLabels(); + new MutationObserver(addOPLabels).observe(select('.new-discussion-timeline'), {childList: true, subtree: true}); } if (pageDetect.isRepoRoot() || pageDetect.isRepoTree()) { @@ -574,6 +579,7 @@ function init() { if (diffElements) { new MutationObserver(removeDiffSigns).observe(diffElements, {childList: true, subtree: true}); } + addDiffViewWithoutWhitespaceOption(); } if (pageDetect.isPR() || pageDetect.isIssue() || pageDetect.isCommit()) { @@ -582,10 +588,6 @@ function init() { showRealNames(); } - if (pageDetect.hasDiff()) { - addDiffViewWithoutWhitespaceOption(); - } - if (pageDetect.isCommitList()) { markMergeCommitsInList(); } @@ -600,16 +602,6 @@ function init() { enableCopyOnY.setup(); } - if (pageDetect.isPR() || pageDetect.isIssue()) { - markUnread.setup(); - } - - if (pageDetect.isIssue() || pageDetect.isPR()) { - addOPLabels(); - - new MutationObserver(addOPLabels).observe(select('.new-discussion-timeline'), {childList: true, subtree: true}); - } - if (pageDetect.isMilestone()) { addMilestoneNavigation(); }