@@ -53,11 +53,21 @@ <h2 class="left">Online JSON Compare</h2>
53
53
</ div >
54
54
</ div >
55
55
< div class ="diff-inputs ">
56
- < div class ="json-diff-input ">
56
+ < div id =" left-input " class ="json-diff-input split ">
57
57
< textarea id ="json-diff-left "> </ textarea >
58
+ < span class ="input-buttons ">
59
+ < a class ="input-collapse " href ="# "> –</ a >
60
+ < a class ="input-split " href ="# "> ◫</ a >
61
+ < a class ="input-expand " href ="# "> ☐</ a >
62
+ </ span >
58
63
</ div >
59
- < div class ="json-diff-input ">
64
+ < div id =" right-input " class ="json-diff-input split ">
60
65
< textarea id ="json-diff-right "> </ textarea >
66
+ < span class ="input-buttons ">
67
+ < a class ="input-collapse " href ="# "> –</ a >
68
+ < a class ="input-split " href ="# "> ◫</ a >
69
+ < a class ="input-expand " href ="# "> ☐</ a >
70
+ </ span >
61
71
</ div >
62
72
</ div >
63
73
< script src ="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js "> </ script >
@@ -104,6 +114,8 @@ <h2 class="left">Online JSON Compare</h2>
104
114
} ) ;
105
115
106
116
$ ( '#download-diff-button' ) . on ( 'click' , onClickDownloadDiff ) ;
117
+ $ ( '#left-input' ) . on ( 'click' , '.input-collapse,.input-split,.input-expand' , onPaneResizeLeftClick ) ;
118
+ $ ( '#right-input' ) . on ( 'click' , '.input-collapse,.input-split,.input-expand' , onPaneResizeRightClick ) ;
107
119
108
120
function toggleLightTheme ( ) {
109
121
var isLightTheme = localStorage . getItem ( 'lighttheme' ) ;
@@ -149,6 +161,34 @@ <h2 class="left">Online JSON Compare</h2>
149
161
150
162
document . body . removeChild ( element ) ;
151
163
}
164
+
165
+ function onPaneResizeLeftClick ( e ) {
166
+ onResize ( e , 'left' ) ;
167
+ }
168
+
169
+ function onPaneResizeRightClick ( e ) {
170
+ onResize ( e , 'right' ) ;
171
+ }
172
+
173
+ function onResize ( e , side ) {
174
+ e . preventDefault ( ) ;
175
+ var otherSide = side === 'left' ? 'right' : 'left' ;
176
+ var clickClass = e . currentTarget . className ;
177
+ $ ( '.json-diff-input' ) . removeClass ( 'split' ) ;
178
+ $ ( '.json-diff-input' ) . removeClass ( 'expand' ) ;
179
+ $ ( '.json-diff-input' ) . removeClass ( 'collapse' ) ;
180
+ var sideClass = 'split' ;
181
+ var otherSideClass = 'split' ;
182
+ if ( clickClass === 'input-collapse' ) {
183
+ sideClass = 'collapse' ;
184
+ otherSideClass = 'expand' ;
185
+ } else if ( clickClass === 'input-expand' ) {
186
+ sideClass = 'expand' ;
187
+ otherSideClass = 'collapse' ;
188
+ }
189
+ $ ( '#' + side + '-input' ) . addClass ( sideClass ) ;
190
+ $ ( '#' + otherSide + '-input' ) . addClass ( otherSideClass ) ;
191
+ }
152
192
</ script >
153
193
</ body >
154
194
</ html >
0 commit comments