Ngiler SH3LL 360
Home
Information
Create File
Create Folder
:
/
home
/
tbf
/
quiz_audit_management
/
resources
/
js
/
components
/
Information Server
MySQL :
OFF
Perl :
OFF
CURL :
ON
WGET :
OFF
PKEXEC :
OFF
Directive
Local Value
IP Address
89.40.16.97
System
Linux server.atelieruldeit.ro 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
User
tbf
PHP Version
7.3.33
Software
Apache
Doc root
Writable
close
Edit File :
VideoBonus.vue
| Size :
10.82
KB
Copy
<template> <div class="content-step"> <div class="question"> <h1 class="title"> <span class="overlay">{{ step_no < 10 ? '0' + step_no : step_no }}</span> <span class="question" v-html="title"></span> </h1> <div class="small-line"></div> <div class="description"> <div v-html=question.description></div> <img :src="'images/' + question.image" v-if="question.image"> <div class="video-description" v-if="question.video"> <div v-if="question.type_video == 'wistia'" :id="'wistia_'+question.video" class="wistia_embed"> </div> <div class="videoWrapper" v-else-if="question.type_video == 'vimeo'"> <vimeo-player ref="player" :video-id="question.video" :options="options_vimeo" @timeupdate="updateProgress" @ended="endedVimeo"/> </div> </div> </div> </div> <div class="subtitle" id="subtitle_description" v-html="html_subtitle"> </div><!-- .subtitle --> <div class="answer" v-bind:class="[(answer_has_video_or_img) ? 'video_or_img' : '']"> <div class="position-relative" v-for="(answer, key) in question.answers" :key="key" v-bind:id="[answer.value == 'continua' ? 'view_only_on_finish' : '']"> <div class="answer-button" @click="setActive(key,answer)" v-bind:class="[active_answer == (questionKey + '-' + key) ? 'active' : '', question.answers.length == 1 ? 'form-button' : '', (answer.value == 'continua' && video_finish == false ) ? 'disabled' : '']"> <img class="img-answer" v-if="answer.image != null && answer.image != ''" :src="'images/' + answer.image"> <button class="answer-title" v-if="question.answers.length > 1 && answer.value == 'continua'">{{answer.title}} <check></check></button> <button class="answer-title" v-else-if="question.answers.length > 1">{{answer.title}} <check></check></button> <button class="answer-form" v-else>{{answer.title}} <arrow-right></arrow-right></button> </div> <div class="progress_video_btn" v-if="answer.value == 'continua'" @click="showErrorVideo"></div> </div> <div class="message_video"> Butonul va fi disponibil dupa finalizarea videoclipului! </div> <div class="back_button" @click="back_to_previous" v-if="showPreviousBtn"> <button><arrow-left></arrow-left> Intrebarea precedenta</button> </div> </div> </div> </template> <script> import Check from "./icons/Check"; import NextIcon from "./icons/Next"; import Lock from "./icons/Lock"; import ArrowRight from "./icons/arrow-right"; import ArrowLeft from "./icons/ArrowLeft"; export default { data() { return { active_answer: 'nothing', answer_selected: '', title_question: '', answer_has_video_or_img: false, video_finish: false, showPreviousBtn: true, html_subtitle: '', options_vimeo: { autoplay: true, controls: false, title: false, portrait: false } } }, components: { 'check': Check, 'next-icon': NextIcon, 'arrow-right': ArrowRight, 'lock': Lock, 'arrow-left': ArrowLeft }, computed:{ title: function(){ let quiz_obj = JSON.parse(localStorage.getItem('quiz')) var new_title = ''; var html_subtitle = ''; var regex_get_value = /(?:\#)([^#]+)(?=#|$)/; var title_escaped = ''; var new_title_v1 = ''; var scope = this; this.question.title.every((element) => { if(element.condition == 'true'){ if(regex_get_value.exec(element.title)){ title_escaped = eval(regex_get_value.exec(element.title)[1]); } new_title_v1 = element.title.replace(/\#([^#]+)\#/g , title_escaped); new_title = new_title_v1.replace('{','<mark>').replace('}','</mark>'); new_title = new_title.replace('&name', this.name_referral); this.title_question = new_title; this.html_subtitle = element.subtitle html_subtitle = $.parseHTML(html_subtitle); return false; } if(eval(element.condition)){ if(regex_get_value.exec(element.title)){ title_escaped = eval(regex_get_value.exec(element.title)[1]); } new_title_v1 = element.title.replace(/\#([^#]+)\#/g , title_escaped); new_title = new_title_v1.replace('{','<mark>').replace('}','</mark>'); new_title = new_title.replace('&name', this.name_referral); this.title_question = new_title; this.html_subtitle = element.subtitle html_subtitle = $.parseHTML(html_subtitle); return false; } return true; }) function has_key(string){ try{ return eval(string) }catch{ return null } } return new_title; } }, mounted() { if(localStorage.getItem('previous_step') == this.questionKey){ this.showPreviousBtn = false; }else{ this.showPreviousBtn = true; } setTimeout(() => { if(this.question.type_video == 'wistia'){ var wistiaEmbed = Wistia.embed(this.question.video, { autoPlay: true, controlsVisibleOnLoad: false, videoFoam: { maxWidth: 960 }, copyLinkAndThumbnailEnabled: false, playerColor: "404040", seo: true, fullscreenButton: false, playbar: false, playButton: false, smallPlayButton: false }); wistiaEmbed.bind("secondchange", (t) => { var percentage = (t * 100) / wistiaEmbed.duration(); $('.progress_video_btn').css('width', percentage + '%'); }); wistiaEmbed.bind("end", (t) => { $('.progress_video_btn').css('width', '100%'); $('#view_only_on_finish .answer-button').removeClass('disabled'); $('.progress_video_btn').remove(); $('.message_video').hide(); this.video_finish = true; }); } }, 0); }, watch: { question: function (val) { if(localStorage.getItem('previous_step') == this.questionKey){ this.showPreviousBtn = false; }else{ this.showPreviousBtn = true; } this.answer_selected = ''; this.active_answer = ''; $('.answer').removeClass('video_or_img'); setTimeout(() => { var wistiaEmbed = Wistia.embed(this.question.video, { autoPlay: true, controlsVisibleOnLoad: false, videoFoam: { maxWidth: 960 }, copyLinkAndThumbnailEnabled: false, playerColor: "404040", seo: true, fullscreenButton: false, playbar: false, playButton: false, smallPlayButton: false }); wistiaEmbed.bind("secondchange", (t) => { var percentage = (t * 100) / wistiaEmbed.duration(); $('.progress_video_btn').css('width', percentage + '%'); }); wistiaEmbed.bind("end", (t) => { $('.progress_video_btn').css('width', '100%'); $('#view_only_on_finish .answer-button').removeClass('disabled'); $('.progress_video_btn').remove(); $('.message_video').hide(); this.video_finish = true; }); }, 0); } }, props: { question: Object, setNextQuestion: Function, previousSet: Function, questionKey: String, step_no: '', name_referral: String }, methods: { updateProgress(e,data) { $('.progress_video_btn').css('width', (e.percent * 100) + '%'); }, endedVimeo(){ $('.progress_video_btn').css('width', '100%'); $('#view_only_on_finish .answer-button').removeClass('disabled'); $('.progress_video_btn').remove(); $('.message_video').hide(); this.video_finish = true; }, setActive(key, answer){ if(!$('#view_only_on_finish .answer-button').hasClass('disabled') || answer.value != 'continua'){ $('.next_step button span').hide(); this.active_answer = (this.questionKey + '-' + key); this.answer_selected = answer; $('.next_step button').addClass('active'); setTimeout(() => { setTimeout(() => { $('.answer-button.active').removeClass('active'); }, 50); this.setNextQuestion(this.questionKey, this.answer_selected, this.title_question, key) }, 500); }else{ $('.message_video').show(); } }, showErrorVideo(){ $('.message_video').show(); }, back_to_previous(){ this.previousSet(); } } } </script>
Back