@@ -10,7 +10,7 @@ export class ClockPanel extends fapi.HandlebarsApplicationMixin(fapi.Application
1010 #sortable = null ;
1111
1212 constructor ( db , options ) {
13- super ( options )
13+ super ( options ) ;
1414 this . db = db ;
1515 }
1616
@@ -25,7 +25,7 @@ export class ClockPanel extends fapi.HandlebarsApplicationMixin(fapi.Application
2525 addPoints : ClockPanel . #onAddPoints,
2626 editEntry : ClockPanel . #onEditEntry,
2727 deleteEntry : ClockPanel . #onDeleteEntry,
28- }
28+ } ,
2929 } ;
3030
3131 static PARTS = {
@@ -47,7 +47,7 @@ export class ClockPanel extends fapi.HandlebarsApplicationMixin(fapi.Application
4747
4848 async _prepareContext ( ) {
4949 const clocks = await this . prepareClocks ( ) ;
50-
50+
5151 return {
5252 options : {
5353 editable : game . user . isGM ,
@@ -71,7 +71,7 @@ export class ClockPanel extends fapi.HandlebarsApplicationMixin(fapi.Application
7171 backgroundColor,
7272 color : clockColors . find ( ( c ) => c . id === data . colorId ) ?. color ?? defaultColor ,
7373 spokes : data . max > maxSpokes ? [ ] : Array ( data . max ) . keys ( ) ,
74- } ) )
74+ } ) ) ;
7575 }
7676
7777 _onRender ( context , options ) {
@@ -109,16 +109,16 @@ export class ClockPanel extends fapi.HandlebarsApplicationMixin(fapi.Application
109109 const clockId = event . target . closest ( "[data-id]" ) . dataset . id ;
110110 const clock = this . db . get ( clockId ) ;
111111 if ( ! clock ) return ;
112-
112+
113113 clock . value = clock . value >= clock . max ? 0 : clock . value + 1 ;
114114 this . db . update ( clock ) ;
115115 } ) ;
116-
116+
117117 clock . addEventListener ( "contextmenu" , ( event ) => {
118118 const clockId = event . target . closest ( "[data-id]" ) . dataset . id ;
119119 const clock = this . db . get ( clockId ) ;
120120 if ( ! clock ) return ;
121-
121+
122122 clock . value = clock . value <= 0 ? clock . max : clock . value - 1 ;
123123 this . db . update ( clock ) ;
124124 } ) ;
@@ -140,21 +140,21 @@ export class ClockPanel extends fapi.HandlebarsApplicationMixin(fapi.Application
140140 const newIndex = event . newDraggableIndex ;
141141 const numItems = html . querySelectorAll ( ".clock-entry" ) . length ;
142142 this . db . move ( id , this . verticalEdge === "top" ? newIndex : numItems - newIndex - 1 ) ;
143- }
143+ } ,
144144 } ) ;
145145 }
146146 }
147147
148148 static #onAddClock( ) {
149149 new ClockAddDialog ( {
150- complete : ( data ) => this . db . addClock ( data )
150+ complete : ( data ) => this . db . addClock ( data ) ,
151151 } ) . render ( { force : true } ) ;
152152 }
153153
154154 static #onAddPoints( ) {
155155 new ClockAddDialog ( {
156156 type : "points" ,
157- complete : ( data ) => this . db . addClock ( data )
157+ complete : ( data ) => this . db . addClock ( data ) ,
158158 } ) . render ( { force : true } ) ;
159159 }
160160
@@ -164,8 +164,8 @@ export class ClockPanel extends fapi.HandlebarsApplicationMixin(fapi.Application
164164 if ( ! entry ) return ;
165165
166166 new ClockAddDialog ( {
167- entry,
168- complete : ( data ) => this . db . update ( data )
167+ entry,
168+ complete : ( data ) => this . db . update ( data ) ,
169169 } ) . render ( { force : true } ) ;
170170 }
171171
@@ -174,15 +174,18 @@ export class ClockPanel extends fapi.HandlebarsApplicationMixin(fapi.Application
174174 const clock = this . db . get ( clockId ) ;
175175 if ( ! clock ) return ;
176176
177- const deleting = await foundry . applications . api . Dialog . confirm ( {
178- window : {
179- title : game . i18n . localize ( "GlobalProgressClocks.DeleteDialog.Title" ) ,
180- } ,
181- content : game . i18n . format ( "GlobalProgressClocks.DeleteDialog.Message" , { name : clock . name } ) ,
182- } ) ;
183-
177+ const skipDialog = event . shiftKey ;
178+ const deleting =
179+ skipDialog ||
180+ ( await foundry . applications . api . Dialog . confirm ( {
181+ window : {
182+ title : game . i18n . localize ( "GlobalProgressClocks.DeleteDialog.Title" ) ,
183+ } ,
184+ content : game . i18n . format ( "GlobalProgressClocks.DeleteDialog.Message" , { name : clock . name } ) ,
185+ } ) ) ;
186+
184187 if ( deleting ) {
185188 this . db . delete ( clockId ) ;
186189 }
187190 }
188- }
191+ }
0 commit comments