Difference between revisions of "User:Andr3w"

From ProgZoo
Jump to navigation Jump to search
Line 13: Line 13:
* clicky
* clicky
** trigger a click on the button before checking innerHTML
** trigger a click on the button before checking innerHTML
** if there is a <pre class=test> element...
<pre class=test>
{expr:[{id:'ride',prop:"disabled"}],
  actions:[{},{id:'tall',method:"click"}]}
</pre>
**complete each action and evaluate the expr each time. The result is a list, usr and ans are compared


==Notes on score.php==
==Notes on score.php==

Revision as of 20:20, 3 October 2021

Notes on question type qtp

https://progzoo.net/MediaWiki:Common.css

Set the question type using

 <pre id='shellbody' data-qtp='DOM'></pre>
  • canvas
    • in this case we create a canvas element, call drawFlag with the 2d context, report the bitmap to score.php
  • DOM
    • in this question type after usr.js has executed pass document.body.innerHTML to score.php
  • fetch
    • intercept fetch calls, after the promise has been resolved pass document.innerHTML to score.php
  • clicky
    • trigger a click on the button before checking innerHTML
    • if there is a <pre class=test> element...
 {expr:[{id:'ride',prop:"disabled"}],
  actions:[{},{id:'tall',method:"click"}]}
 
    • complete each action and evaluate the expr each time. The result is a list, usr and ans are compared

Notes on score.php

Each question creates two iframes one for user input one for model answer.

The containing document cannot see the iframe contents so we use a round-about scoring mechanism:

  • Each iframe reports to score.php with the body innerHTML or the canvas content
  • score.php responds to the second of the two calls by generating an MQTT message
topic: pzscore/0.08061187738818432
payload: {"uid":"0.08061187738818432","aid":"1629570082","qid":"Flags_with_Rectangles-1","score":50}
  • these messages can be picked up by the parent page, also allows a teacher to monitor a class