diff --git a/theme/salsa_entity.js b/theme/salsa_entity.js index 8339de5..c4ca5b1 100644 --- a/theme/salsa_entity.js +++ b/theme/salsa_entity.js @@ -32,44 +32,44 @@ // Start the animation. setTimeout(progress, progress_conf[0].animation_speed); + } - /** - * Increases value and width of the progress bar. - * - * Calls itself after some timeout until the maximum value is reached. - */ - function progress() { - var all_complete = true; - for (var i = 0; i < progress_conf.length; i++) { - // The total is either a percent amount of the goal or the passed - // total if label is counted up in absolute parts. - var total = stack[i].config.percent_label ? parseInt(stack[i].config.total/stack[i].config.goal * 100) : stack[i].config.total; - if (!stack[i].complete) { - // Increase the value for 1% point and store it on the stack. - stack[i].value += stack[i].step; - // Also increase the width of the progress bar. - stack[i].$progress_indicator.css('width', Math.min(100, parseInt(stack[i].value/stack[i].step)) + '%'); - // Don't print fractals, only integers. If percent label is set - // for the entity add the % sign to the label. - var label = stack[i].config.percent_label ? parseInt(stack[i].value) + '%' : parseInt(stack[i].value); - stack[i].$label.text(label); - all_complete = false; - } - - // Loop until the total is reached or the value exceeds 100%. - if (!stack[i].complete && (stack[i].value >= total || parseInt(stack[i].value/stack[i].step) >= 100)) { - // Display label that was set on the server. - stack[i].$label.text(Drupal.t(stack[i].config.total_string, stack[i].config.total_args)); - // Mark current progress bar as done. - stack[i].complete = true; - } + /** + * Increases value and width of the progress bar. + * + * Calls itself after some timeout until the maximum value is reached. + */ + function progress() { + var all_complete = true; + for (var i = 0; i < progress_conf.length; i++) { + // The total is either a percent amount of the goal or the passed + // total if label is counted up in absolute parts. + var total = stack[i].config.percent_label ? parseInt(stack[i].config.total/stack[i].config.goal * 100) : stack[i].config.total; + if (!stack[i].complete) { + // Increase the value for 1% point and store it on the stack. + stack[i].value += stack[i].step; + // Also increase the width of the progress bar. + stack[i].$progress_indicator.css('width', Math.min(100, parseInt(stack[i].value/stack[i].step)) + '%'); + // Don't print fractals, only integers. If percent label is set + // for the entity add the % sign to the label. + var label = stack[i].config.percent_label ? parseInt(stack[i].value) + '%' : parseInt(stack[i].value); + stack[i].$label.text(label); + all_complete = false; } - if (!all_complete) { - // Loop. - setTimeout(progress, stack[0].config.animation_speed); + // Loop until the total is reached or the value exceeds 100%. + if (!stack[i].complete && (stack[i].value >= total || parseInt(stack[i].value/stack[i].step) >= 100)) { + // Display label that was set on the server. + stack[i].$label.text(Drupal.t(stack[i].config.total_string, stack[i].config.total_args)); + // Mark current progress bar as done. + stack[i].complete = true; } } + + if (!all_complete) { + // Loop. + setTimeout(progress, stack[0].config.animation_speed); + } } }