File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change 99 window . onload = function ( ) {
1010 document . getElementById ( "button" ) . onclick = function ( ) {
1111 try {
12- var result = jsonlint . parse ( document . getElementById ( "source" ) . value ) ;
12+ var parser = jsonlint
13+ if ( document . getElementById ( "comments" ) . checked ) {
14+ parser = new jsonlint . parser . ParserWithComments
15+ }
16+ var result = parser . parse ( document . getElementById ( "source" ) . value ) ;
1317 if ( result ) {
1418 document . getElementById ( "result" ) . innerHTML = "JSON is valid!" ;
1519 document . getElementById ( "result" ) . className = "pass" ;
4549< body >
4650 < h1 > JSON Lint</ h1 >
4751 < p > A pure JavaScript version of the service provided at < a href ="http://jsonlint.com/ "> jsonlint.com</ a > .</ p >
48- < textarea id ="source " rows ="20 " cols ="50 ">
49-
50- </ textarea >
52+ < textarea id ="source " rows ="20 " cols ="50 "> </ textarea >
53+ < p >
54+ < input type ="checkbox " checked id ="reformat ">
55+ < label for ="reformat "> reformat JSON</ label >
56+ < br >
57+ < input type ="checkbox " id ="comments ">
58+ < label for ="comments "> ignore JavaScript-style comments</ label >
59+ </ p >
5160 < p >
5261 < button id ="button "> Validate</ button >
53- < input type ="checkbox " value ="yes " id ="reformat " /> < label for ="reformat "> reformat JSON</ label >
5462 </ p >
5563 < h2 > Results</ h2 >
5664 < pre id ="result "> </ pre >
57- < p > < a href ="http://github.com/zaach /jsonlint "> project on github</ a > </ p >
65+ < p > < a href ="http://github.com/prantlf /jsonlint "> project on github</ a > </ p >
5866</ body >
5967</ html >
You can’t perform that action at this time.
0 commit comments