Skip to content

Commit 96dad35

Browse files
committed
Fix extension button.
1 parent 51affd7 commit 96dad35

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

src/strings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default {
22
extension: {
33
alreadyInstalled: 'Already installed',
4-
addToChrome: 'Add to Chrome',
4+
addToBrowser: 'Add to Browser',
55
shareThisJwt: 'Share this JWT',
66
jwtIoUrlCopied: 'Copied',
77
noJwtsFound: 'No JWTs found',

src/website/extension.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,33 +45,35 @@ export function setupExtensionButton() {
4545

4646
// chrome.webstore.install can only be called from standard event handlers.
4747
extensionButton.addEventListener('click', () => {
48-
const url = 'https://chrome.google.com/webstore/detail/' +
49-
'jwt-debugger/ppmmlchacdbknfphdeafcbmklcghghmd';
48+
const chromeUrl = 'https://chrome.google.com/webstore/detail/' +
49+
'jwt-debugger/ppmmlchacdbknfphdeafcbmklcghghmd';
50+
const firefoxUrl = 'https://addons.mozilla.org/en-US/firefox' +
51+
'/addon/jwtio-debugger/';
5052

51-
if (button.classList.contains('is-installed')) {
53+
if (extensionButton.classList.contains('is-installed')) {
5254
return;
5355
}
5456

55-
function notInstalled() {
57+
function notInstalled(url) {
5658
extensionButton.classList.remove('is-installed');
5759
extensionButtonText.firstChild.textContent =
58-
strings.extension.addToChrome;
60+
strings.extension.addToBrowser;
5961
window.open(url);
6062
}
6163

6264
if(isChrome()) {
6365
try {
64-
chrome.webstore.install(url, () => {
66+
chrome.webstore.install(chromeUrl, () => {
6567
button.classList.add('is-installed');
6668
setInstalledText();
6769
}, () => {
68-
notInstalled();
70+
notInstalled(chromeUrl);
6971
});
7072
} catch (e) {
71-
notInstalled();
73+
notInstalled(chromeUrl);
7274
}
7375
} else {
74-
notInstalled();
76+
notInstalled(firefoxUrl);
7577
}
7678
});
7779
}

views/website/extension.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ section.update-site
1414
use(fill='black', fill-opacity='1', filter='url(#filter-2)', xlink:href='#path-1')
1515
use(fill='#FFFFFF', fill-rule='evenodd', xlink:href='#path-1')
1616

17-
span.button-text Add to chrome
17+
span.button-text Add to Browser

0 commit comments

Comments
 (0)