Skip to content

Commit 7339a57

Browse files
committed
Inline install for Chrome's extension.
1 parent e3e67fb commit 7339a57

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

js/app.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,37 @@ $('.stars').each(function(idx, element){
699699
}
700700
});
701701

702+
$('#extension-button').on('click', function() {
703+
function isChrome() {
704+
// please note,
705+
// that IE11 now returns undefined again for window.chrome
706+
// and new Opera 30 outputs true for window.chrome
707+
// and new IE Edge outputs to true now for window.chrome
708+
// and if not iOS Chrome check
709+
// so use the below updated condition
710+
var isChromium = window.chrome,
711+
winNav = window.navigator,
712+
vendorName = winNav.vendor,
713+
isOpera = winNav.userAgent.indexOf("OPR") > -1,
714+
isIEedge = winNav.userAgent.indexOf("Edge") > -1,
715+
isIOSChrome = winNav.userAgent.match("CriOS");
716+
717+
if(isIOSChrome){
718+
return false;
719+
} else if(isChromium !== null && isChromium !== undefined && vendorName === "Google Inc." && isOpera == false && isIEedge == false) {
720+
return true;
721+
} else {
722+
return false;
723+
}
724+
}
725+
726+
if(isChrome()) {
727+
chrome.webstore.install();
728+
} else {
729+
window.open('https://chrome.google.com/webstore/detail/jwt-debugger/ppmmlchacdbknfphdeafcbmklcghghmd');
730+
}
731+
});
732+
702733
//CANVAS
703734
// $(function(){
704735
// var canvas = document.querySelector('canvas'),

views/index.jade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ block content
4545
span
4646
strong Love JWT.IO?
4747
| Bring the debugger to your favorite browser with our new chrome extension.
48-
a(href="https://chrome.google.com/webstore/detail/jwt-debugger/ppmmlchacdbknfphdeafcbmklcghghmd", class="extension-button", target="_blank")
48+
span#extension-button(class="extension-button")
4949
svg(width='14px', height='13px', viewbox='24 11 14 13', version='1.1', xmlns='http://www.w3.org/2000/svg', xmlns:xlink='http://www.w3.org/1999/xlink')
5050
defs
5151
path#path-1(d='M30.0287226,15.7142857 L30.0287226,11 L31.600907,11 L31.600907,15.7142857 L36.3174603,15.7142857 L36.3174603,17.2857143 L31.600907,17.2857143 L31.600907,22 L30.0287226,22 L30.0287226,17.2857143 L25.3121693,17.2857143 L25.3121693,15.7142857 L30.0287226,15.7142857 Z')

views/layout.jade

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ html(lang='en')
6666
meta(name='msapplication-TileColor', content='#000000')
6767
meta(name='msapplication-TileImage', content='/img/favicon/ms-icon-144x144.png')
6868
meta(name='theme-color', content='#000000')
69-
69+
70+
// Chrome extension link, required for inline installs
71+
link(rel="chrome-webstore-item", href="https://chrome.google.com/webstore/detail/ppmmlchacdbknfphdeafcbmklcghghmd")
7072

7173
// HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries
7274
| <!--[if lt IE 9]><script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script><script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script><![endif]-->

0 commit comments

Comments
 (0)