@@ -42,7 +42,7 @@ function jsonToHTML(value, path, objectIsReallyArray) {
42
42
const k = Object . keys ( value ) . at ( i ) ;
43
43
44
44
const details = div . appendChild ( document . createElement ( "details" ) ) ;
45
- details . open = true ;
45
+ details . open = false ;
46
46
47
47
const summary = jsonToHTML ( true === objectIsReallyArray ? parseInt ( k ) : k ) ;
48
48
summary . classList . add ( "json-key" ) ;
@@ -284,82 +284,80 @@ if (doTest) button.click();
284
284
const sendEmailTo = function ( entity ) {
285
285
let lastTestedURL = rdapValidator . testedURL ;
286
286
287
+ let email ;
288
+
287
289
try {
288
290
lastTestedURL = rdapValidator . lastTestedResponse . links . filter ( l => "self" == l . rel && "application/rdap+json" == l . type ) . shift ( ) . href ;
289
291
292
+ email = entity . vcardArray [ 1 ] . filter ( p => "EMAIL" === p [ 0 ] . toUpperCase ( ) ) . shift ( ) [ 3 ] ;
293
+
290
294
} catch ( e ) {
291
- console . log ( e ) ;
295
+ alert ( `Unable to extract URL and/or email address: ${ e } ` ) ;
292
296
293
297
}
294
298
295
- try {
296
- const email = entity . vcardArray [ 1 ] . filter ( p => "EMAIL" === p [ 0 ] . toUpperCase ( ) ) . shift ( ) [ 3 ] ;
297
-
298
- const url = new URL ( "mailto:" + email ) ;
299
+ const url = new URL ( "mailto:" + email ) ;
299
300
300
- let subject , body ;
301
+ let subject , body ;
301
302
302
- if ( rdapValidator . errors < 1 ) {
303
- subject = 'No issues with your RDAP server' ;
304
- body = [
305
- "Hey there, I tested your RDAP server using the RDAP Validator at this URL:" ,
306
- "" ,
307
- document . location . href ,
308
- "" ,
309
- "And everything looks fine! Thanks for your care and attention." ,
310
- ] ;
303
+ if ( rdapValidator . errors < 1 ) {
304
+ subject = 'No issues with your RDAP server' ;
305
+ body = [
306
+ "Hey there, I tested your RDAP server using the RDAP Validator at this URL:" ,
307
+ "" ,
308
+ document . location . href ,
309
+ "" ,
310
+ "And everything looks fine! Thanks for your care and attention." ,
311
+ "" ,
312
+ ] ;
311
313
312
- } else {
313
- subject = `I found ${ self . errors } error(s) with your RDAP server` ;
314
-
315
- body = [
316
- "***NOTE TO SENDER: PLEASE BE POLITE!***" ,
317
- "" ,
318
- "Hey there, I found an issue with your RDAP server using the RDAP Validator at this URL:" ,
319
- "" ,
320
- document . location . href ,
321
- "" ,
322
- `Tested URL: ${ lastTestedURL } ` ,
323
- `Response Type: ${ rdapValidator . responseTypes [ rdapValidator . lastTestedResponseType ] } ` ,
324
- `Server Type: ${ rdapValidator . serverTypes [ rdapValidator . lastTestedServerType ] } ` ,
325
- "" ,
326
- "List of errors:" ,
327
- "" ,
328
- ] ;
329
-
330
- rdapValidator . log . forEach ( function ( msg ) {
331
- if ( false === msg [ 0 ] ) {
332
- body . push ( `Error: ${ msg [ 1 ] } ` ) ;
333
- if ( "$" !== msg [ 2 ] ) body . push ( `JSON Path: ${ msg [ 2 ] } ` ) ;
334
- if ( msg [ 3 ] ) body . push ( `Reference: ${ msg [ 3 ] } ` ) ;
335
- body . push ( "" ) ;
336
- }
337
- } ) ;
338
-
339
- body . push ( "Server response:" , "" ) ;
314
+ } else {
315
+ subject = `I found ${ self . errors } error(s) with your RDAP server` ;
316
+
317
+ body = [
318
+ "***NOTE TO SENDER: PLEASE BE POLITE!***" ,
319
+ "" ,
320
+ "Hey there, I found an issue with your RDAP server using the RDAP Validator at this URL:" ,
321
+ "" ,
322
+ document . location . href ,
323
+ "" ,
324
+ `Tested URL: ${ lastTestedURL } ` ,
325
+ `Response Type: ${ rdapValidator . responseTypes [ rdapValidator . lastTestedResponseType ] } ` ,
326
+ `Server Type: ${ rdapValidator . serverTypes [ rdapValidator . lastTestedServerType ] } ` ,
327
+ "" ,
328
+ "List of errors:" ,
329
+ "" ,
330
+ ] ;
331
+
332
+ rdapValidator . log . forEach ( function ( msg ) {
333
+ if ( false === msg [ 0 ] ) {
334
+ body . push ( `Error: ${ msg [ 1 ] } ` ) ;
335
+ if ( "$" !== msg [ 2 ] ) body . push ( `JSON Path: ${ msg [ 2 ] } ` ) ;
336
+ if ( msg [ 3 ] ) body . push ( `Reference: ${ msg [ 3 ] } ` ) ;
337
+ body . push ( "" ) ;
338
+ }
339
+ } ) ;
340
340
341
- Object . keys ( rdapValidator . lastTestedResponseHeaders ) . forEach ( function ( k ) {
342
- body . push ( k + ": " + rdapValidator . lastTestedResponseHeaders [ k ] ) ;
343
- } ) ;
344
- body . push ( "" ) ;
345
- body = body . concat ( JSON . stringify ( rdapValidator . lastTestedResponse , null , " " ) . split ( "\n" ) ) ;
346
- }
341
+ body . push ( "Server response:" , "" ) ;
347
342
348
- subject = escape ( subject ) ;
349
- body = escape ( body . join ( "\n" ) ) ;
343
+ Object . keys ( rdapValidator . lastTestedResponseHeaders ) . forEach ( function ( k ) {
344
+ body . push ( k + ": " + rdapValidator . lastTestedResponseHeaders [ k ] ) ;
345
+ } ) ;
346
+ body . push ( "" ) ;
347
+ body = body . concat ( JSON . stringify ( rdapValidator . lastTestedResponse , null , " " ) . split ( "\n" ) ) ;
350
348
351
- url . search = `?subject= ${ subject } &body= ${ body } ` ;
349
+ }
352
350
353
- const iframe = document . createElement ( 'iframe' ) ;
354
- iframe . setAttribute ( 'src' , url . toString ( ) ) ;
355
- iframe . style . setProperty ( 'display' , 'none' ) ;
351
+ subject = escape ( subject ) ;
352
+ body = escape ( body . join ( "\n" ) ) ;
356
353
357
- document . body . appendChild ( iframe ) ;
354
+ url . search = `?subject= ${ subject } & body= ${ body } ` ;
358
355
359
- } catch ( e ) {
360
- console . log ( e ) ;
356
+ const iframe = document . createElement ( 'iframe' ) ;
357
+ iframe . setAttribute ( 'src' , url . toString ( ) ) ;
358
+ iframe . style . setProperty ( 'display' , 'none' ) ;
361
359
362
- }
360
+ document . body . appendChild ( iframe ) ;
363
361
} ;
364
362
365
363
document . getElementById ( "report-button" ) . addEventListener ( "click" , function ( ) {
0 commit comments