let body=$("body"), header=$("#header"), menu=header.find("#menu"), baseApiUrl="https://lift.eltedu.net/api/";
const params=new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, prop)=> searchParams.get(prop),
});
if(params.d!=null){
$.cookie('danisman', params.d.toLowerCase(), {
expires: 90,
path: '/',
domain: '.elt.com.tr'
});
}
if(typeof $.cookie('consGuid')==='undefined'){
$.cookie('consGuid', (S4() + S4() + "-" + S4() + "-4" + S4().substr(0, 3) + "-" + S4() + "-" + S4() + S4() + S4()).toLowerCase(), {
expires: 90,
path: '/',
domain: '.elt.com.tr'
});
}
if(typeof $.cookie('first')==='undefined'){
$.cookie('first', document.URL, {
expires: 90,
path: '/',
domain: '.elt.com.tr'
});
}
$(document).on("keypress",".float-number",function (event){
if(((event.which!=46&&event.which!=45)||$(this).val().indexOf('.')!=-1)&&(event.which < 48||event.which > 57)){
event.preventDefault();
}});
$(document).on("change","form.calculatePoint input.input-with-target",function(event){
var t=$(this),ta=t.data("target"),f=t.closest("form"),fo=t.data("formula"),c="collapse";
f.find(".tr-req").addClass(c);
f.find(".tr-req .required-element").prop("required",false);
f.find(ta).removeClass(c);
f.find(ta).find(".required-element").prop("required",true);
f.data("formula",fo);
f.attr("data-formula",fo);
});
$(document).on("submit","form.calculatePoint",function(event){
let tf=$(this), data=tf.serializeArray(),result={},f=tf.data("formula"),pm=tf.closest(".calculatePointModule"),m=pm.find(".modal"),mb=m.find(".modal-body"),err=0;
$.each(data, function(index, item){
if(tf.find("input[name='"+item.name+"']").length){
let inp=tf.find("input[name='"+item.name+"']");
if(inp.hasClass("float-number")){
let iv=parseFloat(item.value);
if(iv<inp.attr("min")){
err++;
alert("En az "+inp.attr("min")+" olmalıdır.");
}
else if(iv>inp.attr("max")){
err++;
alert("En fazla "+inp.attr("max")+" olmalıdır.");
}}
}
if(!err){
if(item.value){
result[item.name]=parseInt(item.value);
f=f.replaceAll(item.name,item.value);
}}
});
if(!err){
if(result&&f && f.indexOf("o")==-1){
let r=eval(f);
if(!!(r % 1)){
r=r.toFixed(2);
r=r.toString();
r=r.slice(0, (r.indexOf("."))+2);
Number(r);
}
let h='<div class="h1 text-center py-2">'+r+'</div>';
let h2='';
tf.find("input.option-value").each(function(){
let tx=$(this), l=tx.data("level"), txv=tx.val(),txt=tx.closest("tr").find(".option-title").text();
if(l){
if(typeof l==="string"){
l=JSON.parse(l);
}
if(typeof l==="object"){
let descx="",fst="";
$.each(l, function(key, value){
if(descx==""&&txv<=key){
descx=value;
}
if(fst==""){
fst=value;
}});
if(descx==""){
descx=fst;
}
if(descx){
h2 +='<div><strong>'+txt+':</strong> '+descx+'</div>';
}}
}});
if(h2){
h+='<div class="text-center">'+h2+'</div>';
}
mb.html(h);
m.modal("show");
pm.find('form').trigger("reset");
pm.find('form').find(".tr-req").addClass("collapse");
if(pm.find('form').find("input.input-with-target:checked").length){
pm.find('form').find("input.input-with-target:checked").trigger("change");
}}
}
return false;
});
$(document).on("keypress", ".only-numbers", function (e){
var c=e.which;
if(c < 48||c > 57){
e.preventDefault();
}});
if($(".fix-circle").length){
var ix=0,icons=["fa fa-file-text","fa fa-phone","fa fa-envelope"];
setInterval(function(){
$(".fix-circle i").attr("class",icons[ix]);
ix++;
if(ix>icons.length){
ix=0;
}},1000);
}
var allInOneFormModal=$("#allInOneFormModal");
if(allInOneFormModal.length){
allInOneFormModal.on('hide.bs.modal', function(e){
if($('body').hasClass('form-active')){
if(!allInOneFormModal.find(".form-tab-4").hasClass("active")){
e.preventDefault();
e.stopImmediatePropagation();
return false;
}}
});
var branchList=allInOneFormModal.find("#branchList"),ht="";
branchList.html(ht);
$("#footer .branchs .items .item").each(function(){
var it=$(this),itd=it.data("data");
if(itd&&typeof itd!="object"){
itd=JSON.parse(itd);
}
if(typeof itd=="object"){
ht+='<div class="branch-item col-md-12 col-4"><div class="branch-name">'+itd.title+'</div><div class="branch-phone"><a href="'+itd.phoneUrl+'">'+itd.phone+'</a></div></div>';
}});
if(ht!=""){
branchList.html('<div class="row">'+ht+'</div>');
}
$(".btn-all-in-one-form").each(function(){
let t=$(this),tp=t.data("program"),tc=t.data("country");
var queryString=window.location.search, urlParams=new URLSearchParams(queryString);
var qtp=urlParams.get('program'),qtc=urlParams.get('country');
if(qtp){
tp=qtp;
}
if(qtc){
tc=qtc;
}
if(tp){
$("body").attr("data-program",tp);
}
if(tc){
$("body").attr("data-country",tc);
}});
$(document).on("click", ".btn-all-in-one-form", function (){
var allInOneFormModal=$("#allInOneFormModal");
let t=$(this),tp=t.data("program"),tc=t.data("country"),acc="active",coc="complete",colc="collapse",rec="ready";
let ldh='<div class="form-elements-loading"><i class="fa fa-spinner fa-spin fa-fw"></i> YÜKLENİYOR</div>';
tp=$("body").data("program");
tc=$("body").data("country");
var ns="", ph="", em="", ci="", br="";
var queryString=window.location.search, urlParams=new URLSearchParams(queryString);
var qtp=urlParams.get('program'),qtc=urlParams.get('country'),qns=urlParams.get('namesurname'),qph=urlParams.get('phone'),qem=urlParams.get('email'),qci=urlParams.get('city'),qbr=urlParams.get('branch');
if(qtp){
tp=qtp;
}
if(qtc){
tc=qtc;
}
if(tc&&tc.indexOf(",")>0){
tc=tc.split(",");
}
if(qns){
ns=qns;
}
if(qph){
ph=qph;
}
if(qem){
em=qem;
}
if(qci){
ci=qci;
}
if(qbr){
br=qbr;
}
allInOneFormModal.find("input[type='text'],input[type='email'],input[type='tel']").val("");
allInOneFormModal.find("textarea,select").val("");
allInOneFormModal.find("input[type='radio']:checked").prop("checked",false).closest(".form-radio").removeClass(acc);
allInOneFormModal.find("input[type='checkbox']:checked").prop("checked",false).closest(".form-checkbox").removeClass(acc);
allInOneFormModal.find(".form-item-branch").addClass(colc);
allInOneFormModal.find(".form-item-branch select").remove();
allInOneFormModal.find(".form-steps > div").removeClass(acc).removeClass(coc);
allInOneFormModal.find(".form-steps .form-step-1").addClass(acc);
allInOneFormModal.find(".form-tabs .form-tab").removeClass(acc).removeClass(coc).removeClass(rec);
allInOneFormModal.find(".form-tabs .form-tab-1").addClass(acc);
allInOneFormModal.find(".form-result-wrapper").html("");
var tad=allInOneFormModal.find(".form-tabs .form-tab-1 .form-elements-wrapper");
var citd=allInOneFormModal.find(".form-tabs .form-item-city .form-elements-wrapper");
tad.html(ldh);
$.get(baseApiUrl + "Site/Base").done(function (data){
var pHtml="",cHtml="";
if("data" in data){
$.each(data.data.programs, function (i,v){
if("code" in v&&"name" in v&&v.name&&v.code){
pHtml+='<label class="form-radio"><input type="radio" name="program" class="form-program" required value="'+v.code+'">'+v.name+'</label>';
}});
if(Array.isArray(data.data.cities)&&data.data.cities.length){
citd.attr("data-city-list",JSON.stringify(data.data.cities));
citd.attr("data-branch-list",JSON.stringify(data.data.branches));
cHtml+='<select class="form-control form-city" required><option value="" selected disabled>SEÇİNİZ</option>';
$.each(data.data.cities, function (i,v){
if("code" in v&&"name" in v&&v.name&&v.code){
cHtml+="<option value='"+v.code+"' data-branches='"+JSON.stringify(v.branches)+"'>"+v.name+"</option>";
}});
cHtml+='</select>';
}}
tad.html(pHtml);
citd.html(cHtml);
if(allInOneFormModal.hasClass("modal")&&allInOneFormModal.find(".modal-body").html()){
console.log(allInOneFormModal);
allInOneFormModal.modal("show");
}
if(pHtml!=""){
allInOneFormModal.find(".form-tabs .form-tab-1").addClass(rec);
if(tp&&allInOneFormModal.find("input[name='program'][value='"+tp+"']").length){
allInOneFormModal.find(".form-tabs .form-tab").removeClass(acc).removeClass(coc).removeClass(rec);
allInOneFormModal.find(".form-steps > div").removeClass(acc).removeClass(coc);
allInOneFormModal.find("input[name='program'][value='"+tp+"']").prop("checked",true).trigger("click").closest(".form-radio").addClass(acc);
allInOneFormModal.find(".form-tabs .form-tab-2").addClass(acc);
allInOneFormModal.find(".form-steps .form-step-2").addClass(acc);
setTimeout(function(){
if(tc&&!Array.isArray(tc)){
tc=[tc];
}
console.log(tp);
if(Array.isArray(tc)&&tc.length){
$.each(tc, function (i,v){
allInOneFormModal.find("input[name='country[]'][value='"+v+"']").prop("checked",true).trigger("change").closest(".form-checkbox").addClass(acc);
});
setTimeout(function(){
if(allInOneFormModal.find(".form-tabs .form-tab-2 label.form-checkbox.active").length){
allInOneFormModal.find(".form-tabs .form-tab-2 .btn-form-tab-complete").click();
if(ns){
allInOneFormModal.find("input.form-namesurname").val(ns);
}
if(ph){
allInOneFormModal.find("input.form-phone").val(ph);
}
if(em){
allInOneFormModal.find("input.form-email").val(em);
}
if(ci){
allInOneFormModal.find("select.form-city option[value='"+ci+"']").prop("selected",true).trigger("change");
if(br){
allInOneFormModal.find("select.form-branch option[value='"+br+"']").prop("selected",true).trigger("change");
}}
}},700);
}else{
if(ns){
allInOneFormModal.find("input.form-namesurname").val(ns);
}
if(ph){
allInOneFormModal.find("input.form-phone").val(ph);
}
if(em){
allInOneFormModal.find("input.form-email").val(em);
}
if(ci){
allInOneFormModal.find("select.form-city option[value='"+ci+"']").prop("selected",true).trigger("change");
if(br){
allInOneFormModal.find("select.form-branch option[value='"+br+"']").prop("selected",true).trigger("change");
}}
}},500);
}}else{
eltAlert("PROGRAMLAR ALINAMADI", "danger");
}}).fail(function (){
tad.html("");
eltAlert("PROGRAMLAR ALINAMADI", "danger");
});
});
$(document).on("click", "#allInOneFormModal input[name='program']", function (){
var allInOneFormModal=$("#allInOneFormModal");
var tad=allInOneFormModal.find(".form-tabs .form-tab-2 .form-item-country .form-elements-wrapper"),pr=allInOneFormModal.find(".form-tabs .form-tab-1 .form-item-program input:checked").val(),rec="ready";
if(pr){
$.get(baseApiUrl + "Site/Country/"+pr).done(function (data){
var html="";
if("data" in data){
$.each(data.data, function (i,v){
if("code" in v&&"name" in v){
html+='<label class="form-checkbox"><input type="checkbox" class="form-country" required name="country[]" value="'+v.code+'" data-name="'+v.name+'">'+v.name+'</label>';
}});
}
tad.html(html);
if(html!=""){
allInOneFormModal.find(".form-tabs .form-tab-2").addClass(rec);
allInOneFormModal.find(".form-tabs .form-tab-1 .btn-form-tab-complete").click();
}else{
eltAlert("ÜLKELER ALINAMADI", "danger");
}}).fail(function (){
tad.html("");
eltAlert("ÜLKELER ALINAMADI", "danger");
});
}});
$(document).on("change", "#allInOneFormModal select.form-city", function (){
var allInOneFormModal=$("#allInOneFormModal");
var t=$(this),s=t.find("option:selected"),v=s.val(),b=s.data("branches"),coc="collapse",wr=t.closest(".form-elements-wrapper"),clst=wr.data("city-list"),blst=wr.data("branch-list"),tad=allInOneFormModal.find(".form-tabs .form-item-branch");
tad.find("select").remove();
if(b&&typeof b!="object"){
b=JSON.parse(b);
}
if(blst&&typeof blst!="object"){
blst=JSON.parse(blst);
}
if(typeof b=="object"&&typeof blst=="object"){
if(b.length>1){
var html="",op="";
$.each(b, function (i,v){
var br=blst.filter((x)=> x.code==v);
if(Array.isArray(br)&&"code" in br[0]&&"name" in br[0]){
op+='<option value="'+br[0].code+'">'+br[0].name+'</option>';
}});
if(op!=""){
html='<select class="form-control form-branch" required><option value="" selected disabled>SEÇİNİZ</option>'+op+'</select>';
}
if(html){
tad.append(html);
tad.removeClass(coc);
}else{
tad.addClass(coc);
}}else{
tad.addClass(coc);
}}
});
$(document).on("click", ".btn-form-tab-complete", function (){
let t=$(this),
ta=t.data("target-tab"),
tm=t.closest("#allInOneFormModal"),
ttb=t.closest(".form-tab"),
w=t.closest(".form-tabs"),
tbs=w.find(".form-tab"),
fstps=tm.find(".form-steps"),
coc="complete",
acc="active",
e=0;
ttb.find(".form-item").each(function(){
var fi=$(this),fit=fi.find(".form-item-title").text();
if(fi.find("input[type='radio'][required]").length){
if(fi.find("input[type='radio'][required]:checked").length<=0){
e++;
eltAlert(fit+" ALANI İÇİN SEÇİM YAPINIZ", "danger");
}}
if(!e&&fi.find("input[type='checkbox'][required]").length){
var fitt="";
if(fi.find("input[type='checkbox'][required]").hasClass("form-confirm")){
fitt="ONAY KUTUSUNU İŞARETLEYİNİZ";
}else{
fitt=fit+" ALANI İÇİN SEÇİM YAPINIZ";
}
if(fi.find("input[type='checkbox'][required]:checked").length<=0){
e++;
eltAlert(fitt, "danger");
}}
if(!e&&fi.find("input[type='text'][required]").length){
fi.find("input[type='text'][required]").each(function(){
var vv=$.trim($(this).val());
if($(this).hasClass("form-phone")&&!isPhone(vv)){
e++;
eltAlert(fit+" ALANI İÇİN GEÇERLİ BİR TELEFON NUMARASI GİRİNİZ", "danger");
}
else if(vv==undefined||vv==null||vv==""){
e++;
eltAlert(fit+" ALANINI DOLDURUNUZ", "danger");
}});
}
if(!e&&fi.find("input[type='email'][required]").length){
fi.find("input[type='email'][required]").each(function(){
var vv=$.trim($(this).val());
if(vv==undefined||vv==null||vv==""||!isEmail(vv)){
e++;
eltAlert(fit+" ALANINI DOLDURUNUZ", "danger");
}});
}
if(!e&&fi.find("select").length){
fi.find("select").each(function(){
var se=$(this);
if(se.find("option:selected").length<=0||se.find("option:selected").val()==""){
e++;
eltAlert(fit+" ALANI İÇİN SEÇİM YAPINIZ", "danger");
}});
}});
if(!e){
fstps.find("div").removeClass(acc).removeClass(coc);
fstps.find(".form-step-"+ta).addClass(acc);
for(var i=1;i<ta;i++){
fstps.find(".form-step-"+i).addClass(coc);
}
ttb.addClass(coc).removeClass(acc);
w.find(".form-tab-"+ta).addClass(acc);
if(t.hasClass("btn-form-complete")){
var values={};
var pnrCode=tm.find("textarea.form-pnr-code").text();
values["Program"]=tm.find("input[name='program']:checked").val(),
values["Ulke"]=tm.find("input[name='country[]']:checked").map(function(){ return {"code":$(this).val(),"name":$(this).data("name")};}).get(),
values["Sehir"]=tm.find("select.form-city option:selected").val(),
values["SubeKodu"]=tm.find("select.form-branch option:selected").val(),
values["AdiSoyadi"]=tm.find("input.form-namesurname").val(),
values["Telefon"]=tm.find("input.form-phone").val().replace(/\D/g, ''),
values["Mail"]=tm.find("input.form-email").val(),
values["Detay"]=tm.find("textarea.form-message").val();
if(!values["Detay"]&&pnrCode){
values["Detay"]="{'pnrCode':'"+pnrCode+"'}";
}
let utmQuery=$.cookie('first') + "|" + window.location.href;
if($.cookie('danisman')!=undefined){
utmQuery="FUAR|" + $.cookie('danisman');
}
values["UtmQuery"]=utmQuery;
values["ConsGuid"]=$.cookie('consGuid');
if(values["SubeKodu"]==undefined||values["SubeKodu"]==null){
values["SubeKodu"]="";
var brlst=tm.find("select.form-city option:selected").data("branches");
if(brlst&&typeof brlst!="object"){
brlst=JSON.parse(brlst);
}
if(Array.isArray(brlst)){
values["SubeKodu"]=brlst[0];
}}
let gV={'event': 'form','email': values.Mail};
console.log("google verisi",gV);
let fbqV={country:'tr'};
const fnln=parseFullName(values.AdiSoyadi);
fbqV["fn"]=fnln.name;
fbqV["ln"]=fnln.lastname;
fbqV["em"]=values.Mail.toLowerCase();
fbqV["external_id"]=values.Mail.toLowerCase();
fbqV["ph"]=values.Telefon.toString().replace(/\D/g, "");
fbqV["ct"]=tm.find("select.form-city option:selected").text().toLowerCase().replace(/\s+/g, "");
console.log("fb pixeli verisi",fbqV);
console.log(values);
var r="",frw=w.find(".form-tab-"+ta).find(".form-result-wrapper");
$.ajax ({
url: baseApiUrl + "Site/Application",
type: "POST",
data: JSON.stringify(values),
dataType: "json",
contentType: "application/json; charset=utf-8"
}).done(function(){
dataLayer.push(gV);
fbq('init', '361003528221864', fbqV);
if(pnrCode){
location.href="/pnr?code="+pnrCode;
}else{
r+='<div class="form-result success-result">';
r+='<div class="form-result-icon"><i class="fa fa-check"></i></div>';
r+='<div class="form-result-title">ÜCRETSİZ BİLGİ İÇİN KAYIT BAŞARILI!</div>';
r+='<div class="form-result-description">Size en kısa sürede ulaşıp tüm sorularınızda yardımcı olmaktan mutluluk duyacağız.</div>';
r+='</div>';
frw.html(r);
if($("body").hasClass("form-active")){
location.href="/";
}else{
setTimeout(function(){
tm.modal("hide");
},1000*3);
}}
}).fail(function(){
r+='<div class="form-result fail-result">';
r+='<div class="form-result-icon"><i class="fa fa-exclamation"></i></div>';
r+='<div class="form-result-title">HATA OLUŞTU</div>';
r+='<div class="form-result-description">Başvurunuz kaydedilemedi. Lütfen tekrar deneyiniz.</div>';
r+='</div>';
frw.html(r);
});
}}
});
$(document).on("click", ".form-steps > .complete", function (){
let t=$(this),ta=t.data("tab"),tm=t.closest("#allInOneFormModal"),coc="complete",acc="active";
t.addClass(acc);
tm.find(".form-tabs > div").removeClass(acc);
tm.find(".form-tabs > .form-tab-"+ta).addClass(acc);
t.closest(".form-steps").children("div").each(function(){
var tt=$(this),tta=tt.data("tab");
if(tta>ta){
tt.removeClass(coc).removeClass(acc);
}});
});
$(document).on("click", ".form-radio > input", function (){
var t=$(this),fi=t.closest(".form-item"),fr=fi.find(".form-radio"),tfr=t.closest(".form-radio"),acc="active";
fr.removeClass(acc);
tfr.addClass(acc);
});
$(document).on("click", ".form-checkbox > input", function (){
var t=$(this),tfr=t.closest(".form-checkbox"),acc="active";
tfr.toggleClass(acc);
});
var queryString=window.location.search, urlParams=new URLSearchParams(queryString), formParam=urlParams.get('form');
if(formParam=="active"&&$(".fix-text-circle.btn-all-in-one-form").length){
const params=new URLSearchParams(window.location.search);
if(params.get("sig")){
if(params.get("sig")==$("body").data("sig")){
$(".fix-text-circle.btn-all-in-one-form").click();
}}else{
$(".fix-text-circle.btn-all-in-one-form").click();
}}
$(document).on("click", ".btn-header.allinoneform-trigger", function (){
$("button.btn-all-in-one-form").click();
});
var ix=0,icons=["fa fa-file-text","fa fa-envelope"];
setInterval(function(){
$(".btn-header.allinoneform-trigger i").attr("class",icons[ix]);
ix++;
if(ix>icons.length){
ix=0;
}},1000);
}else{
$(".btn-header.allinoneform-trigger").remove();
}
$(document).on("click", "#content_index > p", function (){
$(this).closest("#content_index").toggleClass("active");
});
$(document).on("click", ".btn-content-toggle", function (){
let t=$(this), ta=$(t.data("target")),ac="active",acT="Devamını Gizle",pcT="Devamını Gör";
ta.slideToggle("slow").toggleClass(ac);
if(ta.hasClass(ac)){
t.text(acT).removeClass("btn-outline-red").addClass("btn-red");
}else{
t.text(pcT).addClass("btn-outline-red").removeClass("btn-red");
}});
$(document).on("click", "button#blogCatsMenuOpener", function (){
var t=$(this),ta=$(t.data("target")),tc=t.data("toggle-class");
ta.toggleClass(tc);
if(ta.hasClass(tc)){
t.find("i").attr("class","fa fa-times");
}else{
t.find("i").attr("class","fa fa-bars");
}});
$(document).on("click", "#header .search-toggler", function (){
setTimeout(function (){ $('#search input').focus() }, 500);
});
$(document).on("click", "#content_index a", function (){
var t=$(this),ta=$(t.attr("href"));
$('html, body').animate({
scrollTop: ta.offset().top - 150
}, 1000);
return false;
});
$(document).on("click", ".yukaributon", function (){
$('html, body').animate({ scrollTop: 0 }, 800);
return false;
});
$(document).on("click","#header .search-toggler",function(){
setTimeout(function(){ $('#search input').focus() }, 500);
});
$(document).on("click","#header .nav-open",function(){
var x="";
header.find(".bottom .menu.nav").each(function(){
x+=$(this).html();
});
x="<ul>"+x+"</ul>";
if($("#mobileMenu").length<=0){
body.append("<div id='mobileMenu'><span class='btn-mobileMenu-close'><i class='fa fa-times'></i></span><span class='mobileMenu-close'></span><div class='mobileMenu-content'></div></div>");
}
$("#mobileMenu .mobileMenu-content").html(x);
$("#mobileMenu .mobileMenu-content > ul > li > a").addClass("nav-link");
var co="<li class='nav-item'><a href='#' class='nav-link'>KURUMSAL</a><ul>";
$("#header .header-menu .dropdown-menu > a").each(function(){
co+="<li><a href='"+$(this).attr("href")+"'>"+$(this).text()+"</a></li>";
});
co+="</ul></li>";
$("#mobileMenu .mobileMenu-content > ul").append(co);
$("#mobileMenu .mobileMenu-content > ul").append("<li class='nav-item'><a href='/iletisim' class='nav-link'>İLETİŞİM</a></li>");
$("#mobileMenu .mobileMenu-content li").each(function(){
if($(this).children("ul").length){
$(this).addClass("has-child");
}});
$("#mobileMenu .mobileMenu-content > ul > li.has-child").each(function(){
var t=$(this),h=t.children("a").attr("href");
if(h!="#"){
t.children("ul").prepend("<li><a href='"+h+"' class='capitalize'>"+t.children("a").text().toLocaleLowerCase()+" Detaylı Bilgi</a></li>");
}});
});
$(document).on("click","#mobileMenu .mobileMenu-close, #mobileMenu .btn-mobileMenu-close",function(){
$("#mobileMenu").remove();
});
$(document).on("click","#mobileMenu .mobileMenu-content li.has-child > a",function(){
if($("#mobileMenu .mobileMenu-subcontent").length<=0){
$("#mobileMenu").append("<div class='mobileMenu-subcontent'></div>");
}
var subMenu='<ul>'+$(this).closest("li").children("ul").html()+'</ul>';
var subTop='<div class="top"><i class="fa fa-chevron-left"></i> <span>'+$(this).text()+'</span></div>';
var subBottom='<div class="bottom">'+subMenu+'</div>';
$("#mobileMenu .mobileMenu-subcontent").html(subTop+subBottom).addClass("active");
return false;
});
$(document).on("click","#mobileMenu .mobileMenu-subcontent .top i",function(){
$("#mobileMenu .mobileMenu-subcontent").removeClass("active");
$("#mobileMenu .mobileMenu-subcontent").html("");
});
$(document).on("click","#footer .branchs .items .item",function(){
var t=$(this),tw=t.closest(".items"),twc=t.closest(".branchs").find(".content"),its=tw.find(".item"),td=t.data("data"),cl="active";
its.removeClass(cl);
t.addClass(cl);
twc.find("img").attr("src",td.img);
twc.find(".title").attr("href",td.url);
twc.find(".title strong").text(td.titleBefore);
twc.find(".title span").text(td.title);
twc.find(".address").text(td.address);
twc.find(".email").text(td.email).attr("href","mailto:"+td.email);
twc.find(".phone").text(td.phone).attr("href",td.phoneUrl);
twc.find(".map").attr("href",td.mapUrl);
googlemapinit();
});
$(document).on("click",".module-05 .item",function(){
var t=$(this),tw=t.closest(".items"),twc=t.closest(".module-05").find(".item-content"),its=tw.find(".item"),cl="active";
its.removeClass(cl);
t.addClass(cl);
twc.find(".slogan").html(t.data("slogan"));
twc.find(".description").html(t.data("description"));
twc.find(".item-button a").attr("href",t.data("button-url")).text(t.data("button-text"));
$('html, body').animate({
scrollTop: twc.offset().top - 200
}, 1000);
});
$(document).on("click", "#banner .sub-menu a", function (){
let t=$(this), id=t.data("to");
$('html, body').animate({
scrollTop: $(id).offset().top - 200
}, 1000);
return false;
});
$(document).on("click","#header > .bottom ul.menu > li > ul > li > a",function(){
if($("body").width()>991){
var ul=$(this).closest("ul.sub-menu"),acc="active";
ul.children("li").removeClass(acc);
$(this).closest("li").addClass(acc);
return false;
}});
$(window).on('load', function (){
$(".banner-ext .btn-all-in-one-form").addClass("active");
if($("#header > .bottom .logo img.logo-year").length){
setTimeout(function(){
$("#header > .bottom .logo img").addClass("transform-active");
$("#header > .bottom .logo img.logo-real").addClass("showing");
setInterval(function(){
$("#header > .bottom .logo img").toggleClass("showing");
},5000);
},1500);
}
$.post("/wp-content/themes/hosteva/eva/post/v151t.php", {
},"json");
$(".fix-circle").addClass("active");
googlemapinit();
responsive();
if($(".gallery").length){
$(".gallery").each(function (){
var g=$(this), inl="inline-gallery-container", inl2="inline-gallery-container-for-offer-languageschool", ul=g.children("ul");
if(g.hasClass(inl)){
var lgContainer=document.getElementById(g.attr("id"));
var inlineGallery=lightGallery(lgContainer, {
container: lgContainer,
dynamic: !0,
thumbnail: !0,
hash: !1,
closable: !1,
download: !1,
showMaximizeIcon: !1,
appendSubHtmlTo: '.lg-item',
slideDelay: 100,
plugins: [lgThumbnail,lgVideo],
dynamicEl: g.data("dynamic")
});
inlineGallery.openGallery();
setTimeout(function (){
$(lgContainer).find(".lg-item img").each(function (){
var t=$(this);
t.attr("width", 90);
t.attr("height", 90);
});
$(lgContainer).find(".lg-thumb-item img").each(function (){
var t=$(this), id=t.data("lg-item-id"), alt=$(lgContainer).find(".lg-inner .lg-item").eq(id).find("img").attr("alt");
if(alt==undefined){
alt=$("h1.title").text();
}
t.attr("alt", alt);
t.attr("width", 90);
t.attr("height", 90);
});
}, 200);
}
else if(g.hasClass(inl2)){
var lgContainer=document.getElementById(g.attr("id"));
var inlineGallery=lightGallery(lgContainer, {
container: lgContainer,
dynamic: !0,
thumbnail: !1,
hash: !1,
closable: !1,
download: !1,
showMaximizeIcon: !1,
appendSubHtmlTo: '.lg-item',
slideDelay: 100,
dynamicEl: g.data("dynamic"),
getCaptionFromTitleOrAlt: !1,
counter: !1,
plugins: [lgVideo, lgThumbnail],
autoplayFirstVideo: !0,
animateThumb: false,
youTubePlayerParams: {
modestbranding: 1,
playsinline: 1,
showinfo: 0,
loop: 1,
rel: 0,
listType: 'playlist',
controls: 0
}});
inlineGallery.openGallery();
/*setTimeout(function (){
$("iframe.lg-video-object").each(function (){
var $iframe=$(this),x='<style>.ytp-pause-overlay{display:none !important;}</style>';
$iframe.appendTo("body").ready(function(){
setTimeout(function(){
$iframe.contents().find('body').append(x);
},50);
});
});
},500);*/
setTimeout(function (){
$(lgContainer).find(".lg-item img").each(function (){
var t=$(this);
t.attr("width", 90);
t.attr("height", 90);
});
$(lgContainer).find(".lg-thumb-item img").each(function (){
var t=$(this), id=t.data("lg-item-id"), alt=$(lgContainer).find(".lg-inner .lg-item").eq(id).find("img").attr("alt");
if(alt==undefined){
alt=$("h1.title").text();
}
t.attr("alt", alt);
t.attr("width", 90);
t.attr("height", 90);
});
}, 200);
}else{
var idd=document.getElementById(ul.attr("id"));
if(!idd){
idd="gallery_"+((S4() + S4() + "-" + S4() + "-4" + S4().substr(0, 3) + "-" + S4() + "-" + S4() + S4() + S4()).toLowerCase());
ul.attr("id",idd);
idd=document.getElementById(idd);
}
lightGallery(idd, {
thumbnail: !0,
plugins: [lgThumbnail,lgVideo],
});
setTimeout(function (){
$(idd).find(".lg-item img").each(function (){
var t=$(this);
t.attr("width", 90);
t.attr("height", 90);
});
$(idd).find(".lg-thumb-item img").each(function (){
var t=$(this), id=t.data("lg-item-id"), alt=$(idd).find(".lg-inner .lg-item").eq(id).find("img").attr("alt");
if(alt==undefined){
alt=$("h1.title").text();
}
t.attr("alt", alt);
t.attr("width", 90);
t.attr("height", 90);
});
}, 200);
}});
}
if($(".video-gallery").length){
$(".video-gallery").lightGallery({
selector: '.box-video a',
loadYoutubeThumbnail: !0,
youtubeThumbSize: 'default',
loadVimeoThumbnail: !0,
vimeoThumbSize: 'thumbnail_medium',
});
}
$(document).on("click","#auto_popup_closer",function(){
let ap=$("#auto_popup"),cookieName="eltautopopup";
ap.remove();
setCookie(cookieName, 10);
});
});
$(document).ready(function (){
scroll();
});
$(window).on('resize', function (){
responsive();
});
$(window).scroll(function (){
scroll();
});
function scroll(){
let wi=$(window), w=wi.width(), a=wi.scrollTop();
if(a > 100){
$('.yukaributon').fadeIn();
}else{
$('.yukaributon').fadeOut();
}
if(w<768){
$(".fix-circle").removeClass("show");
}
if($(".university-detail-page").length){
let p=$(".university-detail-page");
p.find(".aside .menu > ul > li").eq(0).addClass("active");
p.find(".article > div .title").each(function (){
let s=$(this), sso=s.offset(), sst=sso.top - 200;
if(a >=sst){
p.find(".aside .menu li").removeClass("active");
p.find(".aside .menu button[data-to='#" + s.attr("id") + "']").parent("li").addClass("active");
}});
}
var allInOneFormModal=$("#allInOneFormModal");
if(allInOneFormModal.length){
if($("#allInOneFormComeHere").length){
var comeHere=$("#allInOneFormComeHere"), ct=comeHere.offset().top - (comeHere.offset().top / 4);
if(a >=ct){
if(comeHere.find("#freeInformationForm").length<=0){
var allInOneFormModal=$("#allInOneFormModal");
var html=allInOneFormModal.find(".modal-body").html();
$("#allInOneFormModal .modal-body").html("");
$("#allInOneFormModal").attr("id","allInOneFormModalBackup");
$('#allInOneFormComeHere').html("<div id='allInOneFormModal'>"+html+"</div>");
$(".banner-ext .btn-all-in-one-form").attr("style","display:none !important").addClass("d_none");
$(".fix-circle").attr("style","display:none !important");
if($(".banner-ext").length){
var be=$(".banner-ext");
if(be.find(".btn-all-in-one-form").length&&be.find(".btn-ucretsiz-teklif-al").length){
be.removeClass("fixed2");
}}
allInOneFormModal=$("#allInOneFormComeHere #allInOneFormModal");
setTimeout(function(){
$(".fix-circle .btn-all-in-one-form").click();
},1000);
}}else{
if(comeHere.find("#freeInformationForm").length){
$('#allInOneFormModalBackup .modal-body').html(allInOneFormModal.html());
$("#allInOneFormModalBackup").attr("id","allInOneFormModal");
comeHere.html("");
$(".banner-ext .btn-all-in-one-form").attr("style","").removeClass("d_none");
$(".fix-circle").attr("style","");
if($(".banner-ext").length){
var be=$(".banner-ext");
if(be.find(".btn-all-in-one-form").length&&be.find(".btn-ucretsiz-teklif-al").length){
be.addClass("fixed2");
}}
}}
}}
clearTimeout($.data(this, 'scrollTimer'));
$.data(this, 'scrollTimer', setTimeout(function(){
var  wi=$(window),w=wi.width();
if(w<768){
$(".fix-circle").addClass("show");
}}, 2500));
if($(".banner-ext").length){
var be=$(".banner-ext"),ax=be.offset(),cl1="fixed",cl2="";
if(be.find(".btn-all-in-one-form").length&&be.find(".btn-ucretsiz-teklif-al").length){
if(!be.find(".btn-all-in-one-form").hasClass("d_none")){
cl2="fixed2";
}}
if(a>ax.top){
be.addClass(cl1).addClass(cl2);
}else{
be.removeClass(cl1).removeClass(cl2);
}}
if($("#auto_popup").length&&a > 100){
let ap=$("#auto_popup"),cl="active", kacDefaGorunsun=1, cookieName="eltautopopup", c=getCookie(cookieName);
if(!jQuery.isNumeric(c)){
c=0;
}
if(!ap.hasClass(cl)){
if(jQuery.isNumeric(c)&&c < kacDefaGorunsun){
setTimeout(function (){
ap.addClass(cl);
ap.attr("style","");
c++;
setCookie(cookieName, c);
}, 2000);
}else{
ap.remove();
}}
}}
function setCookie(cname, cvalue, exdays=1){
var d=new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires="expires=" + d.toUTCString();
document.cookie=cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname){
var name=cname + "=";
var decodedCookie=decodeURIComponent(document.cookie);
var ca=decodedCookie.split(';');
for (var i=0; i < ca.length; i++){
var c=ca[i];
while (c.charAt(0)==' '){
c=c.substring(1);
}
if(c.indexOf(name)==0){
return c.substring(name.length, c.length);
}}
return "";
}
function responsive(){
googlemapinit();
if($("#banner").length){
let b=$("#banner");
if(b.find(".sub-menu").length){
let bSm=b.find(".sub-menu"), bW=bSm.width(), bNw=0;
bSm.find("li.nav-item").removeClass("collapse");
bSm.find("li.nav-item").each(function (){
let t=$(this), tW=t.width() + 30;
if(bNw + tW > bW&&!t.hasClass("more")){
$(this).addClass("collapse");
}else{
bNw +=tW;
}});
let bSmNiCo=bSm.find("li.nav-item.collapse"), bSmNiMo=bSm.find("li.nav-item.more");
if(bSmNiCo.length <=0){
bSmNiMo.addClass("collapse");
}else{
bSmNiMo.removeClass("collapse");
bSmNiMo.find(".dropdown-menu .nav-link").addClass("collapse");
let x=0, y=0;
bSm.find("li.nav-item").each(function (){
x++;
if($(this).hasClass("collapse")&&!y){
y=x - 1;
}});
if(y){
for (let jj=y; jj < bSmNiMo.find(".dropdown-menu .nav-link").length; jj++){
bSmNiMo.find(".dropdown-menu .nav-link").eq(jj).removeClass("collapse");
}}else{
bSmNiMo.addClass("collapse");
}}
}}
$("#header > .bottom ul.menu > li > ul > li").removeClass("active");
$("#header > .bottom ul.menu > li > ul > li:first-child").addClass("active");
}
function eltAlert(m, t){
let i='fa fa-check', ty='green', ti=m, c=m;
if(t=="danger"){
i='fa fa-exclamation-circle';
ty='red';
ti='Dikkat';
}else{
c='';
}
$.dialog({
icon: i,
title: ti,
content: c,
type: ty,
typeAnimated: true,
closeIcon: true,
buttons: {}});
}
function isPhone(tel){
let isTel=false, rgpxp=new RegExp(/^(0(\d{3})(\d{3})(\d{2})(\d{2}))$/);
if(tel.substring(0, 1)=="5"){
tel="0" + tel;
}
if(tel.search(rgpxp)!=-1){
isTel=true;
}
return isTel;
}
function isEmail(mail){
let isMails=false, rgpxp=new RegExp(/^[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9_\-\.]+\.[a-zA-Z]{2,}$/);
if(mail.search(rgpxp)!=-1){
isMails=true;
}
return isMails;
}
function S4(){
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}
function parseFullName(input){
const clean=input
.toLowerCase()
.trim()
.replace(/\s+/g, " ");
const parts=clean.split(" ");
if(parts.length===1){
return {
name: parts[0],
lastname: ""
};}
const lastname=parts.pop();
const name=parts.join(" ");
return {
name,
lastname
};}
function googlemapinit(){
/*
var id="map",d=$("#" + id),dx=$("#footer .branchs .items .item.active");
if(d.length&&dx.length){
d.html("");
var coordinat="",
dd=dx.data("data"),
z=12,
m="/wp-content/uploads/icon-map-marker.png",
t="",
w=$(window).width(),
center=null;
if(typeof dd=="string"){
dd=JSON.parse(dd);
}
if(typeof dd=="object"&&"coordinat" in dd){
coordinat=dd.coordinat;
}
var p=coordinat.replace(" ", "").split(","), center1=p[1]*1, center=p[0]*1;
if(w > 990){
}
else if(w <=320){
center=center - 0.010;
center1=center1 - 0.001;
}
else if(w <=375){
center=center - 0.0105;
center1=center1 + 0.001;
}
else if(w <=414){
center=center - 0.012;
center1=center1 + 0.002;
}
else if(w <=533){
center=center - 0.013;
center1=center1 + 0.003;
}else{
center=center - 0.013;
}
map=new OpenLayers.Map(id);
map.addLayer(new OpenLayers.Layer.OSM());
var centerLonLat=new OpenLayers.LonLat(center1*1,center*1) .transform(new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
);
var lonLat=new OpenLayers.LonLat(p[1],p[0])
.transform(new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
);
var zoom=15;
var markers=new OpenLayers.Layer.Markers("Markers");
map.addLayer(markers);
var iconPath="https://www.elt.com.tr/wp-content/themes/hosteva/assets/plugin/openstreetmap/2.13.1/img/marker.png";
var size=new OpenLayers.Size(21, 25);
var offset=new OpenLayers.Pixel(-(size.w / 2), -size.h);
var icon=new OpenLayers.Icon(iconPath, size, offset);
markers.addMarker(new OpenLayers.Marker(lonLat, icon.clone()));
map.setCenter (centerLonLat, zoom);
setTimeout(function(){
d.find("img.olAlphaImg").attr("alt","ELT");
},1000);
}
*/
}
/*
function getInformationFormInit(){
if($(".getInformationForm").length){
let f=$(".getInformationForm"), cClass="collapse", pc=f.find(".program-changer");
if(f.find(".formCountries").length){
pc.change(function (){
let t=$(this), fc=t.parents(".getInformationForm").find(".formCountries"), fce=fc.find(".elements"), c=t.find(":selected").val();
fce.html("");
fc.addClass(cClass);
let formCountriesHtml="", j=superJson;
$.each(j.p, function (k, v){
if(v.p==c){
formCountriesHtml +='<div class="custom-control custom-checkbox form-check-inline exit-inline ' + v.p + '"><input type="checkbox" class="custom-control-input" id="' + v.p + v.i + '" value="' + j.u[v.d] + '" name="Ulke[]"><label class="custom-control-label" for="' + v.p + v.i + '">' + j.u[v.d] + '</label></div>';
}});
fce.html(formCountriesHtml);
let ch=fce.find(".custom-control");
ch.find("input").prop('checked', false);
fc.removeClass(cClass);
});
}}
}
$(document).on("submit", ".getInformationForm", function (event){
let tf=$(this), error=0, data=tf.serializeArray(), a=[];
tf.find('input').each(function (){
let t=$(this), v=t.val(), ty=t.attr("type"), n=t.attr("name");
if(t.prop('required')){
if(t.hasClass("phone")){
v=v.replace(/\D/g, '');
}
if(ty=="email"&&!isEmail(v)){
error++;
eltAlert(t.data("required-text-email"), "danger");
}
else if(ty=="checkbox"&&!t.is(':checked')){
error++;
eltAlert(t.data("required-text-checkBox"), "danger");
}
else if(t.hasClass("phone")&&!isPhone(v)){
error++;
eltAlert(t.data("required-text-phone"), "danger");
}
else if(!v){
error++;
eltAlert(t.data("required-text"), "danger");
}}
if(n&&n.length&&n.lastIndexOf("[]") > 0){
n=n.replace("[]", "");
if(jQuery.inArray(n, a) < 0){
a.push(n);
}}
});
if(a.length){
$.each(a, function (ke, va){
data=$.grep(data, function (e){ return e.name!=va + "[]"; });
data[1].value=data[1].value.replace(/\D/g, '');
let st="";
tf.find("*[name='" + va + "[]']").each(function (){
if($(this).prop('checked')){
st +=$(this).val() + "|";
}});
if(st.length){
data.push({ name: va, value: st });
}});
}
if(!error){
let utmQuery=$.cookie('first') + "|" + window.location.href;
if($.cookie('danisman')!=undefined){
utmQuery="FUAR|" + $.cookie('danisman');
}
data.push({ name: 'UtmQuery', value: utmQuery },
{ name: 'ConsGuid', value: $.cookie('consGuid') }
);
if(!data.some(item=> item.name==='SubeKodu')){
data.push({ name: 'SubeKodu', value: '' });
}
$.post(baseApiUrl + "BasvuruHavuzu/Post", data).done(function (data){
eltAlert("Başvurunuz başarıyla alınmıştır!", "success");
$('#bilgiIstek').hide();
$('.modal-backdrop').hide();
}).fail(function (){
eltAlert("Lütfen tüm alanları geçerli bilgiler ile doldurunuz.", "danger");
});
}
return false;
});
*/;