(box, loop, offset)
| 297 | _clearttClsReg = / t{1,2}\d+| bad/; |
| 298 | |
| 299 | function refreshGameLayer(box, loop, offset) { |
| 300 | let i = Math.floor(Math.random() * 1000) % 4 + (loop ? 0 : 4); |
| 301 | for (let j = 0; j < box.children.length; j++) { |
| 302 | let r = box.children[j], rstyle = r.style; |
| 303 | rstyle.left = (j % 4) * blockSize + 'px'; |
| 304 | rstyle.bottom = Math.floor(j / 4) * blockSize + 'px'; |
| 305 | rstyle.width = blockSize + 'px'; |
| 306 | rstyle.height = blockSize + 'px'; |
| 307 | r.className = r.className.replace(_clearttClsReg, ''); |
| 308 | if (i === j) { |
| 309 | _gameBBList.push({ |
| 310 | cell: i % 4, |
| 311 | id: r.id |
| 312 | }); |
| 313 | r.className += ' t' + (Math.floor(Math.random() * 1000) % 5 + 1); |
| 314 | r.notEmpty = true; |
| 315 | i = (Math.floor(j / 4) + 1) * 4 + Math.floor(Math.random() * 1000) % 4; |
| 316 | } else { |
| 317 | r.notEmpty = false; |
| 318 | } |
| 319 | } |
| 320 | if (loop) { |
| 321 | box.style.webkitTransitionDuration = '0ms'; |
| 322 | box.style.display = 'none'; |
| 323 | box.y = -blockSize * (Math.floor(box.children.length / 4) + (offset || 0)) * loop; |
| 324 | setTimeout(function () { |
| 325 | box.style[transform] = 'translate3D(0,' + box.y + 'px,0)'; |
| 326 | setTimeout(function () { |
| 327 | box.style.display = 'block'; |
| 328 | }, 100); |
| 329 | }, 200); |
| 330 | } else { |
| 331 | box.y = 0; |
| 332 | box.style[transform] = 'translate3D(0,' + box.y + 'px,0)'; |
| 333 | } |
| 334 | box.style[transitionDuration] = '150ms'; |
| 335 | } |
| 336 | |
| 337 | function gameLayerMoveNextRow() { |
| 338 | for (let i = 0; i < GameLayer.length; i++) { |
no outgoing calls
no test coverage detected