From c80d91227d16aa943c2521780710fbd44f0c124a Mon Sep 17 00:00:00 2001 From: Haralan Dobrev Date: Mon, 21 Mar 2016 22:04:28 +0200 Subject: [PATCH] Consider PR files listing with 1 commit to be a commit view --- extension/content.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extension/content.js b/extension/content.js index 470610a..fe84f44 100755 --- a/extension/content.js +++ b/extension/content.js @@ -8,7 +8,13 @@ const isRepo = () => /^\/[^/]+\/[^/]+/.test(location.pathname); const isRepoRoot = () => location.pathname.replace(/\/$/, '') === `/${ownerName}/${repoName}` || /(\/tree\/)(\w|\d|\.)+(\/$|$)/.test(location.href); const isCompare = () => /^\/[^/]+\/[^/]+\/compare/.test(location.pathname); const isPR = () => /^\/[^/]+\/[^/]+\/pull\/\d+/.test(location.pathname) || /^\/[^/]+\/[^/]+\/pull\/\d+\/commits\/[0-9a-f]{5,40}/.test(location.pathname); -const isCommit = () => /^\/[^/]+\/[^/]+\/commit\/[0-9a-f]{5,40}/.test(location.pathname) || /^\/[^/]+\/[^/]+\/pull\/\d+\/commits\/[0-9a-f]{5,40}/.test(location.pathname); +const isCommit = () => { + if (/^\/[^/]+\/[^/]+\/commit\/[0-9a-f]{5,40}/.test(location.pathname) || /^\/[^/]+\/[^/]+\/pull\/\d+\/commits\/[0-9a-f]{5,40}/.test(location.pathname)) { + return true; + } + + return /^\/[^/]+\/[^/]+\/pull\/\d+\/files/.test(location.pathname) && $('.full-commit').length > 0; +}; const isIssue = () => /^\/[^/]+\/[^/]+\/issues\/\d+$/.test(location.pathname); const isReleases = () => /^\/[^/]+\/[^/]+\/(releases|tags)/.test(location.pathname); const isBlame = () => /^\/[^/]+\/[^/]+\/blame\//.test(location.pathname);