Skip to content

Commit 7f21744

Browse files
authored
Merge pull request jsonwebtoken#221 from rolodato/master
Linting
2 parents 28091ad + 1240c0c commit 7f21744

File tree

2 files changed

+92
-92
lines changed

2 files changed

+92
-92
lines changed

js/app.js

Lines changed: 91 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ $('.plain-text pre code').each(function(i, block) {
6060
*/
6161
$(window).scroll(function() {
6262
if ($(window).scrollTop() >= 130) {
63-
$("nav.navbar").addClass("fixed")
63+
$("nav.navbar").addClass("fixed");
6464
} else {
65-
$("nav.navbar").removeClass("fixed")
66-
};
65+
$("nav.navbar").removeClass("fixed");
66+
}
6767
});
6868

6969
/*
@@ -93,13 +93,13 @@ $('.navbar .menu a').on('click', function() {
9393
$('.menu-trigger').removeClass('active');
9494
$('.navbar').removeClass('open');
9595
$('body').removeClass('menu-mobile');
96-
})
96+
});
9797

9898
/*
9999
* Accordion
100100
*/
101101
$('.accordion').accordion({
102-
"transitionSpeed": 400
102+
"transitionSpeed": 400
103103
});
104104

105105
/*
@@ -115,7 +115,7 @@ $('a[href^="#"].scrollto').on('click', function(event) {
115115
});
116116

117117
$(window).on('scroll', function () {
118-
$submenu = $('.navbar');
118+
var $submenu = $('.navbar');
119119
var navheight = $(".navbar").height();
120120
var sections = $('section');
121121
var cur_pos = $(window).scrollTop();
@@ -134,16 +134,14 @@ $(window).on('scroll', function () {
134134

135135
function autoHeightInput() {
136136
var outputHeight = $('#decoded-jwt .output').outerHeight(),
137-
inputHeight = $('#encoded-jwt .input');
137+
inputHeight = $('#encoded-jwt .input');
138138

139139
inputHeight.css('height', outputHeight + 'px');
140-
};
140+
}
141141

142142
/*
143143
* token counter
144144
*/
145-
var pusher = null;
146-
var channel = null;
147145
var numberOfLogins = 80482701;
148146
var pollfreqWhenVisible = 5000;
149147
var pollfreqWhenHidden = 1000*1000;
@@ -171,7 +169,7 @@ function poll() {
171169
return setTimeout(function () {
172170
poll();
173171
}, pollfreq);
174-
})
172+
});
175173
}
176174

177175
function updateNumberOfLogins(callback) {
@@ -211,11 +209,11 @@ if (navigator.userAgent.indexOf('Mac OS X') != -1) {
211209
$(".jwt-playground .tab-link a").click(function() {
212210
var container = $(this).parentsUntil(".jwt-playground").parent();
213211
if (!$(this).parent().hasClass("current")) {
214-
container.find(".tab-nav .current").removeClass("current")
215-
$(this).parent().addClass("current")
216-
container.find(".tab-content .box-content").removeClass('current')
212+
container.find(".tab-nav .current").removeClass("current");
213+
$(this).parent().addClass("current");
214+
container.find(".tab-content .box-content").removeClass('current');
217215
$($(this).attr("href")).addClass('current');
218-
};
216+
}
219217
return false;
220218
});
221219

@@ -241,7 +239,7 @@ $(".panel-default .panel-heading").click(function() {
241239
$(".panel-default .panel-wrap").slideUp(300);
242240
$(this).addClass("active");
243241
$(this).next(".panel-wrap").slideDown(300);
244-
};
242+
}
245243
return false;
246244
});
247245

@@ -329,7 +327,7 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
329327
});
330328

331329
var algorithmRadios = $('input[name="algorithm"]'),
332-
lastRestoredToken;
330+
lastRestoredToken;
333331
var tokenRadios = $('input[name="token-type"]');
334332

335333
function setJSONEditorContent(jsonEditor, decodedJSON, selector) {
@@ -403,7 +401,7 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
403401
localStorage.removeItem("jwtValue");
404402
}
405403

406-
function refreshTokenEditor(instance) {
404+
function refreshTokenEditor() {
407405
tokenEditor.off('change', tokenEditorOnChangeListener);
408406

409407
var algorithm = getAlgorithm();
@@ -513,9 +511,9 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
513511
var publicKeyElement = $('textarea[name="public-key"]');
514512

515513
if(algorithm === 'HS256') {
516-
return secretElement.val();
514+
return secretElement.val();
517515
} else {
518-
return action === 'sign' ? privateKeyElement.val() : publicKeyElement.val();
516+
return action === 'sign' ? privateKeyElement.val() : publicKeyElement.val();
519517
}
520518
}
521519

@@ -535,10 +533,10 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
535533

536534
if(getTokenType() === 'id_token' && getTrimmedValue(tokenEditor) === DEFAULT_HS_TOKEN &&
537535
algorithm === 'RS256'){
538-
setDefaultsForRSA();
536+
setDefaultsForRSA();
539537
}else if(getTokenType() === 'id_token' && getTrimmedValue(tokenEditor) === DEFAULT_RS_TOKEN &&
540538
algorithm === 'HS256'){
541-
setDefaultsForHMAC();
539+
setDefaultsForHMAC();
542540
}
543541
}
544542

@@ -614,9 +612,11 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
614612

615613
isBase64EncodedElement.addEventListener('change', updateSignature, false);
616614

615+
var qs;
616+
var d;
617617
if (document.location.search) {
618-
var qs = document.location.search.slice(1);
619-
var d = {};
618+
qs = document.location.search.slice(1);
619+
d = {};
620620
qs = qs.split('&');
621621
qs.forEach(function (kv) { kv = kv.split('='); d[kv[0]] = kv[1]; });
622622
if (d.value) {
@@ -626,8 +626,8 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
626626
}
627627

628628
if (document.location.hash) {
629-
var qs = document.location.hash.slice(1);
630-
var d = {};
629+
qs = document.location.hash.slice(1);
630+
d = {};
631631
qs = qs.split('&');
632632
qs.forEach(function (kv) { kv = kv.split('='); d[kv[0]] = kv[1]; });
633633

@@ -678,53 +678,53 @@ $(".debugger-jwt .algorithm select").change(function() {
678678
});
679679

680680

681-
$(".debugger-jwt .algorithm select").change(function(){var a=$('.debugger-jwt .algorithm input[value="'+$(this).val()+'"]');a.prop("checked",!0)})
681+
$(".debugger-jwt .algorithm select").change(function(){var a=$('.debugger-jwt .algorithm input[value="'+$(this).val()+'"]');a.prop("checked",!0);});
682682
// end 07012015
683683

684684
$(".debugger-jwt .token-type select").change(function() {
685685
$('.debugger-jwt .token-type input[value="'+$(this).val()+'"]').parent().trigger("click");
686686
$('.debugger-jwt .token-type input[value="'+$(this).val()+'"]').change();
687687
});
688688

689-
$(".debugger-jwt .token-type select").change(function(){var a=$('.debugger-jwt .token-type input[value="'+$(this).val()+'"]');a.prop("checked",!0)})
689+
$(".debugger-jwt .token-type select").change(function(){var a=$('.debugger-jwt .token-type input[value="'+$(this).val()+'"]');a.prop("checked",!0);});
690690

691691

692692
// Fetch stargazers count for each repo from GitHub's API
693693
$('.stars').each(function(idx, element){
694-
var $el = $(element);
695-
var repo = $el.attr('data-repo');
694+
var $el = $(element);
695+
var repo = $el.attr('data-repo');
696696

697-
function setCount(count) {
698-
var $count = $('<span>');
697+
function setCount(count) {
698+
var $count = $('<span>');
699699

700-
$count.text(count);
700+
$count.text(count);
701701

702-
$el.find('i').after($count);
702+
$el.find('i').after($count);
703703

704-
$el.show();
705-
}
704+
$el.show();
705+
}
706706

707-
if (repo){
708-
var repoKey = "stars_" + repo;
709-
if(!localStorage.getItem(repoKey)) {
707+
if (repo){
708+
var repoKey = "stars_" + repo;
709+
if(!localStorage.getItem(repoKey)) {
710710

711-
$.getJSON('https://api.github.com/repos/' + repo, function(repoData){
712-
var starCount = repoData.stargazers_count;
713-
safeLocalStorageSetItem(repoKey, starCount);
714-
setCount(starCount);
715-
});
716-
} else {
717-
setCount(localStorage.getItem(repoKey));
718-
}
711+
$.getJSON('https://api.github.com/repos/' + repo, function(repoData){
712+
var starCount = repoData.stargazers_count;
713+
safeLocalStorageSetItem(repoKey, starCount);
714+
setCount(starCount);
715+
});
716+
} else {
717+
setCount(localStorage.getItem(repoKey));
719718
}
719+
}
720720
});
721721

722722
function setInstalledText() {
723-
var button = $('#extension-button');
724-
if(button && button.hasClass('is-installed')) {
725-
button.find('.button-text').text('Already installed');
726-
button.css('cursor', 'default');
727-
}
723+
var button = $('#extension-button');
724+
if(button && button.hasClass('is-installed')) {
725+
button.find('.button-text').text('Already installed');
726+
button.css('cursor', 'default');
727+
}
728728
}
729729

730730
setInstalledText();
@@ -733,59 +733,59 @@ setInstalledText();
733733
setTimeout(setInstalledText, 1000);
734734

735735
// chrome.webstore.install can only be called from standard event handlers.
736-
document.getElementById('extension-button').addEventListener('click', function(event) {
737-
var button = $('#extension-button');
738-
if(button.hasClass('is-installed')) {
739-
return;
740-
}
736+
document.getElementById('extension-button').addEventListener('click', function() {
737+
var button = $('#extension-button');
738+
if(button.hasClass('is-installed')) {
739+
return;
740+
}
741741

742-
function isChrome() {
742+
function isChrome() {
743743
// please note,
744744
// that IE11 now returns undefined again for window.chrome
745745
// and new Opera 30 outputs true for window.chrome
746746
// and new IE Edge outputs to true now for window.chrome
747747
// and if not iOS Chrome check
748748
// so use the below updated condition
749-
var isChromium = window.chrome,
750-
winNav = window.navigator,
751-
vendorName = winNav.vendor,
752-
isOpera = winNav.userAgent.indexOf("OPR") > -1,
753-
isIEedge = winNav.userAgent.indexOf("Edge") > -1,
754-
isIOSChrome = winNav.userAgent.match("CriOS");
755-
756-
if(isIOSChrome){
757-
return false;
758-
} else if(isChromium !== null && isChromium !== undefined && vendorName === "Google Inc." && isOpera == false && isIEedge == false) {
759-
return true;
760-
} else {
761-
return false;
762-
}
749+
var isChromium = window.chrome,
750+
winNav = window.navigator,
751+
vendorName = winNav.vendor,
752+
isOpera = winNav.userAgent.indexOf("OPR") > -1,
753+
isIEedge = winNav.userAgent.indexOf("Edge") > -1,
754+
isIOSChrome = winNav.userAgent.match("CriOS");
755+
756+
if(isIOSChrome){
757+
return false;
758+
} else if(isChromium !== null && isChromium !== undefined && vendorName === "Google Inc." && isOpera == false && isIEedge == false) {
759+
return true;
760+
} else {
761+
return false;
763762
}
763+
}
764764

765-
function openInWindow() {
766-
window.open('https://chrome.google.com/webstore/detail/jwt-debugger/ppmmlchacdbknfphdeafcbmklcghghmd');
767-
}
765+
function openInWindow() {
766+
window.open('https://chrome.google.com/webstore/detail/jwt-debugger/ppmmlchacdbknfphdeafcbmklcghghmd');
767+
}
768768

769-
if(isChrome()) {
770-
try {
771-
chrome.webstore.install('https://chrome.google.com/webstore/detail/ppmmlchacdbknfphdeafcbmklcghghmd', function() {
772-
button.addClass('is-installed');
773-
setInstalledText();
774-
}, function() {
775-
button.removeClass('is-installed');
776-
button.find('.button-text').text('Add to chrome');
777-
openInWindow();
778-
});
779-
} catch(e) {
780-
button.removeClass('is-installed');
781-
button.find('.button-text').text('Add to chrome');
782-
openInWindow();
783-
}
784-
} else {
769+
if(isChrome()) {
770+
try {
771+
chrome.webstore.install('https://chrome.google.com/webstore/detail/ppmmlchacdbknfphdeafcbmklcghghmd', function() {
772+
button.addClass('is-installed');
773+
setInstalledText();
774+
}, function() {
785775
button.removeClass('is-installed');
786776
button.find('.button-text').text('Add to chrome');
787777
openInWindow();
778+
});
779+
} catch(e) {
780+
button.removeClass('is-installed');
781+
button.find('.button-text').text('Add to chrome');
782+
openInWindow();
788783
}
784+
} else {
785+
button.removeClass('is-installed');
786+
button.find('.button-text').text('Add to chrome');
787+
openInWindow();
788+
}
789789
});
790790

791791
//CANVAS

js/jwt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ window.sign = function (algorithm, header, payload, key, isSecretBase64Encoded)
6565
return error;
6666
}
6767

68-
if(algorithm === 'HS256'){
68+
if (algorithm === 'HS256') {
6969
if (isSecretBase64Encoded) {
7070
try {
7171
key = window.b64utob64(key);

0 commit comments

Comments
 (0)