From 90d3067cab23cd3848d6ea0ced2050b6082f02ce Mon Sep 17 00:00:00 2001 From: digital-gnome <31593470+digital-gnome@users.noreply.github.com> Date: Wed, 11 Oct 2017 21:07:45 -0400 Subject: [PATCH] progressBar offset scope fixes progressBar offset passing a reference instead of a copy by wrapping it in a function. also fixes click events endlessly adding when navigating through zms events. --- web/skins/classic/views/js/event.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/web/skins/classic/views/js/event.js b/web/skins/classic/views/js/event.js index 9429fd70a..e1b7c244c 100644 --- a/web/skins/classic/views/js/event.js +++ b/web/skins/classic/views/js/event.js @@ -811,16 +811,19 @@ function drawProgressBar() { for ( var index = 0; index < cells_length; index += 1 ) { var cell = $( cells[index] ); - if ( index == 0 ) - cell.setStyles( { 'left': barWidth, 'width': cellWidth, 'borderLeft': 0 } ); - else - cell.setStyles( { 'left': barWidth, 'width': cellWidth } ); + function test (cell, index) { + if ( index == 0 ) + cell.setStyles( { 'left': barWidth, 'width': cellWidth, 'borderLeft': 0 } ); + else + cell.setStyles( { 'left': barWidth, 'width': cellWidth } ); - var offset = parseInt( (index*eventData.Length)/cells_length ); - cell.setProperty( 'title', '+'+secsToTime(offset)+'s' ); - cell.removeEvent( 'click' ); - cell.addEvent( 'click', function() { streamSeek( offset ); } ); - barWidth += cell.getCoordinates().width; + var offset = parseInt( (index*eventData.Length)/cells_length ); + cell.setProperty( 'title', '+'+secsToTime(offset)+'s' ); + cell.removeEvents( 'click' ); + cell.addEvent( 'click', function() { streamSeek( offset ); } ); + barWidth += cell.getCoordinates().width; + } + test (cell, index); } $('progressBar').setStyle( 'width', barWidth ); $('progressBar').removeClass( 'invisible' );