diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..7d91044 --- /dev/null +++ b/icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/index.css b/index.css new file mode 100644 index 0000000..0d51309 --- /dev/null +++ b/index.css @@ -0,0 +1,5 @@ +.codio-assessment-splice-iframe { + height: auto; + width: 100%; + max-width: 100%; +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..e37dbcc --- /dev/null +++ b/index.html @@ -0,0 +1,23 @@ + + + + + SPLICE assessment + + + + + + +
+

+
+
+
+
+
+
+
+ + + diff --git a/index.js b/index.js new file mode 100644 index 0000000..6d8eeb1 --- /dev/null +++ b/index.js @@ -0,0 +1,187 @@ +(function (){ + let assessmentOptions = null + let assessment = null + let processing = false + let currentData = null + + const SPLICE_METHODS = { + REPORT_SCORE_AND_STATE: 'SPLICE.reportScoreAndState', + GET_STATE: 'SPLICE.getState', + GET_STATE_RESPONSE: 'SPLICE.getState.response', + FRAME_RESIZE: 'lti.frameResize', + } + + const updateProcessing = (status) => { + processing = status + } + + const applyStateInitial = (data) => { + const {state, result, ...dataWithoutState} = data + assessment = dataWithoutState.assessment + assessmentOptions = dataWithoutState.options + + render() + } + + const applyState = (data) => { + console.log('assessment iframe applyState', data) + currentData = data + if (!assessment) { + applyStateInitial(data) + } + // todo sent set state to iframe?? + } + + const renderContent = () => { + $('.instructions-text').html(assessment.source.settings.instructions) + const iframe = $(`