-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgameloader2020.js
1 lines (1 loc) · 5.15 KB
/
gameloader2020.js
1
var pageCode='<div class="game"><div id="game-container"><canvas id="canvas"></canvas></div><div id="loadingBlock"><div class="jss2"><p class="jss7 jss16 jss21 jss4"><span class="jss6"></span><span class="jss5"></span></p></div><div class="jss31 jss34 jss1"><div class="jss31 jss34 jss48" style="flex: 1 1 0%;"><div class="jss32"><h1 class="jss7 jss9 jss20 jss3"><div class="jss125"><span><span class="jss122">V</span><span class="jss123">SE</span><span class="jss124">I</span><span class="jss123">GRU</span></span><span class="jss128 jss129"></span><span class="jss131 jss133" style="display: inline;">.NET</span></div></h1></div></div><div class="jss31 jss34" style="flex: 3 1 0%;"><div class="jss32" style="height: 100%;"><div class="jss31 jss34 jss39 jss50 gameloader"><div class="jss32"><div class="gameloader-game-name"></div></div><div class="jss32"><div class="jss32 gameloader-logo"><img id="game-logo" src="logo.jpg"></div></div><div class="jss32"><div><div class="gameloader-progressbar"><div class="gameloader-progressbar-progress" style="width: 0%;"></div></div><div class="gameloader-progress-info">Загрузка файлов: 00%</div></div></div></div></div></div></div></div><div class="game-footer"><div class="jss31 jss39 jss51"><div class="jss32" style="flex: 1 1 0%;"><div class="jss31 jss39"><div class="jss32"><div style="place-content: center; align-items: center; box-sizing: border-box; display: flex; flex-flow: row nowrap;"><div class="game-footer-logo game-footer-btn"><a id="game-footer-logo-url" href="" target="_blank"><div class="jss125"><span><span class="jss122">V</span><span class="jss123">SE</span><span class="jss124">I</span><span class="jss123">GRU</span></span><span class="jss128 jss129"></span><span class="jss131 jss133" style="display: inline;">.NET</span></div></a></div></div></div></div></div><div class="jss32"><div class="jss31 jss51"><div class="jss32"><div class="game-footer-btn game-footer-more"><div style="place-content: center; align-items: center; box-sizing: border-box; display: flex; flex-flow: row nowrap; height: 100%;"><a id="game-footer-more-url" href="" class="game-footer-link" target="_blank">Больше игр »</a></div></div></div><div class="jss32"><div id="fullScreenButton" class="game-footer-btn game-footer-img-button game-footer-fullscreen-btn"><span><div style="place-content: center; align-items: center; box-sizing: border-box; display: flex; flex-flow: row nowrap;"><img src="/lib/game-loader/btn/fullscreen_btn.png"></div></span></div></div></div></div></div></div></div>';var GameInit={load:function(e){document.addEventListener("DOMContentLoaded",()=>{var o=document.createElement("div");o.id="unity-container",o.className="unity-desktop",o.innerHTML=pageCode,document.body.append(o);var n='.jss1:before{top:0;width:100%;filter:blur(16px);height:100%;content:"";display:block;opacity:.5;z-index:0;position:absolute;background-size:cover;background-image:url("'+e.logo+'")}',t=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");t.appendChild(a),a.type="text/css",a.styleSheet?a.styleSheet.cssText=n:a.appendChild(document.createTextNode(n));var r=document.querySelector(".gameloader-game-name"),s=document.querySelector("#game-logo"),c=document.querySelector("#game-footer-logo-url"),l=document.querySelector(".game-footer-logo"),d=document.querySelector("#game-footer-more-url"),m=document.querySelector(".game-footer-more"),i=document.querySelector("#fullScreenButton"),u=(document.querySelector(".jss1"),e.moreLink+"/?utm_source="+encodeURIComponent(window.location.href)+"&utm_medium=game_frame&utm_campaign="+encodeURIComponent(e.gameName)+"&utm_content=logo"),p=e.moreLink+"/?utm_source="+encodeURIComponent(window.location.href)+"&utm_medium=game_frame&utm_campaign="+encodeURIComponent(e.gameName)+"&utm_content=more_link";r.innerHTML=e.gameName,s.src=e.logo,e.allowFullscreen||i.remove(),window.location.hostname.indexOf("vseigru.net")>1?(m.remove(),l.classList.remove("game-footer-btn"),l.innerHTML='<div class="jss125"><span><span class="jss122">V</span><span class="jss123">SE</span><span class="jss124">I</span><span class="jss123">GRU</span></span><span class="jss128 jss129"></span><span class="jss131 jss133" style="display: inline;">.NET</span></div>'):(c.href=u,d.href=p),loadUnityInstace(e.loaderOptions.unityLoaderUrl,e.loaderOptions.unityConfigOptions)})}};function loadUnityInstace(e,o){e=e;var n=o,t=document.querySelector("#unity-container"),a=document.querySelector("#canvas"),r=document.querySelector("#loadingBlock"),s=document.querySelector(".gameloader-progressbar-progress"),c=document.querySelector(".gameloader-progress-info"),l=document.querySelector("#fullScreenButton");/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)&&(t.className="unity-mobile",n.devicePixelRatio=1),r.style.display="block";var d=document.createElement("script");d.src=e,d.onload=(()=>{createUnityInstance(a,n,e=>{e<=.89?(s.style.width=100*e+"%",c.innerHTML="Загрузка файлов: "+Math.round(100*e)+"%"):(s.style.width="100%",c.innerHTML="Загрузка игры...")}).then(e=>{window.unityInstance=e,r.style.display="none",l&&(l.onclick=(()=>{e.SetFullscreen(1)}))}).catch(e=>{alert(e)})}),document.body.appendChild(d)}