-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathexample_print.html
More file actions
85 lines (68 loc) · 2.77 KB
/
Copy pathexample_print.html
File metadata and controls
85 lines (68 loc) · 2.77 KB
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
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>TheFragebogen: printable example</title>
<link rel="stylesheet" type="text/css" href="example.css">
<script src="../thefragebogen.js"></script>
<style>
@media print {
body {
counter-reset: page;
}
body>div::after {
counter-increment: page;
content: "Page "counter(page);
}
body>div:first-of-type {
page-break-before: avoid;
}
body>div {
page-break-before: always;
}
body>div>input[type="button"]:last-of-type {
/* Omit next button of ScreenUIElements */
display: none;
}
}
</style>
<script>
//This array stores all screens that will be shown.
var screens = [];
screens.push(
new ScreenUIElements(
new UIElementHTML(undefined, "<h1>TheFragebogen</h1>"),
new UIElementHTML(undefined, "This demo has CSS to be printed.<br>Just try to print this web page."),
new UIElementHTML(undefined, "Each screen will be printed on a separate page and the 'Next'-button will be hidden."),
new QuestionnaireItemDefinedOne(undefined, "Are you ready?", true, ["Yes"])
)
);
screens.push(
new ScreenUIElements(
new UIElementHTML(undefined, "Just some basic questions.<br>The 2nd must be answered."),
new QuestionnaireItemDefinedOne(undefined, "QuestionnaireItemDefinedOne: Question with a defined set of options, where only one option can be selected.", false, ["Option 1", "Option 2", "Option 3"]),
new QuestionnaireItemDefinedMulti(undefined, "QuestionnaireItemDefinedMulti: Question with a defined set of options, where multiple options can be selected.", true, ["Option 1", "Option 2", "Option 3"])
)
);
</script>
<script>
function start() {
document.body.innerHTML += "TheFragebogen loaded.";
if (typeof(screens) === "undefined") {
document.body.innerHTML += "<i>Something went wrong:</i> Please check the configuration.";
return;
}
document.body.innerHTML = "";
for (var i = 0; i < screens.length; i++) {
document.body.appendChild(screens[i].createUI());
}
}
window.print();
</script>
</head>
<body onload="start()">
<p>
TheFragebogen will be shown here.<br> If something fails while starting, an error message will be shown here.
</p>
</body>
</html>