forked from geogebra/integration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example-assess-frameless.html
208 lines (171 loc) · 7.39 KB
/
example-assess-frameless.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!DOCTYPE html>
<html><head>
<title>Assessment Environment Integration</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="viewport" content="width=device-width,initial-scale=1">
<script src="https://www.geogebra.org/apps/deployggb.js"></script>
<link rel="stylesheet" type="text/css" href="navigation.css">
<!-- this page is used here: https://www.geogebra.org/m/qjmy2akp
-->
</head>
<body class="">
<div class="contentBoxSmall" id="contentBox">
<div id="ggbApplet"> </div>
<p>
<button class="appBtn noimage fixedSize" id="validateBtn" onclick="toggleButton(`validate`,false);">Show Validation</button>
<button class="appBtn noimage fixedSize" id="showanswerBtn" onclick="toggleButton(`showanswer`,false);">Show Answer</button>
<button class="appBtn noimage fixedSize" id="showsolutionBtn" onclick="toggleButton(`showsolution`,false);">Show Solution</button>
<button class="appBtn noimage fixedSize blue" onclick="loadNewQuestion();">New Question</button>
</p>
<!--<p><button class="appBtn noimage fixedSize blue"
onclick="ggbApplet.setValue("validate",false); ggbApplet.setValue("showanswer",false); ggbApplet.setValue("showsolution",false);
ggbApplet.evalCommand("UpdateConstruction()");">New Question</button><br></p>
<p><button class="appBtn noimage fixedSize" onclick="ggbApplet.setValue("validate", true);" id="1">Show Validation</button>
<button class="appBtn noimage fixedSize" onclick="ggbApplet.setValue("showanswer", true);" id="2">Show Answer</button>
<button class="appBtn noimage fixedSize" onclick="ggbApplet.setValue("showsolution", true);" id="3">Show Solution</button>
</p>
</div>
<div id="hide">
<p>
<button class="appBtn noimage fixedSize" onclick="ggbApplet.setValue("validate", false);" id="4">Hide Validation</button>
<button class="appBtn noimage fixedSize" onclick="ggbApplet.setValue("showanswer", false);" id="5">Hide Answer</button>
<button class="appBtn noimage fixedSize" onclick="ggbApplet.setValue("showsolution", false);" id="6">Hide Solution</button></p>-->
</div>
</div>
<script>
function toggleButton(value, isReset) {
if (!isReset) {
ggbApplet.setValue(value, !ggbApplet.getValue(value));
}
var btnLabelOn, btnLabelOff, btnID;
switch (value) {
case "validate":
btnLabelOn = "Hide Validation";
btnLabelOff = "Show Validation";
btnID = "validateBtn";
break;
case "showanswer":
btnLabelOn = "Hide Answer";
btnLabelOff = "Show Answer";
btnID = "showanswerBtn";
break;
case "showsolution":
btnLabelOn = "Hide Solution";
btnLabelOff = "Show Solution";
btnID = "showsolutionBtn";
break;
}
var btn = document.getElementById(btnID);
ggbApplet.getValue(value) ? btn.innerHTML = btnLabelOn : btn.innerHTML = btnLabelOff;
ggbApplet.getValue(value) ? btn.className = "appBtn noimage fixedSize pressed" : btn.className = "appBtn noimage fixedSize";
}
function resetButtons() {
toggleButton("validate", true);
toggleButton("showsolution", true);
toggleButton("showanswer", true);
}
function loadNewQuestion() {
ggbApplet.setValue("validate", false);
ggbApplet.setValue("showsolution", false);
ggbApplet.setValue("showanswer", false);
ggbApplet.evalCommand("UpdateConstruction()");
resetButtons();
}
var width = 800, height = 500, id = "vtuggwej", beta = false, seed = 1;
var getVars = [];
var locvartemp = ( window.location.href.indexOf( "?" ) + 1 ) ? window.location.href.substr( window.location.href.indexOf( "?" ) + 1 ) : "";
locvartemp=unescape(locvartemp);
locvartemp = locvartemp.split( "&" );
for( var x = 0; x < locvartemp.length; x++ ) {
var lvTempVar = locvartemp[x].split( "=" );
getVars[ unescape( lvTempVar[0] ) ] = unescape( lvTempVar[1] );
try {
console.log(locvartemp[x]);
eval(locvartemp[x]);
}
catch (err) {
console.log(err);
// eg cb="deploy50"
eval(lvTempVar[0] + "='" + lvTempVar[1] + "'");
}
}
if (id === undefined) {
id = prompt("Enter material id eg KdK6yXrU");
}
if (width === undefined) {
width = prompt("Enter width eg 1050");
}
if (height === undefined) {
height = prompt("Enter height eg 411");
}
function correctListener() {
console.log("correctListener " + ggbApplet.getValue("correct"));
document.getElementById("correct").innerHTML="correct = " + ((ggbApplet.getValue("correct")==0)?"false":"true");
}
//function gListener() {
//console.log("g");
//}
var parameters = {
"id": "ggbApplet",
"width":width || 800,
"height":height || 500,
"randomSeed":seed || 1,
"prerelease":false,
"showMenuBar":false,
"showAlgebraInput":false,
"showToolBar":false,
"showToolBarHelp":false,
"showResetIcon":false,
//"enableLabelDrags":false,
//"enableShiftDragZoom":false,
//"enableRightClick":false,
"errorDialogsActive":false,
"useBrowserForJS":false,
"allowStyleBar":false,
"preventFocus":false,
"showZoomButtons":false,
"enableShiftDragZoom":false,
"capturingThreshold":3,
// add code here to run when the applet starts
"appletOnLoad":function(api){
document.getElementById("version").innerHTML="GeoGebra version = " + api.getVersion();
api.registerObjectUpdateListener("correct", "correctListener");
//if (beta) {
//api.registerObjectUpdateListener("g", "gListener");
//}
if (ggbApplet.getObjectType("validate") != "boolean") {
document.getElementById("validate").style.display = "none";
}
if (ggbApplet.getObjectType("showanswer") != "boolean") {
document.getElementById("showanswer").style.display = "none";
}
if (ggbApplet.getObjectType("showsolution") != "boolean") {
document.getElementById("showsolution").style.display = "none";
}
},
"showFullscreenButton":false,
"scale":1,
"disableAutoScale":false,
"allowUpscale":false,
"clickToLoad":false,
"appName":"classic",
"showSuggestionButtons":true,
"language":"en",
"material_id":id || "KdK6yXrU",
};
// is3D=is 3D applet using 3D view, AV=Algebra View, SV=Spreadsheet View, CV=CAS View, EV2=Graphics View 2, CP=Construction Protocol, PC=Probability Calculator DA=Data Analysis, FI=Function Inspector, macro=Macros
var views = {'is3D': 0,'AV': 1,'SV': 0,'CV': 0,'EV2': 0,'CP': 0,'PC': 0,'DA': 0,'FI': 0,'macro': 0};
var applet = new GGBApplet(parameters, '5.0', views);
// 1 pixel preview + GeoGebra logo
applet.setPreviewImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAACXBIWXMAAAsTAAALEwEAmpwYAAAADElEQVR4nGP4//8/AAX+Av4N70a4AAAAAElFTkSuQmCC","https://www.geogebra.org/images/GeoGebra_loading.png");
if (beta) {
//applet.setHTML5Codebase("https://autotest2.geogebra.org/job/common-web-test/job/apps-1059/lastSuccessfulBuild/artifact/web/war/web3d/");
//applet.setHTML5Codebase("https://autotest2.geogebra.org/job/common-web-test/job/apps-1035-1144/lastSuccessfulBuild/artifact/web/war/web3d");
//applet.setHTML5Codebase("https://autotest2.geogebra.org/job/common-web-test/job/apps-1035/lastSuccessfulBuild/artifact/web/war/web3d");
//applet.setHTML5Codebase("https://autotest2.geogebra.org/job/common-web-test/job/master/lastSuccessfulBuild/artifact/web/war/web3d");
//applet.setHTML5Codebase("https://apps-builds.s3-eu-central-1.amazonaws.com/geogebra/branches/dev/latest/web3d");
applet.setHTML5Codebase("https://www.geogebra.org/apps/5.0.564.0/web3d/");
}
window.onload = function() {applet.inject('ggbApplet')};
</script>
</body></html>