|
11 | 11 | font: 10.5pt arial; |
12 | 12 | color: #4d4d4d; |
13 | 13 | line-height: 150%; |
14 | | - width: 500px; |
15 | | - padding-left: 40px; |
| 14 | + width: 100%; |
| 15 | + padding-left: 10px; |
16 | 16 | } |
17 | 17 |
|
18 | 18 | code { |
19 | 19 | background-color: #f5f5f5; |
20 | 20 | } |
21 | 21 |
|
22 | 22 | #containerLeft { |
| 23 | + display: inline-block; |
23 | 24 | width: 500px; |
24 | | - height: 500px; |
25 | | - float: left; |
| 25 | + height: 500px; |
| 26 | + margin-right: 10px; |
26 | 27 | } |
| 28 | + |
27 | 29 | #containerRight { |
| 30 | + display: inline-block; |
28 | 31 | width: 500px; |
29 | 32 | height: 500px; |
30 | | - float: right; |
31 | | - } |
32 | | - #wrapper { |
33 | | - width: 1000px; |
34 | 33 | } |
35 | 34 | #containerRight .different_element { |
36 | 35 | background-color: greenyellow !important; |
|
42 | 41 | </head> |
43 | 42 | <body> |
44 | 43 |
|
| 44 | +<h3>JSON Diff</h3> |
45 | 45 | <p> |
46 | | - JSON Diff |
| 46 | + This example highlights the differences between two JSON objects using the option <code>onClassName</code>. |
| 47 | + Make a change in the left or right editor to see the changes update accordingly. |
47 | 48 | </p> |
48 | 49 | <div id="wrapper"> |
49 | 50 | <div id="containerLeft"></div> |
50 | 51 | <div id="containerRight"></div> |
51 | 52 | </div> |
52 | 53 |
|
53 | 54 | <script> |
54 | | - var containerLeft, containerRight, options, json; |
55 | | - |
56 | | - containerLeft = document.getElementById('containerLeft'); |
57 | | - containerRight = document.getElementById('containerRight'); |
| 55 | + var containerLeft = document.getElementById('containerLeft'); |
| 56 | + var containerRight = document.getElementById('containerRight'); |
58 | 57 |
|
59 | 58 | function findNodeInJson(json, path){ |
60 | 59 | if(!json || path.length ===0) { |
|
71 | 70 |
|
72 | 71 | } |
73 | 72 |
|
74 | | - optionsLeft = { |
| 73 | + var optionsLeft = { |
75 | 74 | mode: 'tree', |
76 | | - modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes |
77 | 75 | onError: function (err) { |
78 | 76 | alert(err.toString()); |
79 | 77 | }, |
|
102 | 100 | } |
103 | 101 | }; |
104 | 102 |
|
105 | | - optionsRight = { |
| 103 | + var optionsRight = { |
106 | 104 | mode: 'tree', |
107 | | - modes: ['code', 'form', 'text', 'tree', 'view'], // allowed modes |
108 | | - // name: "jsonContent", |
109 | 105 | onError: function (err) { |
110 | 106 | alert(err.toString()); |
111 | 107 | }, |
|
135 | 131 | } |
136 | 132 | }; |
137 | 133 |
|
138 | | - jsonLeft = { |
| 134 | + var jsonLeft = { |
139 | 135 | "arrayOfArrays": [1, 2, 999, [3,4,5]], |
140 | 136 | "someField": true, |
141 | 137 | "boolean": true, |
|
152 | 148 | "[0]": "zero" |
153 | 149 | }; |
154 | 150 |
|
155 | | - jsonRight = { |
| 151 | + var jsonRight = { |
156 | 152 | "arrayOfArrays": [1, 2, [3,4,5]], |
157 | 153 | "boolean": true, |
158 | 154 | "htmlcode": '"', |
|
0 commit comments