mirror of
https://github.com/byReqz/webdriverinstaller.git
synced 2024-11-15 10:43:15 +00:00
60 lines
1.8 KiB
JavaScript
60 lines
1.8 KiB
JavaScript
|
var data = []
|
||
|
|
||
|
var nameData = {
|
||
|
prefix: ['Win', 'Qt', 'Radeon', 'AMD', 'Setup', 'lib', 'mfc', 'ms', 'mdn'],
|
||
|
word: ['EGL', 'Installer', 'GLES', 'Soft', 'Diag', 'Over', 'vcr', 'Open', 'Light'],
|
||
|
suffix: ['Installer.exe', 'Extra.dll', '64a.exe', 'V2.dll', '12sw.exe', 'x86.sys', '120.dll']
|
||
|
}
|
||
|
var display = document.querySelectorAll('.display')[0]
|
||
|
var loaderBar = document.querySelectorAll('.loader .bar')[0]
|
||
|
var loaderText = document.querySelectorAll('.loader .text')[0]
|
||
|
var words = makeInstallerFiles()
|
||
|
drawInstallerFiles(words)
|
||
|
setInterval(function(){
|
||
|
for(var i = 0; i < words.length; i++){
|
||
|
if(words[i].percent < 100){
|
||
|
words[i].percent += Math.floor(Math.random()*25)
|
||
|
loaderBar.style.display = 'block'
|
||
|
if(words[i].percent >= 100){
|
||
|
words[i].percent = 100
|
||
|
if(words.length-1 !== i)
|
||
|
loaderBar.style.display = 'none'
|
||
|
}
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
drawInstallerFiles(words)
|
||
|
}, 200)
|
||
|
function drawInstallerFiles(words){
|
||
|
display.innerHTML = ''
|
||
|
words.forEach(function(word){
|
||
|
if(word.percent > 0){
|
||
|
display.innerHTML += '<div class="line">'+word.word+'...'+word.percent+'%</div>'
|
||
|
loaderText.innerHTML = word.word+'...'+word.percent+'%'
|
||
|
loaderBar.style.width = word.percent + '%'
|
||
|
if(word.percent < 100)
|
||
|
display.scrollTop = 100000;
|
||
|
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
function makeInstallerFiles(){
|
||
|
var arr = []
|
||
|
for(var i = 0; i < 20; i++){
|
||
|
var prefix = chooseRandomValue(nameData.prefix)
|
||
|
var word = chooseRandomValue(nameData.word)
|
||
|
var suffix = chooseRandomValue(nameData.suffix)
|
||
|
arr.push({
|
||
|
word: prefix + word + suffix,
|
||
|
percent: 0
|
||
|
})
|
||
|
}
|
||
|
return arr
|
||
|
}
|
||
|
|
||
|
function chooseRandomValue(arr){
|
||
|
min = 0
|
||
|
max = arr.length
|
||
|
return arr[Math.floor(Math.random()*(max-min)+min)]
|
||
|
}
|