1
- /*
2
- * decaffeinate suggestions:
3
- * DS101: Remove unnecessary use of Array.from
4
- * DS102: Remove unnecessary code created because of implicit returns
5
- * DS205: Consider reworking code to avoid use of IIFEs
6
- * DS207: Consider shorter variations of null checks
7
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
8
- */
9
1
//= require push
10
2
11
- const $ = window . jQuery ;
3
+ $ = window . jQuery ;
12
4
13
5
class Chat {
14
6
constructor ( board ) {
@@ -31,15 +23,13 @@ class Chat {
31
23
this . board . find ( "form" ) . submit ( this . postMessage ) ;
32
24
this . totoz_type = $ . cookie ( "totoz-type" ) ;
33
25
this . totoz_url = $ . cookie ( "totoz-url" ) || "https://totoz.eu/img/" ;
34
- for ( var right of Array . from ( this . board . find ( ".board-right" ) ) ) {
26
+ for ( var right of this . board . find ( ".board-right" ) ) {
35
27
this . norlogize ( right ) ;
36
28
}
37
- for ( var left of Array . from (
38
- this . board
39
- . find ( ".board-left time" )
40
- . get ( )
41
- . reverse ( )
42
- ) ) {
29
+ for ( var left of this . board
30
+ . find ( ".board-left time" )
31
+ . get ( )
32
+ . reverse ( ) ) {
43
33
this . norlogize_left ( left ) ;
44
34
}
45
35
this . board
@@ -73,33 +63,23 @@ class Chat {
73
63
. find ( ".board-left:last .norloge" )
74
64
. click ( this . norloge ) ;
75
65
this . inboxContainer . scrollTop ( this . inbox . height ( ) ) ;
76
- for ( right of Array . from ( this . inbox . find ( ".board-right:last" ) ) ) {
66
+ for ( right of this . inbox . find ( ".board-right:last" ) ) {
77
67
this . norlogize ( right ) ;
78
68
}
79
- return ( ( ) => {
80
- const result = [ ] ;
81
- for ( var left of Array . from ( this . inbox . find ( ".board-left time:last" ) ) ) {
82
- result . push ( this . norlogize_left ( left ) ) ;
83
- }
84
- return result ;
85
- } ) ( ) ;
69
+ for ( var left of this . inbox . find ( ".board-left time:last" ) ) {
70
+ this . norlogize_left ( left ) ;
71
+ }
86
72
} else {
87
73
this . inbox
88
74
. prepend ( msg . message )
89
75
. find ( ".board-left:first .norloge" )
90
76
. click ( this . norloge ) ;
91
- for ( right of Array . from ( this . inbox . find ( ".board-right:first" ) ) ) {
77
+ for ( right of this . inbox . find ( ".board-right:first" ) ) {
92
78
this . norlogize ( right ) ;
93
79
}
94
- return ( ( ) => {
95
- const result1 = [ ] ;
96
- for ( var left of Array . from (
97
- this . inbox . find ( ".board-left time:first" )
98
- ) ) {
99
- result1 . push ( this . norlogize_left ( left ) ) ;
100
- }
101
- return result1 ;
102
- } ) ( ) ;
80
+ for ( var left of this . inbox . find ( ".board-left time:first" ) ) {
81
+ this . norlogize_left ( left ) ;
82
+ }
103
83
}
104
84
}
105
85
@@ -144,7 +124,7 @@ class Chat {
144
124
}
145
125
const value = this . input . val ( ) ;
146
126
const range = this . input . caret ( ) ;
147
- if ( range . start == null ) {
127
+ if ( ! range . start ) {
148
128
range . start = 0 ;
149
129
range . end = 0 ;
150
130
}
@@ -173,9 +153,7 @@ class Chat {
173
153
const orig = escape ( this . data ) ;
174
154
let html = "" ;
175
155
while ( ( matches = r . exec ( orig ) ) ) {
176
- var [ match , datematch , timematch , minutes , index ] = Array . from (
177
- matches
178
- ) ;
156
+ var [ match , datematch , timematch , minutes , index ] = matches ;
179
157
if ( index ) {
180
158
switch ( index . substr ( 0 , 1 ) ) {
181
159
case ":" :
@@ -246,7 +224,7 @@ class Chat {
246
224
const orig = escape ( this . data ) ;
247
225
let html = "" ;
248
226
while ( ( matches = totoz . exec ( orig ) ) ) {
249
- var [ title , name ] = Array . from ( matches ) ;
227
+ var [ title , name ] = matches ;
250
228
var stop = matches . index ;
251
229
html =
252
230
html +
@@ -340,10 +318,8 @@ class Chat {
340
318
this . totoz . append ( totoz ) ;
341
319
}
342
320
const position = $ ( event . target ) . position ( ) ;
343
- const [ x , y ] = Array . from ( [
344
- position . left ,
345
- position . top + event . target . offsetHeight
346
- ] ) ;
321
+ const x = position . left ;
322
+ const y = position . top + event . target . offsetHeight ;
347
323
return totoz . css ( {
348
324
"z-index" : "15" ,
349
325
display : "block" ,
0 commit comments