@@ -189,6 +189,35 @@ function highlightFilter(s) {
189
189
return r ;
190
190
}
191
191
192
+ function checkboxSetUnsetAllHandler ( checkboxname ) {
193
+ return function ( ) {
194
+ var checkboxnum = 0 ;
195
+ while ( checkboxnum < checkboxes . length &&
196
+ checkboxes [ checkboxnum ] . toLowerCase ( ) != checkboxname . toLowerCase ( ) ) {
197
+ checkboxnum ++ ;
198
+ }
199
+ if ( checkboxnum >= checkboxes . length ) {
200
+ return ;
201
+ }
202
+ var allset = true ;
203
+ var checkbox ;
204
+ var row ;
205
+ for ( row of bombody . childNodes ) {
206
+ checkbox = row . childNodes [ checkboxnum + 1 ] . childNodes [ 0 ] ;
207
+ if ( ! checkbox . checked || checkbox . indeterminate ) {
208
+ allset = false ;
209
+ break ;
210
+ }
211
+ }
212
+ for ( row of bombody . childNodes ) {
213
+ checkbox = row . childNodes [ checkboxnum + 1 ] . childNodes [ 0 ] ;
214
+ checkbox . checked = ! allset ;
215
+ checkbox . indeterminate = false ;
216
+ checkbox . onchange ( ) ;
217
+ }
218
+ }
219
+ }
220
+
192
221
function createColumnHeader ( name , cls , comparator ) {
193
222
var th = document . createElement ( "TH" ) ;
194
223
th . innerHTML = name ;
@@ -237,16 +266,33 @@ function createColumnHeader(name, cls, comparator) {
237
266
return th ;
238
267
}
239
268
269
+ function fancyDblClickHandler ( el , onsingle , ondouble ) {
270
+ return function ( ) {
271
+ if ( el . getAttribute ( "data-dblclick" ) == null ) {
272
+ el . setAttribute ( "data-dblclick" , 1 ) ;
273
+ setTimeout ( function ( ) {
274
+ if ( el . getAttribute ( "data-dblclick" ) == 1 ) {
275
+ onsingle ( ) ;
276
+ }
277
+ el . removeAttribute ( "data-dblclick" ) ;
278
+ } , 200 ) ;
279
+ } else {
280
+ el . removeAttribute ( "data-dblclick" ) ;
281
+ ondouble ( ) ;
282
+ }
283
+ }
284
+ }
285
+
240
286
function populateBomHeader ( ) {
241
287
while ( bomhead . firstChild ) {
242
288
bomhead . removeChild ( bomhead . firstChild ) ;
243
289
}
244
290
var tr = document . createElement ( "TR" ) ;
245
- var td = document . createElement ( "TH" ) ;
246
- td . classList . add ( "numCol" ) ;
247
- tr . appendChild ( td ) ;
291
+ var th = document . createElement ( "TH" ) ;
292
+ th . classList . add ( "numCol" ) ;
293
+ tr . appendChild ( th ) ;
248
294
checkboxes = bomCheckboxes . split ( "," ) . filter ( ( e ) => e ) ;
249
- var checkboxClosure = function ( checkbox ) {
295
+ var checkboxCompareClosure = function ( checkbox ) {
250
296
return ( a , b ) => {
251
297
var stateA = getCheckboxState ( checkbox , a [ 3 ] ) ;
252
298
var stateB = getCheckboxState ( checkbox , b [ 3 ] ) ;
@@ -256,8 +302,11 @@ function populateBomHeader() {
256
302
}
257
303
}
258
304
for ( var checkbox of checkboxes ) {
259
- tr . appendChild ( createColumnHeader (
260
- checkbox , "bom-checkbox" , checkboxClosure ( checkbox ) ) ) ;
305
+ th = createColumnHeader (
306
+ checkbox , "bom-checkbox" , checkboxCompareClosure ( checkbox ) ) ;
307
+ th . onclick = fancyDblClickHandler (
308
+ th , th . onclick . bind ( th ) , checkboxSetUnsetAllHandler ( checkbox ) ) ;
309
+ tr . appendChild ( th ) ;
261
310
}
262
311
tr . appendChild ( createColumnHeader ( "References" , "References" , ( a , b ) => {
263
312
var i = 0 ;
0 commit comments