Performance update, add setup for refresh rate
Took 36 minutes
This commit is contained in:
19
vendor/js/faq.js
vendored
19
vendor/js/faq.js
vendored
@ -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( '<div class="col-sm-6 col-lg-4 col-md-5"><div class="card" id="q_' + result.data.questions[i].id + '" style=" margin-bottom: 10px;">' +
|
||||
@ -226,12 +227,14 @@ function getQuestions()
|
||||
' </div>' +
|
||||
'</div> ' )
|
||||
}
|
||||
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 + '<hr><span id="qa_' + result.data.questions[i].id + '">' + result.data.questions[i].answer + '</span>' );
|
||||
$('#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 + '<hr><span id="qa_' + result.data.questions[i].id + '">' + result.data.questions[i].answer + '</span>' );
|
||||
}
|
||||
@ -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 )
|
||||
{
|
||||
|
||||
|
Reference in New Issue
Block a user