class Logo {
constructor() {
this.Visible=false
this.offSet=0
this.img = document.createElement('IMG');
this.img.onload = this.comp
this.menu=false
this.img.src = $mainLogo
this.botom = 0
this.ratio = 1
}
comp=()=>{
this.Show()
}
Show= (menu=false) => {
this.menu=menu
this.offSet = menu ? $( window ).height()*0.3 : 0
gsap.to($( "#pxs_logo" ),0.5,{top: ($( window ).height()-$("#pxs_logo").height())/2-this.offSet/2 })
var logotop = ($( window ).height()-$("#pxs_logo").height())/2-this.offSet/2
var ratio = $( window ).width() / 580
if(ratio >1){ratio=1}
this.botom=($("#pxs_logo").height()*ratio) + (($("#pxs_logo").height()-($("#pxs_logo").height()*ratio))/2) + logotop
$(window).on('resize', this.resized );
if( this.Visible){
return
}
$( "#pxs_logo" ).remove()
var elmnt = $('
');
$( "body" ).append(elmnt)
this.canvas = document.getElementById('c');
this.ctx = this.canvas.getContext('2d');
$("#pxs_logo").css({position:"absolute",width:480})
this.Visible=true
this.ctx.clearRect(0, 0,480, 240);
$("#pxs_logo").show();
this.everyTime();
this.logoint=setInterval(this.everyTime, 30);
this.resized()
$ViewPort()
gsap.to($('body'),0.5,{background:"#000000"})
};
resized=( )=>{
var logotop = ($( window ).height()-$("#pxs_logo").height())/2-this.offSet/2
$("#pxs_logo").css({ left: ($( window ).width()-$("#pxs_logo").width())/2 });
$("#pxs_logo").css({ top:logotop });
var ratio = $( window ).width() / 580
if(ratio >1){ratio=1}
if(ratio<1){
$("#pxs_logo").css({transform: 'scale('+ratio+')', 'transform-origin': '50% 50%' })
}
this.ratio=ratio
this.botom=($("#pxs_logo").height()*ratio) + (($("#pxs_logo").height()-($("#pxs_logo").height()*ratio))/2) + logotop
}
everyTime = () =>{
for(var i=0; i<35; i++){
this.scratch();
}
}
Hide= () =>{
this.botom = 0
if(!this.Visible){return}
this.Visible=false
clearInterval( this.logoint);
$("#pxs_logo").fadeOut();
setTimeout(this.Closed,500)
$(window).off('resize', this.resized );
this.botom=0
gsap.to($('body'),0.5,{background:$BColor})
}
Closed= () => {
$("#pxs_logo").remove()
}
scratch= () => {
this.ctx.save();
var rx =0
var ry =this.randomNumber(0,240)
var XY = [{x:rx, y:ry}];
XY[1] = {x:480, y:ry+1};
var yyy = this.randomNumber(0,240)
var XY = [{x:this.randomNumber(0,480), y:yyy}];
XY[1] = {x:this.randomNumber(0,480), y:yyy+1};
this.ctx.beginPath( );
this.ctx.moveTo(XY[0].x,XY[0].y);
this.ctx.lineTo(XY[1].x,XY[1].y);
this.ctx.lineTo(XY[1].x+1 ,XY[1].y );
this.ctx.lineTo(XY[0].x+1,XY[0].y );
this.ctx.closePath();
this.ctx.fill();
this.ctx.clip();
this.ctx.drawImage(this.img, 0, 0, this.img.width, this.img.height, 0, 0, this.canvas.width, this.canvas.height);
this.ctx.restore();
}
randomNumber= (min, max) =>{
return Math.floor(Math.random()*(max-min+1)+min);
}
}
class Loading {
constructor() {
var ldng = $('');
$( "body" ).append(ldng)
var loader = $('');
$( "#main_loader_cont" ).append(loader)
//$(window).resize( this.resized );
//this.resized()
this.count=0
var rnd="?i="+Math.random()
this.scripts=[
'js/postwait.js' ,
//'js/textsinputs.js' ,
'js/modal.js' ,
'js/qrious.min.js' ,
'../js/jquery-ui.js',
'../js/jquery.mobile-events.min.js',
'../css/jquery-ui.css',
'../js/html5-qrcode.min.js',
]
this.scripts.push( 'js/index.js'+rnd)
this.scripts.push( 'css/loaded.css'+rnd)
this.scripts.push( 'js/lang-ui.js'+rnd, )
this.scripts.push( 'js/menu.js'+rnd)
this.scripts.push( 'js/welcome.js'+rnd)
this.scripts.push( 'js/QuotePresentationLogic.js'+rnd)
this.scripts.push( 'js/presentation.js'+rnd)
this.scripts.push( 'js/QuoteBuisnessLogic.js'+rnd)
this.scripts.push( 'js/buisness.js'+rnd)
this.scripts.push( 'js/finished.js'+rnd)
this.resized()
}
resized=( )=>{
}
LoadingStarting= async() => {
console.log("LoadingScriptsStarting")
$("#main_loader_cont").fadeIn('slow');
//start load files
$("#main_loader_text").text('0%')
this.resized()
//var URL = window.location.search.substring(1)
//var page = getURLobject(URL)
for(var i=0; i {
var tp=''
var rnd=''
if(file.split("?").length>1){
var t= file.split("?")
file =t[0]
rnd = "?"+t[1]
tp = file.split(".")[file.split(".").length-1]
}else{
tp = file.split(".")[file.split(".").length-1]
}
if(tp=="js"){
var scrpt = document.createElement('script');
scrpt.type = "application/javascript";
scrpt.innerHTML = await this.LoadContenet(file,progress, 'text',rnd)
if(addto=='find'){addto='body'}
$( addto ).append(scrpt)
}
if(tp=="css"){
var lnk = document.createElement('link');
lnk.rel = 'stylesheet';
lnk.type = 'text/css';
lnk.href = file+rnd;
//lnk.id = file.split('/').reverse()[0]
//lnk.innerHTML = await this.LoadContenet(file,progress, 'text', rnd)
if(addto=='find'){addto='head'}
$( addto ).append(lnk)
}
if(tp=="svg"){
var nm =file.split("/").reverse()[0]
var data = await this.LoadContenet(file,progress, 'text', rnd)
$SVGS[nm]=data;
}
if(tp=="jpg" || tp=="jpeg" || tp=="png"){
var img = new Image();
await img.load(file, this.Percent);
}
return(true)
}
LoadContenet= async (file,progress=null,type='text',rand='') => {
return new Promise((resolve, reject)=>{
if(rand==''){ //let cached
$.ajax({
url :file,
dataType: type,
success : resolve,
error : function (){resolve('error')},
progress: progress
});
}else{
$.ajax({
url :'php/loadfile.php',
data:{url:'../'+file, rnd:Math.random()},
success : resolve,
error : function (){resolve('error')},
progress: progress,
cache: false
});
}
})
}
Percent= (e) => {
var mainpcnt = ((this.count/(this.scripts.length))*99)
var toadd = (((this.count+1)/(this.scripts.length))*99)-mainpcnt
var curPcnt = (e.loaded / e.total)
if(curPcnt==Infinity){curPcnt=0}
var pcnt = mainpcnt+(curPcnt*toadd)
if(pcnt==0){pcnt=1}
$("#main_loader_text").text( pcnt.toFixed(0)+"%")
gsap.to($("#loader_bar"),0.1,{ width: pcnt.toFixed(0) +"%" } );
var scle = (0.4 * (pcnt/100))+0.15
//gsap.to($("#loadingplanet"),5,{ scale:scle })
//$("#loadingplanet").css({transform: 'scale('+scle+')', 'transform-origin': '50% 50%' })
}
LoadingComplete= ( ) => {
var pcnt = ((this.count/ (this.scripts.length ))*100)
if(pcnt==0){pcnt=1}
$("#main_loader_text").text(pcnt.toFixed(0)+"%")
gsap.to($("#loader_bar"),0.1,{ width: pcnt.toFixed(0) +"%" } );
setTimeout(this.Hide,800)
setTimeout(LoadingScriptsComplete,1500)
}
Hide= () => {
$("#main_loader_cont").fadeOut('slow');
setTimeout(this.HideNow,2500)
}
HideNow= () => {
//console.log("DestroyNow")
$("#load-result").fadeIn('slow');
$("#main_loader_cont").remove()
}
}