Jump to navigation

Namespace: display

Numbas.display

Members

(static) modal :Object.<function()>

Callback functions for the modals.

Type:
Source:

Methods

(static) die(e)

The Numbas exam has failed so much it can't continue - show an error message and the error.

Parameters:
Name Type Description
e Error
Source:

(static) find_jme_scope(element) → {Numbas.jme.Scope}

Find the JME scope that applies to this element. Looks for an element with a 'jme-scope' data attribute.

Parameters:
Name Type Description
element Element
Returns:
Type Description
Numbas.jme.Scope
Source:

(static) find_root_ancestor(element) → {Node}

Find the element's top ancestor node. For elements in the document, this will be the document object itself.

Parameters:
Name Type Description
element Element
Returns:
Type Description
Node
Source:

(static) hide_lightbox()

Hide the lightbox.

Source:

(static) init()

Initialise the display. Called as soon as the page loads.

Source:

(static) makeHTMLFromXML(xml, template, scope, contextDescription) → {Promise}

Make HTML from an XML node and bind it to the given scope and display object. Variables are substituted from the given scope using Numbas.jme.variables.DOMcontentsubvars.

Parameters:
Name Type Description
xml Element
template XMLDocument
scope Numbas.jme.Scope
contextDescription string

Description of the JME context, for error messages.

Returns:
Type Description
Promise
  • Resolves to the produced HTML element after variables have been substituted.
Source:

(static) register_lightbox(element)

Register event listeners to show the lightbox when images in this element are clicked.

Parameters:
Name Type Description
element Element
Source:

(static) setJMEScope(element, scope)

Associate a JME scope with the given element.

Parameters:
Name Type Description
element Element
scope Numbas.jme.Scope
Source:

(static) showAlert(msg, fnOK)

Show an alert dialog.

Parameters:
Name Type Description
msg string

message to show the user

fnOK function

callback when OK is clicked

Source:

(static) showConfirm(msg, fnOK, fnCancel)

Show a confirmation dialog box.

Parameters:
Name Type Description
msg string

message to show the user

fnOK function

callback if OK is clicked

fnCancel function

callback if cancelled

Source:

(static) showConfirmEndExam(msg, fnEnd, fnCancel)

Show the end exam confirmation dialog box.

Parameters:
Name Type Description
msg string

message to show the user

fnEnd function

callback to end the exam

fnCancel function

callback if cancelled

Source:

(static) showLoadProgress()

Update the progress bar when loading.

Source:

(static) showScoreFeedback(obj, settings) → {Numbas.display_util.scoreFeedback}

Update a score feedback box.

Parameters:
Name Type Description
obj Numbas.display_util.feedbackable

Object to show feedback about.

settings Numbas.display_util.showScoreFeedback_settings
Returns:
Type Description
Numbas.display_util.scoreFeedback
Source:

(static) showStyleModal()

Show the modal with styling options.

Source:

(static) show_lightbox(original)

Show the lightbox.

Parameters:
Name Type Description
original Element

The original image element which is going to be copied into the lightbox.

Source:

(static) typeset(selectoropt, callback)

Make MathJax typeset any maths in the selector.

Parameters:
Name Type Attributes Description
selector jQuery | Element <optional>

Elements to typeset. If not given, the whole page is typeset.

callback function

Function to call when typesetting is finished.

Source: