Performance update, add setup for refresh rate

Took 36 minutes
This commit is contained in:
Tobias Hopp 2020-10-05 12:11:52 +02:00
parent d3bd359db6
commit a73b30d965
4 changed files with 39 additions and 12 deletions

19
.idea/workspace.xml generated
View File

@ -22,6 +22,8 @@
<list default="true" id="fc13552d-b118-4828-b78f-fc8714e0cfdc" name="Default Changelist" comment="Final COMMIT!!!"> <list default="true" id="fc13552d-b118-4828-b78f-fc8714e0cfdc" name="Default Changelist" comment="Final COMMIT!!!">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/faq.tmpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/faq.tmpl.html" afterDir="false" /> <change beforePath="$PROJECT_DIR$/templates/faq.tmpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/faq.tmpl.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/start.tmpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/start.tmpl.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/vendor/js/faq.js" beforeDir="false" afterPath="$PROJECT_DIR$/vendor/js/faq.js" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -32,7 +34,7 @@
<execution /> <execution />
</component> </component>
<component name="DarkyenusTimeTracker"> <component name="DarkyenusTimeTracker">
<option name="totalTimeSeconds" value="88787" /> <option name="totalTimeSeconds" value="91055" />
<option name="gitIntegration" value="true" /> <option name="gitIntegration" value="true" />
<option name="naggedAbout" value="1" /> <option name="naggedAbout" value="1" />
</component> </component>
@ -78,7 +80,7 @@
<updated>1601618466935</updated> <updated>1601618466935</updated>
<workItem from="1601618467981" duration="36776000" /> <workItem from="1601618467981" duration="36776000" />
<workItem from="1601809534320" duration="1558000" /> <workItem from="1601809534320" duration="1558000" />
<workItem from="1601811106543" duration="21238000" /> <workItem from="1601811106543" duration="24795000" />
</task> </task>
<task id="LOCAL-00001" summary="Initial commit"> <task id="LOCAL-00001" summary="Initial commit">
<created>1601618764031</created> <created>1601618764031</created>
@ -297,7 +299,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1601843969679</updated> <updated>1601843969679</updated>
</task> </task>
<option name="localTasksCounter" value="32" /> <task id="LOCAL-00032" summary="Store interval in a variable to turn it off later">
<created>1601880753928</created>
<option name="number" value="00032" />
<option name="presentableId" value="LOCAL-00032" />
<option name="project" value="LOCAL" />
<updated>1601880753928</updated>
</task>
<option name="localTasksCounter" value="33" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -316,7 +325,6 @@
<option name="oldMeFiltersMigrated" value="true" /> <option name="oldMeFiltersMigrated" value="true" />
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="Almost done, finish line!" />
<MESSAGE value="Fixing a bug where the answer is posted directly" /> <MESSAGE value="Fixing a bug where the answer is posted directly" />
<MESSAGE value="Final upload, should be running now" /> <MESSAGE value="Final upload, should be running now" />
<MESSAGE value="Fixing a little things" /> <MESSAGE value="Fixing a little things" />
@ -341,7 +349,8 @@
<MESSAGE value="Performance update, load only when okay is pressed" /> <MESSAGE value="Performance update, load only when okay is pressed" />
<MESSAGE value="Add copy-url button" /> <MESSAGE value="Add copy-url button" />
<MESSAGE value="Edit time and add br to the page end" /> <MESSAGE value="Edit time and add br to the page end" />
<option name="LAST_COMMIT_MESSAGE" value="Edit time and add br to the page end" /> <MESSAGE value="Store interval in a variable to turn it off later" />
<option name="LAST_COMMIT_MESSAGE" value="Store interval in a variable to turn it off later" />
</component> </component>
<component name="WindowStateProjectService"> <component name="WindowStateProjectService">
<state x="728" y="326" width="800" height="683" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1601632929047"> <state x="728" y="326" width="800" height="683" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1601632929047">

View File

@ -155,15 +155,18 @@
<div class="modal-dialog modal-lg" role="document"> <div class="modal-dialog modal-lg" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="welcomeModalLabel">Welcome - ReadMe first</h5> <h5 class="modal-title text-info" id="welcomeModalLabel">Welcome - ReadMe first</h5>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<span>In the following page you can ask unlimited questions.<br>Your question should be contain 10 up to 500 characters.<br>The owner of this room then can answer your question.</span> <span>In the following page you can ask as many questions you want.<br>Your question should contain 10 up to 500 characters.<br>Only the owner or permitted users of this room can answer your question.</span>
<hr> <hr>
<span id="welcomeModalText" class="text-justify">You are an XXX of this room.<br>This means you can XXX</span> <span id="welcomeModalText" class="text-justify">You are an XXX of this room.<br>This means you can XXX</span>
<br><br>
<label for="refresh_rate"><strong>Refresh Rate</strong>(<span id="refresh_rate_counter">2</span> seconds)</label>
<input type="range" class="form-control form-control-range" value="2" id="refresh_rate" min="2" step="8" max="122" onchange="$('#refresh_rate_counter').html( $(this).val() );">
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" id="welcomeModalClose" class="btn btn-info" data-dismiss="modal" onclick="getQuestions(); let q_interval = setInterval( function() { getQuestions(); }, 2000 );">Okay</button> <button type="button" id="welcomeModalClose" class="btn btn-info" data-dismiss="modal" onclick="getQuestions(); closeWelcome();">Okay</button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -35,7 +35,7 @@
<header> <header>
<!-- Fixed navbar --> <!-- Fixed navbar -->
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark"> <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<a class="navbar-brand" href="#">Online-FAQ</a> <a class="navbar-brand" href="?">Online-FAQ</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
@ -85,7 +85,7 @@
<main role="main" class="flex-shrink-0"> <main role="main" class="flex-shrink-0">
<div class="container"> <div class="container">
<h1 class="mt-5">Online-FAQ</h1> <h1 class="mt-5">Online-FAQ</h1>
<p class="lead">Collect your database of questions and have them answered directly by your teacher.</p> <p class="lead">Collect your own database of questions and have them answered directly by specified users.</p>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg"> <div class="col-lg">

19
vendor/js/faq.js vendored
View File

@ -213,6 +213,7 @@ function getQuestions()
for (let i = 0; i < result.data.questions.length; i++) for (let i = 0; i < result.data.questions.length; i++)
{ {
questions_list.push( 'q_' + result.data.questions[i].id ); questions_list.push( 'q_' + result.data.questions[i].id );
if( $('#q_' + result.data.questions[i].id ).length < 1 ) 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;">' + 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>' +
'</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 + ' 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' ); $('#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>' ); $('#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 ) function copyShareUrl( btn )
{ {