Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getRandomInt(min, max) {
- return Math.floor(Math.random() * (max - min)) + min;
- };
- function analize(link,time){
- var
- max_errors = getRandomInt(8,16),
- xx = false,
- percent = 0.0,
- errors = 0,
- i = 0,
- j = 0,
- jj = 0,
- k = 0,
- bar = document.getElementById('progressbar'),
- aa = document.getElementById('analyzer-errors'),
- times = [];
- for( i = 0; i <= max_errors; i++) {
- times.push(getRandomInt(5,25)*time)
- }
- times.sort(function() {
- return .2 - Math.random();
- });
- var progress = setInterval(function() {
- if( ++i < 25*time || ( i > 50*time && i < 85*time ) || i > 135*time ){
- percent = Math.round( (percent+1/time) * 10 ) / 10;
- j++;
- bar.style.width = percent+'%';
- if( xx && errors < max_errors && j>=jj ){
- errors++;
- jj += times[k++]*time/max_errors;
- text = (errors > 1) ? "errors" : "error";
- aa.innerHTML = errors+" "+text+" found…";
- }
- }
- if( !xx && i > 40 ){
- xx= true;
- jj =j;
- aa.classList.remove("hide");
- }
- if ( percent >= 100 ) {
- clearInterval(progress);
- form.method = 'post';
- form.action = link;
- form.submit();
- }
- }, 5);
- };
Advertisement
Add Comment
Please, Sign In to add comment