Skip to content

Commit 25528b0

Browse files
committed
Style fixes.
1 parent 321fbcf commit 25528b0

File tree

4 files changed

+83
-108
lines changed

4 files changed

+83
-108
lines changed

dist/js/app.js

Lines changed: 12 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

html/index.html

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ <h3 class="panel-title">.NET</h3>
195195
</div>
196196
<div class="author-info">
197197
<div class="maintainer">
198-
<i
198+
<i
199199
class="icon-budicon-333"
200200
data-toggle="tooltip"
201201
title="Maintainer: Microsoft"></i>
@@ -250,7 +250,7 @@ <h3 class="panel-title">Python</h3>
250250
<div class="author-info">
251251

252252
<a href="https://github.com/jpadilla">
253-
<i
253+
<i
254254
class="icon-budicon-333"
255255
data-toggle="tooltip"
256256
title="Maintainer: José Padilla"></i>
@@ -311,7 +311,7 @@ <h3 class="panel-title">Node.js</h3>
311311
<div class="maintainer">
312312

313313
<a href="https://github.com/auth0">
314-
<i
314+
<i
315315
class="icon-budicon-333"
316316
data-toggle="tooltip"
317317
title="Maintainer: Auth0"></i>
@@ -372,7 +372,7 @@ <h3 class="panel-title">Java</h3>
372372
<div class="author-info">
373373

374374
<a href="https://twitter.com/__b_c">
375-
<i
375+
<i
376376
class="icon-budicon-333"
377377
data-toggle="tooltip"
378378
title="Maintainer: __b_c"></i>
@@ -431,7 +431,7 @@ <h3 class="panel-title">JavaScript</h3>
431431
<div class="author-info">
432432

433433
<a href="https://github.com/kjur">
434-
<i
434+
<i
435435
class="icon-budicon-333"
436436
data-toggle="tooltip"
437437
title="Maintainer: Kenji Urushima"></i>
@@ -496,7 +496,7 @@ <h3 class="panel-title">PHP</h3>
496496
<div class="author-info">
497497

498498
<a href="https://github.com/firebase">
499-
<i
499+
<i
500500
class="icon-budicon-333"
501501
data-toggle="tooltip"
502502
title="Maintainer: Firebase"></i>
@@ -560,7 +560,7 @@ <h3 class="panel-title">Ruby</h3>
560560

561561
<div class="author-info">
562562

563-
<i
563+
<i
564564
class="icon-budicon-333"
565565
data-toggle="tooltip"
566566
title="Maintainer: Jeff Lindsay & Tim Rudat"></i>
@@ -621,7 +621,7 @@ <h3 class="panel-title">Go</h3>
621621
<div class="author-info">
622622

623623
<a href="https://github.com/dgrijalva">
624-
<i
624+
<i
625625
class="icon-budicon-333"
626626
data-toggle="tooltip"
627627
title="Maintainer: dgrijalva"></i>
@@ -683,7 +683,7 @@ <h3 class="panel-title">Java</h3>
683683
<div class="author-info">
684684

685685
<a href="https://github.com/auth0">
686-
<i
686+
<i
687687
class="icon-budicon-333"
688688
data-toggle="tooltip"
689689
title="Maintainer: Auth0"></i>
@@ -742,7 +742,7 @@ <h3 class="panel-title">Haskell</h3>
742742
<div class="author-info">
743743

744744
<a href="https://bitbucket.org/ssaasen">
745-
<i
745+
<i
746746
class="icon-budicon-333"
747747
data-toggle="tooltip"
748748
title="Maintainer: Stefan Saasen"></i>
@@ -800,7 +800,7 @@ <h3 class="panel-title">Rust</h3>
800800
<div class="author-info">
801801

802802
<a href="https://github.com/GildedHonour">
803-
<i
803+
<i
804804
class="icon-budicon-333"
805805
data-toggle="tooltip"
806806
title="Maintainer: GildedHonour"></i>
@@ -860,7 +860,7 @@ <h3 class="panel-title">PHP</h3>
860860
<div class="author-info">
861861

862862
<a href="https://github.com/namshi">
863-
<i
863+
<i
864864
class="icon-budicon-333"
865865
data-toggle="tooltip"
866866
title="Maintainer: Namshi"></i>
@@ -925,7 +925,7 @@ <h3 class="panel-title">Lua (openresty)</h3>
925925
<div class="author-info">
926926

927927
<a href="https://github.com/SkyLothar">
928-
<i
928+
<i
929929
class="icon-budicon-333"
930930
data-toggle="tooltip"
931931
title="Maintainer: SkyLothar"></i>
@@ -984,7 +984,7 @@ <h3 class="panel-title">Java</h3>
984984
<div class="author-info">
985985

986986
<a href="https://github.com/connect2id">
987-
<i
987+
<i
988988
class="icon-budicon-333"
989989
data-toggle="tooltip"
990990
title="Maintainer: connect2id"></i>
@@ -1040,7 +1040,7 @@ <h3 class="panel-title">Scala</h3>
10401040
<div class="author-info">
10411041

10421042
<a href="https://github.com/jasongoodwin">
1043-
<i
1043+
<i
10441044
class="icon-budicon-333"
10451045
data-toggle="tooltip"
10461046
title="Maintainer: jasongoodwin"></i>

js/app.js

Lines changed: 55 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
115115
var decodedHeader = window.decode(parts[0]);
116116

117117
try {
118-
selectDetectedAlgorithm(JSON.parse(decodedHeader.result).alg);
118+
selectDetectedAlgorithm(JSON.parse(decodedHeader.result).alg);
119119
}catch (e){
120-
console.log('Invalid header decoded');
120+
console.error('Invalid header decoded');
121121
}
122122

123123
var selector = $('.jwt-header');
@@ -130,12 +130,10 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
130130
}
131131

132132
function selectDetectedAlgorithm(alg){
133+
var $algRadio = $('.algorithm input[value="'+alg+'"]');
134+
$algRadio.prop('checked', true);
133135

134-
var $algRadio = $('.algorithm input[value="'+alg+'"]');
135-
$algRadio.prop('checked', true);
136-
137-
fireEvent($algRadio.get(0));
138-
136+
fireEvent($algRadio.get(0));
139137
}
140138

141139
function saveToStorage(jwt) {
@@ -149,20 +147,19 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
149147
}
150148

151149
function refreshTokenEditor(instance) {
152-
153150
tokenEditor.off('change', tokenEditorOnChangeListener);
154151

155152
var algorithm = getAlgorithm();
156153
var secretElement = document.getElementsByName('secret')[0];
157154
var isBase64EncodedElement = document.getElementsByName('is-base64-encoded')[0];
158155

159156
var signResult = window.sign(
160-
algorithm,
161-
headerEditor.getValue(),
162-
payloadEditor.getValue(),
163-
getKey(algorithm, 'sign'),
164-
isBase64EncodedElement.checked);
165-
157+
algorithm,
158+
headerEditor.getValue(),
159+
payloadEditor.getValue(),
160+
getKey(algorithm, 'sign'),
161+
isBase64EncodedElement.checked
162+
);
166163

167164
if (signResult.error) {
168165
tokenEditor.setValue('');
@@ -217,7 +214,6 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
217214
var isBase64EncodedElement = document.getElementsByName('is-base64-encoded')[0];
218215

219216
function updateSignature () {
220-
221217
var algorithm = getAlgorithm();
222218
var signatureElement = getFirstElementByClassName('js-signature');
223219
var signatureContainerElement = getFirstElementByClassName('jwt-signature');
@@ -235,10 +231,11 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
235231
}
236232

237233
var result = window.verify(
238-
algorithm,
239-
value,
240-
getKey(algorithm, 'verify'),
241-
isBase64);
234+
algorithm,
235+
value,
236+
getKey(algorithm, 'verify'),
237+
isBase64
238+
);
242239

243240

244241
var error = result.error;
@@ -254,27 +251,23 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
254251
}
255252
}
256253

257-
function getKey(algorithm, action){
258-
259-
var secretElement = $('input[name="secret"]'),
260-
privateKeyElement = $('textarea[name="private-key"]'),
261-
publicKeyElement = $('textarea[name="public-key"]');
254+
function getKey(algorithm, action) {
255+
var secretElement = $('input[name="secret"]');
256+
var privateKeyElement = $('textarea[name="private-key"]');
257+
var publicKeyElement = $('textarea[name="public-key"]');
262258

263-
if(algorithm === 'HS256'){
259+
if(algorithm === 'HS256') {
264260
return secretElement.val();
265-
}else{
261+
} else {
266262
return action === 'sign' ? privateKeyElement.val() : publicKeyElement.val();
267263
}
268-
269264
}
270265

271-
function getAlgorithm(){
272-
266+
function getAlgorithm() {
273267
return algorithmRadios.filter(':checked').val();
274268
}
275269

276270
function updateAlgorithm () {
277-
278271
var algorithm = algorithmRadios.filter(':checked').val();
279272

280273
$('.js-input').attr('data-alg', algorithm);
@@ -285,33 +278,47 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
285278
.show();
286279

287280
if(getTrimmedValue(tokenEditor) === DEFAULT_HS_TOKEN &&
288-
algorithm === 'RS256'){
281+
algorithm === 'RS256'){
289282
setDefaultsForRSA();
290283
}else if(getTrimmedValue(tokenEditor) === DEFAULT_RS_TOKEN &&
291-
algorithm === 'HS256'){
284+
algorithm === 'HS256'){
292285
setDefaultsForHMAC();
293286
}
294-
295287
}
296288

297-
function setDefaultsForRSA(){
298-
299-
tokenEditor.setValue(DEFAULT_RS_TOKEN);
289+
function setDefaultsForRSA() {
290+
tokenEditor.setValue(DEFAULT_RS_TOKEN);
300291

301-
$('.jwt-signature textarea[name=public-key]').val(DEFAULT_PUBLIC_RSA);
302-
$('.jwt-signature textarea[name=private-key]').val(DEFAULT_PRIVATE_RSA);
292+
$('.jwt-signature textarea[name=public-key]').val(DEFAULT_PUBLIC_RSA);
293+
$('.jwt-signature textarea[name=private-key]').val(DEFAULT_PRIVATE_RSA);
303294
}
304295

305296
function setDefaultsForHMAC(){
297+
tokenEditor.setValue(DEFAULT_HS_TOKEN);
298+
}
299+
300+
function validateKey() {
301+
var $textarea = $(this);
302+
var valid;
303+
304+
if($textarea.prop('name') === 'public-key') {
305+
valid = /-----BEGIN (PUBLIC KEY|CERTIFICATE)-----(.|\n)*-----END (PUBLIC KEY|CERTIFICATE)-----/.test($textarea.val());
306+
} else {
307+
valid = /-----BEGIN RSA PRIVATE KEY-----(.|\n)*-----END RSA PRIVATE KEY-----/.test($textarea.val());
308+
}
306309

307-
tokenEditor.setValue(DEFAULT_HS_TOKEN);
310+
if (valid) {
311+
$textarea.removeClass('error');
312+
} else {
313+
$textarea.addClass('error');
314+
}
308315
}
309316

310317
updateAlgorithm();
311318

312319
algorithmRadios.on('change', function(){
313-
updateAlgorithm();
314-
updateSignature();
320+
updateAlgorithm();
321+
updateSignature();
315322
});
316323

317324
$('.jwt-signature textarea').on('change', updateSignature, false);
@@ -322,25 +329,6 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
322329
secretElement.addEventListener('keyup', updateSignature, false);
323330
isBase64EncodedElement.addEventListener('change', updateSignature, false);
324331

325-
function validateKey(){
326-
327-
$textarea = $(this);
328-
var valid;
329-
330-
if($textarea.prop('name') === 'public-key'){
331-
valid = /-----BEGIN (PUBLIC KEY|CERTIFICATE)-----(.|\n)*-----END (PUBLIC KEY|CERTIFICATE)-----/.test($textarea.val());
332-
}else{
333-
valid = /-----BEGIN RSA PRIVATE KEY-----(.|\n)*-----END RSA PRIVATE KEY-----/.test($textarea.val());
334-
}
335-
336-
if (valid) {
337-
$textarea.removeClass('error');
338-
}else{
339-
$textarea.addClass('error');
340-
}
341-
342-
}
343-
344332
if (document.location.search) {
345333
var qs = document.location.search.slice(1);
346334
var d = {};
@@ -364,11 +352,10 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
364352
}
365353

366354
loadFromStorage(function (jwt) {
367-
368355
lastRestoredToken = jwt || DEFAULT_HS_TOKEN;
369356

370357
tokenEditor.setValue(
371-
lastRestoredToken
358+
lastRestoredToken
372359
);
373360
});
374361

@@ -385,26 +372,23 @@ FaFp+DyAe+b4nDwuJaW2LURbr8AEZga7oQj0uYxcYw==\n\
385372
}, 1000);
386373
}).call(this);
387374

388-
389375
//Inizialize bootstrap widgets
390376
$('[data-toggle="tooltip"]').tooltip();
391377

392378
// Fetch stargazers count for each repo from GitHub's API
393379
$('.stars').each(function(idx, element){
394-
395380
var $el = $(element);
396381
var repo = $el.attr('data-repo');
397382

398383
if (repo){
399-
$.getJSON('http://api.github.com/repos/' + repo, function(repoData){
400-
401-
var $count = $('<span>');
402-
$count.text(repoData.stargazers_count);
384+
$.getJSON('http://api.github.com/repos/' + repo, function(repoData){
385+
var $count = $('<span>');
386+
$count.text(repoData.stargazers_count);
403387

404-
$el.find('i').after($count);
388+
$el.find('i').after($count);
405389

406-
$el.show();
407-
});
390+
$el.show();
391+
});
408392
}
409393
});
410394

js/jwt.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,7 @@ window.decode = function (base64json) {
4343
return {result: json, error: error};
4444
};
4545

46-
window.sign = function (
47-
algorithm,
48-
header,
49-
payload,
50-
key,
51-
isSecretBase64Encoded) {
52-
46+
window.sign = function (algorithm, header, payload, key, isSecretBase64Encoded) {
5347
var value = '', error = null, headerAsJSON, payloadAsJSON;
5448

5549
try {

0 commit comments

Comments
 (0)