diff --git a/src/inject.js b/src/inject.js index 0b41076..d2cbc8a 100755 --- a/src/inject.js +++ b/src/inject.js @@ -4,8 +4,8 @@ , SHOWN = 'octotree.shown' , REGEXP = /([^\/]+)\/([^\/]+)(?:\/([^\/]+))?/ // (username)/(reponame)/(subpart) , RESERVED_USER_NAMES = [ - 'settings', 'orgs', 'organizations', - 'site', 'blog', 'about', + 'settings', 'orgs', 'organizations', + 'site', 'blog', 'about', 'styleguide', 'showcases', 'trending', 'stars', 'dashboard', 'notifications' ] @@ -82,7 +82,7 @@ var match = location.pathname.match(REGEXP) if (!match) return false - + // Not a repository, skip if (~RESERVED_USER_NAMES.indexOf(match[1])) return false if (~RESERVED_REPO_NAMES.indexOf(match[2])) return false @@ -90,8 +90,8 @@ // Not a code page, skip if (match[3] && !~['tree', 'blob'].indexOf(match[3])) return false - return { - username : match[1], + return { + username : match[1], reponame : match[2], branch : $('*[data-master-branch]').data('ref') || $('*[data-master-branch] > .js-select-button').text() || 'master' } @@ -163,6 +163,11 @@ else message = 'You have exceeded the GitHub API hourly limit and need GitHub access token to make extra requests. Follow this link to create one and paste it in the textbox below.' } + else if (err.error === 409) { + header = 'Repository is empty or not yet available!' + message = 'This repository is not ready for browsing yet. Follow this link for details.' + } + updateSidebar('