@@ -9,6 +9,26 @@ function isSpecialRollUser() {
99 return SPECIAL_ROLL_USERNAMES . has ( getCurrentUsername ( ) ) ;
1010}
1111
12+ function isShaduKatUser ( ) {
13+ return getCurrentUsername ( ) === 'shadukat' ;
14+ }
15+
16+ function getCookieValue ( name ) {
17+ const encodedName = `${ encodeURIComponent ( name ) } =` ;
18+ const cookies = document . cookie ? document . cookie . split ( ';' ) : [ ] ;
19+ for ( let i = 0 ; i < cookies . length ; i += 1 ) {
20+ const cookie = cookies [ i ] . trim ( ) ;
21+ if ( cookie . indexOf ( encodedName ) === 0 ) {
22+ return decodeURIComponent ( cookie . substring ( encodedName . length ) ) ;
23+ }
24+ }
25+ return null ;
26+ }
27+
28+ function shouldSkipRollAnimation ( ) {
29+ return getCookieValue ( 'skip_roll_animation' ) === 'true' ;
30+ }
31+
1232function shuffleArray ( items ) {
1333 const cloned = items . slice ( ) ;
1434 for ( let i = cloned . length - 1 ; i > 0 ; i -= 1 ) {
@@ -109,6 +129,7 @@ function rollTaskModal(options) {
109129 finalName,
110130 finalImage,
111131 instant = false ,
132+ showSpecialMessage = false ,
112133 candidates = [ ]
113134 } = options ;
114135
@@ -142,7 +163,7 @@ function rollTaskModal(options) {
142163 }
143164
144165 const finalImageSource = resolveTaskImageSource ( finalImage ) ;
145- specialNode . hidden = ! instant ;
166+ specialNode . hidden = ! showSpecialMessage ;
146167
147168 if ( instant ) {
148169 imageNode . src = finalImageSource ;
@@ -184,7 +205,8 @@ $(document).on('click', '#start', function(){
184205 await rollTaskModal ( {
185206 finalName : data . name ,
186207 finalImage : data . image ,
187- instant : isSpecialRollUser ( ) ,
208+ instant : isSpecialRollUser ( ) || shouldSkipRollAnimation ( ) ,
209+ showSpecialMessage : isShaduKatUser ( ) && shouldSkipRollAnimation ( ) ,
188210 candidates : rollCandidates
189211 } ) ;
190212
@@ -242,7 +264,8 @@ $(document).on('click', '#generate_unofficial', function(){
242264 await rollTaskModal ( {
243265 finalName : data . name ,
244266 finalImage : data . image ,
245- instant : isSpecialRollUser ( ) ,
267+ instant : isSpecialRollUser ( ) || shouldSkipRollAnimation ( ) ,
268+ showSpecialMessage : isShaduKatUser ( ) && shouldSkipRollAnimation ( ) ,
246269 candidates : rollCandidates . length > 0 ? rollCandidates : getOfficialRollCandidates ( )
247270 } ) ;
248271
0 commit comments