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- */
91//= require push
102
11- const $ = window . jQuery ;
3+ $ = window . jQuery ;
124
135class Chat {
146 constructor ( board ) {
@@ -31,15 +23,13 @@ class Chat {
3123 this . board . find ( "form" ) . submit ( this . postMessage ) ;
3224 this . totoz_type = $ . cookie ( "totoz-type" ) ;
3325 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" ) ) {
3527 this . norlogize ( right ) ;
3628 }
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 ( ) ) {
4333 this . norlogize_left ( left ) ;
4434 }
4535 this . board
@@ -73,33 +63,23 @@ class Chat {
7363 . find ( ".board-left:last .norloge" )
7464 . click ( this . norloge ) ;
7565 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" ) ) {
7767 this . norlogize ( right ) ;
7868 }
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+ }
8672 } else {
8773 this . inbox
8874 . prepend ( msg . message )
8975 . find ( ".board-left:first .norloge" )
9076 . 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" ) ) {
9278 this . norlogize ( right ) ;
9379 }
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+ }
10383 }
10484 }
10585
@@ -144,7 +124,7 @@ class Chat {
144124 }
145125 const value = this . input . val ( ) ;
146126 const range = this . input . caret ( ) ;
147- if ( range . start == null ) {
127+ if ( ! range . start ) {
148128 range . start = 0 ;
149129 range . end = 0 ;
150130 }
@@ -173,9 +153,7 @@ class Chat {
173153 const orig = escape ( this . data ) ;
174154 let html = "" ;
175155 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 ;
179157 if ( index ) {
180158 switch ( index . substr ( 0 , 1 ) ) {
181159 case ":" :
@@ -246,7 +224,7 @@ class Chat {
246224 const orig = escape ( this . data ) ;
247225 let html = "" ;
248226 while ( ( matches = totoz . exec ( orig ) ) ) {
249- var [ title , name ] = Array . from ( matches ) ;
227+ var [ title , name ] = matches ;
250228 var stop = matches . index ;
251229 html =
252230 html +
@@ -340,10 +318,8 @@ class Chat {
340318 this . totoz . append ( totoz ) ;
341319 }
342320 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 ;
347323 return totoz . css ( {
348324 "z-index" : "15" ,
349325 display : "block" ,
0 commit comments