<script>
$( document ).ready(function() {
let lvlText = '';
let lvlIndex = 0;
$('.t-radio__control').each(function(){
let label = $(this);
let text = label.find('input').val();
let html = label.html();
if( text.indexOf('=1') >= 0 ) {
let nText = html.replace(text, text.split('=')[0]);
nText = nText.replace(text, text.split('=')[0]);
label.html(nText);
label.find('input').attr('data-cor','1');
};
});
$('.uc-start-test').on('click', '.t-submit',function(){
let form = $(this).closest('.t-form__inputsbox');
setTimeout(function(){
if ( $('.uc-start-test .t-form').hasClass("js-send-form-success")){
let level = form.find('select');
lvlText = level.val();
lvlIndex = level[0].selectedIndex;
$('.uc-titleblock').hide();
$('.uc-start-test').hide();
$('div[class*="uc-question-"] .t-form__screen .t-submit').attr('type', 'button');
if(lvlIndex==0) $('.uc-question-starter').addClass('show-block');
if(lvlIndex==1) $('.uc-question-element').addClass('show-block');
if(lvlIndex==2) $('.uc-question-preint').addClass('show-block');
if(lvlIndex==3) $('.uc-question-inter').addClass('show-block');
if(lvlIndex==4) $('.uc-question-upperint').addClass('show-block');
if(lvlIndex==5) $('.uc-question-advanced').addClass('show-block');
};
}, 1000);
});
$('div[class*="uc-question-"]').on('click', '.t-submit',function(){
let mBox = $(this).closest('.t-form__inputsbox');
mBox.find('.t-form__screen-current-view').hide();
let activeScreen = mBox.find('.t-form__screen-wrapper_active');
let questMax = +mBox.find('.t-form__screen-number-container span:last').text();
let correctQuestion = mBox.find('input[type="radio"][data-cor="1"]:checked').length;
let percent = (correctQuestion*100)/questMax;
activeScreen.find('.t-input-block').hide();
activeScreen.find('.t-input-title').text(lvlText+' level');
let recommend = `You did great! Your English level is truly ${lvlText}! Now you can join our group with your language proficiency level`;
$(this).hide();
let nLvl = '';
if(percent<=60) {
recommend = "Don't worry, give it a try at a lower level – you've got this! Start with a victory and keep moving forward!";
nLvl = $('.uc-start-test select option:eq('+(lvlIndex-1)+')').val()+' level';
if(lvlIndex==0) nLvl = $('.uc-start-test select option:eq('+(lvlIndex)+')').val()+' level';
$(this).text(nLvl).show();
};
if(percent>=80) {
recommend = "This level might be too easy for you, please try the next level";
nLvl = $('.uc-start-test select option:eq('+(lvlIndex+1)+')').val()+' level';
$(this).text(nLvl).show();
if(lvlIndex==5 && percent==100 ) $(this).hide();
};
$('.result-wrapper').remove();
let newElem = `<div class="result-wrapper t-text">
<div class="result-title">You made it to the end ;)</div>
<div class="result-score">
<div class="result-score-correct">${correctQuestion}</div>
<div class="result-score-errors">${questMax-correctQuestion}</div>
</div>
<div class="result-text">${recommend}</div>
</div>
`;
activeScreen.find('.t-input-title').after(newElem);
$(this).addClass('fin-btn');
});
$('div[class*="uc-question-"]').on('click', '.t-form__screen-btn-next',function(){
// let mBox = $(this).closest('.t-form__inputsbox');
// setTimeout(function () {
// let step = +mBox.find('.t-form__screen-number-container span:first').text();
// let questMax = +mBox.find('.t-form__screen-number-container span:last').text();
// if( (questMax-step)==1 ){
// };
// console.log(step);
// console.log(questMax);
// }, 200);
});
});
</script>
<script>
$('div[class*="uc-question-"]').on('click', '.fin-btn',function(){
location.reload()
});
</script>
<style>
.uc-image-bg {
position: absolute;
width: 100%;
}
.uc-start-test .t-input-error,
.uc-start-test .t-form__errorbox-middle,
div[class*="uc-question-"] .t-input-error,
div[class*="uc-question-"] .t-form__errorbox-middle
{
display: none !important;
}
.uc-start-test {
margin-top: -110px;
position: relative;
z-index: 10;
}
.uc-start-test .t678 .t-col>div {
background-color: #fff;
padding: 35px;
border-radius: 30px;
}
div[class*="uc-question-"]{
display: none;
}
.uc-start-test .js-successbox.t-form__successbox {
display: none !important;
}
div[class*="uc-question-"].show-block{
display: block;
}
div[class*="uc-question-"] .t-col {
background-color: #fff;
position: relative;
z-index: 20;
padding: 40px;
border-radius: 30px;
box-sizing: border-box;
box-shadow: 0 0 0 1px #F6A62D;
}
div[class*="uc-question-"] .t-input-title{
font-weight:600;
}
div[class*="uc-question-"] .t-form__screen-btn-prev {
display:none !important;
}
div[class*="uc-question-"] button.t-form__screen-btn-next {
float: none !important;
width: min-content;
}
div[class*="uc-question-"] .t678 .t-form__submit {
text-align: left;
display: flex;
flex-direction: column;
}
.t-form__screen .t-form__screen-current-view {
position: relative;
transform: none;
width: fit-content;
left: 0;
order: -1;
margin-bottom: 15px;
}
.t-form__screen .t-form__screen-progress {
display: none;
}
.t-form__screen .t-form__screen-number-container span {
opacity: 1;
}
div[class*="uc-question-"] .t-form__screen .t-submit {
width: min-content;
}
.result-title {
font-size: 30px;
color: #0B5DBF;
}
.result-text {
font-size: 18px;
}
.result-score {
margin-bottom: 15px;
margin-top: 15px;
font-size: 18px;
}
.result-score-correct:after {}
.result-score-correct:after {
content: " correct";
}
.result-score-errors:after {
content: " errors";
}
.result-score-correct:before {
content: "";
background-image: url(https://static.tildacdn.com/tild6564-3064-4638-b337-383665316166/check_box_checkbox_i.svg);
display: inline-block;
width: 20px;
height: 20px;
background-size: contain;
margin-right: 10px;
transform: translateY(4px);
}
.result-score-errors:before {
content: "";
background-image: url(https://static.tildacdn.com/tild3436-3632-4161-b764-356339313666/cancel-1_icon-iconsc.svg);
display: inline-block;
width: 20px;
height: 20px;
background-size: contain;
margin-right: 10px;
transform: translateY(4px);
}
.result-score-correct {margin-bottom: 7px;}
</style>