Online-FAQ

-

Collect your database of questions and have them answered directly by your teacher.

+

Collect your own database of questions and have them answered directly by specified users.

diff --git a/vendor/js/faq.js b/vendor/js/faq.js index 0d63c69..1b4dad5 100644 --- a/vendor/js/faq.js +++ b/vendor/js/faq.js @@ -213,6 +213,7 @@ function getQuestions() for (let i = 0; i < result.data.questions.length; i++) { questions_list.push( 'q_' + result.data.questions[i].id ); + if( $('#q_' + result.data.questions[i].id ).length < 1 ) { questions.append( '
' + @@ -226,12 +227,14 @@ function getQuestions() '
' + '
' ) } - else if ( $( '#qa_' + result.data.questions[i].id ).length < 1 && result.data.questions[i].answer !== null && result.data.questions[i].answer.length > 5 ) + let _sel = $('#qa_' + result.data.questions[i].id ); + + if ( _sel.length < 1 && result.data.questions[i].answer !== null && result.data.questions[i].answer.length > 5 ) { $('#q_' + result.data.questions[i].id + ' p' ).html( result.data.questions[i].question + '
' + result.data.questions[i].answer + '' ); $('#q_' + result.data.questions[i].id + ' h5').addClass( 'text-info' ).removeClass( 'text-warning' ); } - else if ( result.data.questions[i].answer !== $('#qa_' + result.data.questions[i].id ).html() && result.data.questions[i].answer.length > 5 ) + else if ( result.data.questions[i].answer !== _sel.html() && result.data.questions[i].answer.length > 5 ) { $('#q_' + result.data.questions[i].id + ' p' ).html( result.data.questions[i].question + '
' + result.data.questions[i].answer + '' ); } @@ -289,6 +292,18 @@ function welcomeMessage() } +function closeWelcome() +{ + let refresh_rate = $('#refresh_rate').val(); + if( refresh_rate < 2 || refresh_rate > 122 ) + { + refresh_rate = 2; + } + let q_interval = setInterval( function() { getQuestions(); }, refresh_rate * 1000 ); + + +} + function copyShareUrl( btn ) {