-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
76 lines (66 loc) · 2.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>AbstractContentEditor</title>
<script type="application/javascript">
/**
dont delete! used for initialization.
**/
function init() {
window.data = getData();
setDataGetter(dataGetter)
}
</script>
</head>
<body>
<!-- EDIT Form for User Input -->
<div>
<label for="titleInput">Enter Title:</label>
<input id="titleInput" type="text" />
</div>
<!-- EDIT Form for User Input -->
<!-- EDIT Form logic -->
<script type="application/javascript">
/**
dataGetter (as referenced in function init() ) returns data object with values from form.
Sharing cards e.g. on facebook uses following 3 properties for displaying the preview:
title
description
imageUrl
for example:
title: document.getElementById('titleInput').value,
type: 'FillIN',
fillintext: document.getElementById('fillintext').value,
questionContext: document.getElementById('hintInput').value,
answerContext: document.getElementById('explanationInput').value,
lastEdit: Date.now(),
answers: extractAnswersToArray(document.getElementById('fillintext').value),
releaseStatus: 'PUBLIC',
multimedia: [],
description: replacePossibleAnswers(document.getElementById('fillintext').value)
**/
function dataGetter() {
return {
// return data object
lastEdit: Date.now(),
title: document.getElementById('titleInput').value
}
}
/**
function init() -> dont delete! used for initialization.
**/
init();
/**
For each input field in form get & set values from windows.data object.
Is used when user is editing this card.
for example:
document.getElementById('fillintext').value = window.data.fillintext;
document.getElementById('hintInput').value = window.data.questionContext;
document.getElementById('explanationInput').value = window.data.answerContext;
**/
document.getElementById('titleInput').value = window.data.title;
</script>
<!-- EDIT Form logic -->
</body>
</html>