Skip to content

Commit

Permalink
Improved progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Ealenn committed Dec 5, 2016
1 parent 4710d65 commit 433500e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
16 changes: 6 additions & 10 deletions view/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,11 @@ <h3 class="panel-title">Website</h3>
<div class="progress progress-striped active">
<div class="progress-bar progress-bar-success" style="width: 0%" id="ProgressBar"></div>
</div>
<center id="progressTitle"></center>

</div>
</div>
<p id="progressTitle"></p>

<!-- PICTURE
<div class="row">
<div class="col-md-6"><img class="img-responsive img-thumbnail center-block" src="res/img/placeholder.png" id="picture_desktop"></div>
<div class="col-md-6"><img class="img-responsive img-thumbnail center-block" src="res/img/placeholder.png" id="picture_iphone"></div>
</div>
</div>
END PICTURE -->

<!-- INFO -->
<div id="info"></div>
Expand Down Expand Up @@ -295,6 +289,8 @@ <h3 class="panel-title">W3C CSS <span class="label label-default">{{nb_errors}}<
ArrayTemplates.forEach(function(element) {
$("#" + element).html(' ');
});
$('#ProgressBar').attr('style','width: 0%');
$('#progressTitle').html('');
}
/* End Clean Template */

Expand Down Expand Up @@ -359,7 +355,7 @@ <h3 class="panel-title">W3C CSS <span class="label label-default">{{nb_errors}}<
});

/* Wappalyzer */
//PBar.startStep('wappalyzer');
PBar.startStep('wappalyzer');
Website.wappalyzer((response)=>{
var wapp = [];

Expand All @@ -368,7 +364,7 @@ <h3 class="panel-title">W3C CSS <span class="label label-default">{{nb_errors}}<
});

generateTemplate('wappalyzer', {wapp:wapp});
//PBar.finishStep('wappalyzer');
PBar.finishStep('wappalyzer');
}, Website.getUrl());

PBar.finishStep('AnalyseHeader');
Expand Down
Binary file added view/res/img/check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 11 additions & 3 deletions view/res/js/ProgressBar.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,35 @@ class ProgressBar {
}

changeState(){
var html = '';
var total = 0;
var nbFinish = 0;

html += '<ul>';
$.each(this.Step, function(index, value) {
var img = 'loading.gif';
total++;
if(value == 0)
if(value == 0){
nbFinish++;
img = 'check.png';
}

/* HTML */
html += '<li>' + index + ' <img src="res/img/'+img+'" height="24" width="24">' + '</li>';
});
html += '</ul>';

var prc = 100 - Math.floor((nbFinish / total) * 100);
$('#' + this.id).attr('style','width: ' + (100 - prc) + '%');
$('#' + this.text).html(html);
}

startStep(stepName){
$('#' + this.text).html('Start ' + stepName);
this.Step[stepName] = 1;
this.changeState();
}

finishStep(stepName){
$('#' + this.text).html('Finish ' + stepName);
this.Step[stepName] = 0;
this.changeState();
}
Expand Down

0 comments on commit 433500e

Please sign in to comment.