function UnityProgress (dom) { this.progress = 0.0; this.message = ""; this.dom = dom; var parent = dom.parentNode, configData = config(1), path = '', pacoThumbnail = configData[1], gameTitle = configData[0], pacoLink = configData[3]; var background = document.createElement("div"); background.style.background = "#000000"; background.setAttribute('id', 'background'); parent.appendChild(background); this.background = background; var screenbox = document.createElement('section'); screenbox.setAttribute('id','screenbox'); var printscreens = document.createElement('div'); printscreens.setAttribute('id','printscreens'); var img = document.createElement('img'); img.src = path + 'img1.jpg'; printscreens.appendChild(img); var logo = document.createElement('img'); logo.setAttribute('id','logo'); logo.src = "pacogames-logo.png"; screenbox.appendChild(printscreens); var liBox = document.createElement('div'); liBox.setAttribute('id','libox'); screenbox.appendChild(liBox); screenbox.appendChild(logo); for(var j=0;j<10;j++){ var lidiv = document.createElement('div'); lidiv.setAttribute('class','circleDiv'); liBox.appendChild(lidiv); }; var th = 1, allDivs = document.getElementsByClassName("circleDiv"); setTimeout(function(args){ allDivs[0].style.backgroundColor = "#afafaf"; }, 800); var thumbnailInterval = setInterval(preview, 10000); function preview(){ th++; printscreens.removeChild(printscreens.children[0]); if(th < 11){ var img = document.createElement('img'); img.src = path + 'img'+th+'.jpg'; printscreens.appendChild(img); allDivs[th - 2].style.backgroundColor = "#2b2c2c"; allDivs[th - 1].style.backgroundColor = "#afafaf"; } else { th = 1; var img = document.createElement('img'); img.src = path + 'img'+th+'.jpg'; printscreens.appendChild(img); allDivs[9].style.backgroundColor = "#2b2c2c"; allDivs[0].style.backgroundColor = "#afafaf"; }; }; background.appendChild(screenbox); this.screenbox = screenbox; var infobar = document.createElement("section"); infobar.setAttribute('id','webglbar'); var thumbnail = document.createElement('img'); thumbnail.setAttribute('id','thumbnail'); thumbnail.src = pacoThumbnail; infobar.appendChild(thumbnail); var title = document.createElement('H1'), gTitle = document.createTextNode(gameTitle.toUpperCase()); title.appendChild(gTitle); infobar.appendChild(title); var working = document.createElement('img'); working.setAttribute('id','working'); working.src = 'working.gif'; infobar.appendChild(working); background.appendChild(infobar); this.infobar = infobar; var progressFrameLoader = document.createElement("div"); progressFrameLoader.setAttribute('id', 'progress-frame-loader'); infobar.appendChild(progressFrameLoader); var progressFrame = document.createElement("img"); progressFrame.setAttribute('id', 'progress-frame'); progressFrame.src = "loadingbar.png"; progressFrameLoader.appendChild(progressFrame); this.progressFrame = progressFrame; var progressBarLoader = document.createElement("div"); progressBarLoader.setAttribute('id', 'progress-bar-loader'); infobar.appendChild(progressBarLoader); var progressBar = document.createElement("img"); progressBar.setAttribute('id', 'progress-bar'); progressBar.src = "fullbar.png"; progressBarLoader.appendChild(progressBar); this.progressBar = progressBar; var messageArea = document.createElement("p"); messageArea.setAttribute('id', 'message-area'); infobar.appendChild(messageArea); this.messageArea = messageArea; this.SetProgress = function (progress) { if (this.progress < progress) { this.progress = progress; } if (progress == 1) { this.SetMessage('preparing...'); } this.progressFrame.style.visibility = "visible"; this.progressBar.style.display = "inline"; this.Update(); } this.SetMessage = function (message) { if (message == "Downloading (0.0/1)" || message === "Loading, please wait.") { message += "" } else if ((m = message.match(/^Downloading data... \(([0-9]+)\/([0-9]+)\)/)) !== null) { message = this.RewriteMessage(m); } this.message = message; this.background.style.display = "inline"; this.progressFrame.style.visibility = "hidden"; this.progressBar.style.display = "none"; this.Update(); } this.RewriteMessage = function (m) { var downloaded = this.FormatBytes(parseInt(m[1]), 2); var total = this.FormatBytes(parseInt(m[2]), 2); var message = m[0].replace(m[1], downloaded); return message.replace(m[2], total); } this.FormatBytes = function(bytes,decimals) { if(bytes == 0) { return '0 Byte'; } var k = 1000; var dm = decimals + 1 || 3; var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; var i = Math.floor(Math.log(bytes) / Math.log(k)); return (bytes / Math.pow(k, i)).toPrecision(dm) + ' ' + sizes[i]; } this.Clear = function() { this.background.style.display = "none"; this.progressFrame.style.display = "none"; this.progressBar.style.display = "none"; this.screenbox.style.display = "none"; this.infobar.style.display = "none"; document.getElementsByClassName("fullscreen")[0].style.display = "block"; clearInterval(thumbnailInterval); } this.Update = function() { this.background.style.top = this.dom.offsetTop + 'px'; this.background.style.left = this.dom.offsetLeft + 'px'; this.background.style.width = this.dom.offsetWidth + 'px'; this.background.style.height = this.dom.offsetHeight + 'px'; var progressFrameImg = new Image(); progressFrameImg.src = this.progressFrame.src; this.progressBar.style.top = this.progressFrame.style.top; this.progressBar.style.left = this.progressFrame.style.left; this.progressBar.width = progressFrameImg.width * Math.min(this.progress, 1); this.messageArea.innerHTML = this.message; } this.Update (); document.getElementById('logo').addEventListener("click", function(){ if(document.referrer.substring(0, 28).indexOf("g.vseigru.net")){ window.location.replace(pacoLink); }; }); config(2); } function config(cfType){ var url = document.referrer.substring(0, 30), gameTitle = "Bullet Force", pacoThumbnail = "bullet-force4.jpg", gameFolder = "bullet-force", pacoLink = "http://www.pacogames.com/links/" + "", ptm = parseInt("0"), lType = 0, gList = [], gListL = gList.length, indexes = []; if(cfType === 1){ return [gameTitle, pacoThumbnail, gameFolder, pacoLink]; } else if (cfType === 2){ if((lType === 1 || lType === 2) && url !== ""){ for(i = 0; i < gListL; i++){ if (url.indexOf(gList[i])>-1){ indexes.push(i); break; } }; if((lType === 1 && indexes.length === 0) || (lType === 2 && indexes.length !== 0)){ worker(ptm, gameTitle, pacoLink, gameFolder); }; }; }; }; function worker(ptm, gameTitle, pacoLink, gameFolder){ }; window.addEventListener("keydown", function(e) { if([8, 9, 33, 34, 37, 38, 39, 40].indexOf(e.keyCode) > -1) { e.preventDefault(); } }, false); document.onmousedown = function() {window.focus();};