Move page detection checks to a separate file#123
Merged
Conversation
extension/content.js
Outdated
| const ownerName = path.split('/')[1]; | ||
| const repoName = path.split('/')[2]; | ||
| const segments = location.pathname.split('/'); | ||
| const ownerName = segments[1]; |
Contributor
There was a problem hiding this comment.
Stylistic: How about const [, ownerName, repoName] = location.pathname.split('/');?
Member
There was a problem hiding this comment.
👍 Destructuring became available in Chrome 49, so we can start using it now. (Need to bump the min Chrome version in the manifest.
Member
|
This probably also needs an update because of #112 (comment). |
Closes #120 In this change I've tried to improve readability and consistency and not focus on performance as microoptimisations in these checks are not worth it. Except for moving the checks to a separate file I've unified them a bit and made some fixes: - simplified and unified dashboard regular expressions - made all regex checks nested under a repo consistent - re-used as much as possible especially for commit checks - simplified repo root check - fixed repo root check with `tree` in the regex for repositories like https://github.com/react-component/tree - tried to use consistent naming and order of the methods - fixed a few regular expressions not taking trailing slash in the URL into account
Contributor
Author
|
I think I've addressed all comments. /cc @sindresorhus @DrewML |
Contributor
|
LGTM! |
busches
added a commit
that referenced
this pull request
Mar 15, 2019
This changes the 'Diff settings' text to the settings icon and removes the whitespace options if `diff-view-without-whitespace-options` is enabled. Example URL: https://github.com/sindresorhus/refined-github/pull/1146/files Closes #1292  <!-- The more the merrier! 🍻 Thanks for contributing! 1. List some URLs that reviewers can use to test your PR 2. Make sure you specify the issue you're fixing/closing, if any, following this format: Fixes #123 Closes #56 -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #120.
In this change I've tried to improve readability and consistency and not focus so much on performance as microoptimisations in these checks are not worth it.
Except for moving the checks to a separate file I've unified them a bit and made some fixes:
treein the regex for repositories like https://github.com/react-component/tree