@@ -189,6 +189,35 @@ function highlightFilter(s) {
189189 return r ;
190190}
191191
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+
192221function createColumnHeader ( name , cls , comparator ) {
193222 var th = document . createElement ( "TH" ) ;
194223 th . innerHTML = name ;
@@ -237,16 +266,33 @@ function createColumnHeader(name, cls, comparator) {
237266 return th ;
238267}
239268
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+
240286function populateBomHeader ( ) {
241287 while ( bomhead . firstChild ) {
242288 bomhead . removeChild ( bomhead . firstChild ) ;
243289 }
244290 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 ) ;
248294 checkboxes = bomCheckboxes . split ( "," ) . filter ( ( e ) => e ) ;
249- var checkboxClosure = function ( checkbox ) {
295+ var checkboxCompareClosure = function ( checkbox ) {
250296 return ( a , b ) => {
251297 var stateA = getCheckboxState ( checkbox , a [ 3 ] ) ;
252298 var stateB = getCheckboxState ( checkbox , b [ 3 ] ) ;
@@ -256,8 +302,11 @@ function populateBomHeader() {
256302 }
257303 }
258304 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 ) ;
261310 }
262311 tr . appendChild ( createColumnHeader ( "References" , "References" , ( a , b ) => {
263312 var i = 0 ;
0 commit comments