File tree 1 file changed +16
-3
lines changed
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 285
285
</ script >
286
286
< script src ="/socket.io/socket.io.js "> </ script >
287
287
< script >
288
- var socket = io ( ) , room_name ;
288
+ var socket = io ( ) , room_name , time_played ;
289
289
290
290
function join ( ) {
291
291
if ( room_name ) socket . emit ( 'join' , room_name ) ;
292
292
}
293
+ function show_time_played ( ) {
294
+ var seconds = time_played % 60 ;
295
+ var minutes = ( time_played - seconds ) / 60 ;
296
+ document . getElementById ( 'time_played' ) . innerHTML = ( minutes < 10 ? '0' : '' ) + minutes + ( seconds < 10 ? ':0' : ':' ) + seconds ;
297
+ }
293
298
function join_and_run ( file ) {
294
299
room_name = prompt ( "Room name:" ) ;
295
300
run ( file ) ;
300
305
// console.log(event);
301
306
gba . keypad . keyboardHandler ( event ) ;
302
307
} ) ;
303
- }
308
+
309
+ time_played = 0 ;
310
+ setInterval ( function ( ) { time_played ++ ; show_time_played ( ) ; } , 1000 ) ;
311
+ }
312
+
304
313
if ( navigator . userAgent . match ( / ( i P a d ) | ( i P h o n e ) | ( i P o d ) | ( a n d r o i d ) | ( w e b O S ) / i) && confirm ( "Go to controller side?" ) )
305
314
document . location = "controller/index.html"
306
315
</ script >
329
338
< p > Sound</ p >
330
339
< input type ="range " min ="0 " max ="1 " value ="1 " step ="any " onchange ="setVolume(this.value) " oninput ="setVolume(this.value) ">
331
340
</ div >
332
- < p id ="room_name "> </ p >
341
+ < p >
342
+ < span id ="room_name "> </ span >
343
+ ►
344
+ < span id ="time_played "> </ span >
345
+ </ p >
333
346
< p id ="openDebug " onclick ="enableDebug() "> Debugger</ p >
334
347
</ div >
335
348
</ section >
You can’t perform that action at this time.
0 commit comments