@@ -79,7 +79,7 @@ export class Panel {
7979 span . addEventListener ( "click" , ( pClickEvent ) => {
8080 const selectVisible = ! Utils . getStorageItemBoolean ( "session" , "select_visible" , false ) ;
8181 Utils . setStorageItem ( "session" , "select_visible" , selectVisible ) ;
82- this . showColumn ( Character . HEAVY_CHECK_MARK , selectVisible ) ;
82+ this . showSelectColumn ( selectVisible ) ;
8383 const tbody = this . table . tBodies [ 0 ] ;
8484 const selectMinions = Utils . getStorageItem ( "session" , "select_minions" , "" ) ;
8585 for ( const tr of tbody . rows ) {
@@ -221,6 +221,33 @@ export class Panel {
221221 this . updateFooter ( ) ;
222222 }
223223
224+ selectAllNone ( ) {
225+ const lst = CommandBox . getSelectedMinionList ( ) ;
226+
227+ let selectAll ;
228+ if ( lst === null ) {
229+ selectAll = true ;
230+ } else {
231+ const nrSelected = lst . split ( "," ) . length ;
232+ selectAll = nrSelected !== this . nrMinions ;
233+ }
234+
235+ let selectMinions = "," ;
236+ for ( const tr of this . table . tBodies [ 0 ] . children ) {
237+ const td = tr . children [ 0 ] ;
238+ if ( selectAll ) {
239+ td . innerText = Character . BALLOT_BOX_WITH_CHECK ;
240+ selectMinions += tr . dataset . minionId + "," ;
241+ } else {
242+ td . innerText = Character . BALLOT_BOX_UNCHECKED ;
243+ }
244+ }
245+
246+ Utils . setStorageItem ( "session" , "select_minions" , selectMinions ) ;
247+
248+ this . updateFooter ( ) ;
249+ }
250+
224251 addTable ( pColumnNames , pFieldList = null ) {
225252 const table = Utils . createElem ( "table" , this . key , "" , this . key + "-table" ) ;
226253
@@ -242,8 +269,13 @@ export class Panel {
242269 if ( ! selectVisible ) {
243270 th . style . display = "none" ;
244271 }
272+ Utils . addToolTip ( th , "Click here to select all/none\nCTRL-click to invert selection" , "bottom-left" ) ;
245273 th . addEventListener ( "click" , ( pClickEvent ) => {
246- this . toggleSelection ( ) ;
274+ if ( pClickEvent . ctrlKey || pClickEvent . altKey ) {
275+ this . toggleSelection ( ) ;
276+ } else {
277+ this . selectAllNone ( ) ;
278+ }
247279 pClickEvent . stopPropagation ( ) ;
248280 } ) ;
249281 } else if ( ! columnName . startsWith ( "-" ) ) {
@@ -1072,17 +1104,9 @@ export class Panel {
10721104 }
10731105 }
10741106
1075- showColumn ( pColTitle , pShow ) {
1107+ showSelectColumn ( pShow ) {
10761108
1077- let colNr = - 1 ;
1078- // find a column with this name
1079- for ( let i = 0 ; i < this . table . tHead . children [ 0 ] . children . length ; i ++ ) {
1080- const th = this . table . tHead . children [ 0 ] . children [ i ] ;
1081- if ( th . innerText === pColTitle ) {
1082- colNr = i ;
1083- break ;
1084- }
1085- }
1109+ const colNr = 0 ;
10861110
10871111 // title
10881112 for ( const tr of this . table . tHead . children ) {
0 commit comments