|
60 | 60 | } |
61 | 61 |
|
62 | 62 | switch (type) { |
63 | | - case 'watch': |
| 63 | + case 'watch': { |
64 | 64 | if (v === '2') { |
65 | 65 | counter.textContent = obj.data.subscribers_count && addCommas(obj.data.subscribers_count); |
66 | 66 | counter.setAttribute('aria-label', counter.textContent + ' watchers' + LABEL_SUFFIX); |
|
70 | 70 | } |
71 | 71 |
|
72 | 72 | break; |
73 | | - case 'star': |
| 73 | + } |
| 74 | + |
| 75 | + case 'star': { |
74 | 76 | counter.textContent = obj.data.stargazers_count && addCommas(obj.data.stargazers_count); |
75 | 77 | counter.setAttribute('aria-label', counter.textContent + ' stargazers' + LABEL_SUFFIX); |
76 | 78 | break; |
77 | | - case 'fork': |
| 79 | + } |
| 80 | + |
| 81 | + case 'fork': { |
78 | 82 | counter.textContent = obj.data.network_count && addCommas(obj.data.network_count); |
79 | 83 | counter.setAttribute('aria-label', counter.textContent + ' forks' + LABEL_SUFFIX); |
80 | 84 | break; |
81 | | - case 'follow': |
| 85 | + } |
| 86 | + |
| 87 | + case 'follow': { |
82 | 88 | counter.textContent = obj.data.followers && addCommas(obj.data.followers); |
83 | 89 | counter.setAttribute('aria-label', counter.textContent + ' followers' + LABEL_SUFFIX); |
84 | 90 | break; |
| 91 | + } |
85 | 92 | } |
86 | 93 |
|
87 | 94 | // Show the count if asked and if it's not empty |
|
98 | 105 |
|
99 | 106 | // Add the class, change the text label, set count link href |
100 | 107 | switch (type) { |
101 | | - case 'watch': |
| 108 | + case 'watch': { |
102 | 109 | if (v === '2') { |
103 | 110 | mainButton.className += ' github-watchers'; |
104 | 111 | text.textContent = 'Watch'; |
|
111 | 118 |
|
112 | 119 | title = text.textContent + ' ' + USER_REPO; |
113 | 120 | break; |
114 | | - case 'star': |
| 121 | + } |
| 122 | + |
| 123 | + case 'star': { |
115 | 124 | mainButton.className += ' github-stargazers'; |
116 | 125 | text.textContent = 'Star'; |
117 | 126 | counter.href = REPO_URL + '/stargazers'; |
118 | 127 | title = text.textContent + ' ' + USER_REPO; |
119 | 128 | break; |
120 | | - case 'fork': |
| 129 | + } |
| 130 | + |
| 131 | + case 'fork': { |
121 | 132 | mainButton.className += ' github-forks'; |
122 | 133 | text.textContent = 'Fork'; |
123 | 134 | button.href = REPO_URL + '/fork'; |
124 | 135 | counter.href = REPO_URL + '/network'; |
125 | 136 | title = text.textContent + ' ' + USER_REPO; |
126 | 137 | break; |
127 | | - case 'follow': |
| 138 | + } |
| 139 | + |
| 140 | + case 'follow': { |
128 | 141 | mainButton.className += ' github-me'; |
129 | 142 | text.textContent = 'Follow @' + user; |
130 | 143 | button.href = GITHUB_URL + user; |
131 | 144 | counter.href = GITHUB_URL + user + '?tab=followers'; |
132 | 145 | title = text.textContent; |
133 | 146 | break; |
134 | | - case 'sponsor': |
| 147 | + } |
| 148 | + |
| 149 | + case 'sponsor': { |
135 | 150 | mainButton.className += ' github-me'; |
136 | 151 | text.textContent = 'Sponsor @' + user; |
137 | 152 | button.href = GITHUB_URL + 'sponsors/' + user; |
138 | 153 | title = text.textContent; |
139 | 154 | break; |
| 155 | + } |
140 | 156 | } |
141 | 157 |
|
142 | 158 | button.setAttribute('aria-label', title + LABEL_SUFFIX); |
|
0 commit comments