Skip to content

Instantly share code, notes, and snippets.

@kubosho
Last active May 31, 2016 00:51
Show Gist options
  • Select an option

  • Save kubosho/a20fb597e5c7c7f904d298ef515efc75 to your computer and use it in GitHub Desktop.

Select an option

Save kubosho/a20fb597e5c7c7f904d298ef515efc75 to your computer and use it in GitHub Desktop.
for ScriptAutoRunner
(() => {
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