Last active
May 31, 2016 00:51
-
-
Save kubosho/a20fb597e5c7c7f904d298ef515efc75 to your computer and use it in GitHub Desktop.
for ScriptAutoRunner
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
| (() => { | |
| function callback () { | |
| if (location.host !== 'github.com') { | |
| return | |
| } | |
| if (/[?&]w=/.test(location.search)) { | |
| return | |
| } | |
| const pathname = location.pathname | |
| const isPullRequestPage = /files/.test(pathname) | |
| const isCommitPage = /commit(?!s)/.test(pathname) | |
| if (!(isPullRequestPage || isCommitPage)) { | |
| return | |
| } | |
| const hasQueryString = /\?/.test(location.search) | |
| if (hasQueryString) { | |
| location.href = `${location.href}&w=` | |
| } else { | |
| location.href = `${location.href}?w=` | |
| } | |
| } | |
| callback() | |
| document.addEventListener('pjax:end', callback, false) | |
| })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment