This repository was archived by the owner on May 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpractice.html
More file actions
442 lines (377 loc) · 18 KB
/
practice.html
File metadata and controls
442 lines (377 loc) · 18 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
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Poet Image Description - Practice Describing</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="lib/bootstrap/css/bootstrap.min.css" media="screen" />
<link rel="stylesheet" type="text/css" href="styles/styles.css" media="screen" />
<script src="lib/jquery-3.1.1.js"></script>
<script src="lib/bootstrap/js/bootstrap.min.js"></script>
<script src="lib/ckeditor/ckeditor.js"></script>
<!-- <script src="scripts/practice.js"></script> -->
<script src="scripts/googleAnalytics.js"></script>
<script src="scripts/specific.js"></script>
<script src="https://cloud.tinymce.com/stable/tinymce.min.js?apiKey=xlzhd6byhk4jiattob7fcaqcj3uwp9nbl2qamzd03yfxmgw2"></script>
<script src="https://code.responsivevoice.org/responsivevoice.js"></script>
<script>
/*
function copyToClipboardHTML(element) {
var $temp = $("<input>");
$("body").append($temp);
$temp.val($('#userDescription').html()).select();
document.execCommand("copy");
$temp.remove();
}
function copyToClipboardText(element) {
var $temp = $("<input>");
$("body").append($temp);
$temp.val($('#userDescription').text()).select();
document.execCommand("copy");
$temp.remove();
}
*/
$(document).ready(function(){
var specificItems = [specific01, specific02, specific03, specific04, specific05, specific06, specific07, specific08, specific09, specific10, specific11, specific12, specific13, specific14, specific15, specific16, specific17, specific18, specific19, specific20, specific21, specific22, specific23, specific24, specific25, specific26, specific27, specific28, specific29, specific30, specific32, specific33, specific34, specific35, specific36];
var specificMainColumnItems = "<option value='' disabled selected>Select your option</option><option value='specific00'>None / Not Sure</option>";
var previousCategory = "";
var imageSelected = false;
var classificationSelected = false;
for (var i = 0; i < specificItems.length; i++) {
var temp = specificItems[i];
var currentCategory = temp[0].category;
if (currentCategory != previousCategory) {
specificMainColumnItems += '<option value="" disabled>'+ temp[0].category +' --------------------</option>';
}
previousCategory = temp[0].category;
specificMainColumnItems += '<option value="'+ temp[0].id +'"> '+temp[0].title+'</option>';
}
$('#imageClassificationDropdown').append(specificMainColumnItems);
$(":file").change(function () {
if (this.files && this.files[0]) {
var reader = new FileReader();
reader.onload = imageIsLoaded;
reader.readAsDataURL(this.files[0]);
}
function imageIsLoaded(e) {
$('#uploadedImage').attr('src', e.target.result);
$('#uploadedImage').show();
$('.modalThumb').attr('src', e.target.result);
$('.modalThumb').show();
$('#uploadedImage').fadeIn();
imageSelected = true;
enableTryDescribingButton();
};
});
$('#imageClassificationDropdown').change(function() {
$( "select option:selected" ).each(function() {
classificationSelected = true;
var selectValue = $(this).val();
if (selectValue == "specific00"){
var title = "None/Not Sure";
var guidelines = "Follow the general and image-specific guidelines provided in the <a href='https://poet-qa.diagramcenter.org/how.html' target='_blank'>How to Describe</a> section of the Poet Training Tool for best practice recommendations on writing extended image descriptions.";
} else {
var title = window[selectValue][0].title;
var guidelines = window[selectValue][0].guidelines;
}
//TODO populate guidelines
var html = "<h3 style='margin-top: 0px;'>"+ title + " Guidelines</h3><p>"+guidelines+"</p>";
$('#step1content').html(html);
enableTryDescribingButton();
});
});
function enableTryDescribingButton() {
if (imageSelected && classificationSelected) {
$("#tryDescribingButton").prop( "disabled", false );
} else {
$("#tryDescribingButton").prop( "disabled", true );
}
}
function resetTryDescribingButton() {
//clear variables
imageSelected = false;
classificationSelected = false;
//clear dropdown
//clear image preview * file select
//clear guidelines
}
function resetPracticeModal() {
//1.file upload
$(":file").val("");
//1a. Clear Dropdown
$("#imageClassificationDropdown").val($("#imageClassificationDropdown option:first").val());
//2.file image preview
$('#uploadedImage').hide();
//3. larger image
$('.modalThumb').hide();
//4. guidelines
$('#step1content').empty();
//5. Editor
tinyMCE.activeEditor.setContent('');
//6. preview
$('#step3content').empty();
//8. Reset Modal to step 1
$('#step1content').show();
$('#step2content').hide();
$('#step3content').hide();
//9. Hide Modal
$('#practiceModal').modal('hide');
}
$('#tryDescribingButton').click(function() {
$('#practiceModal').modal('show');
//TODO
//1.) Get returned URL from the image upload
//2.) Set the URL of the .modalThumb to the returned URL
//3.) Set the link of the "View Larger Image"
});
$("#step1nextButton").click(function() {
//set content
$('#step1content').hide();
$('#step2content').show();
$('#step3content').hide();
//set buttons
$('#step1nextButton').hide();
$('#step2nextButton').show();
$('#step2previousButton').show();
$('#step3nextButton').hide();
$('#step3previousButton').hide();
});
$("#step2nextButton").click(function() {
var data = tinyMCE.activeEditor.getContent();
var newData = "<div id='userDescription' style='padding: 0px 0px 15px 0px';>"+data+"</div>";
var dataContent = "<h3>Your Description</h3>"+newData;
// var copyButton = "<button type='submit' class='btn btn-primary copyButton'>Copy Description to Clipboard</button>";
var emailcontent = "<h4>Email this description to:</h4><form class='form-inline'><div class='form-group'><label for='sendToEmail' class='sr-only'>Email</label><input type='email' class='form-control' id='sendToEmail' placeholder='Email'></div><button type='submit' class='btn btn-primary' style='margin-left: 10px;'>Send as Email</button></form>";
$('#step3content').html(dataContent /* + copyButton */ /* + emailcontent */);
//set content
$('#step1content').hide();
$('#step2content').hide();
$('#step3content').show();
//set buttons
$('#step1nextButton').hide();
$('#step2nextButton').hide();
$('#step2previousButton').hide();
$('#step3nextButton').show();
$('#step3previousButton').show();
//TODO SUBMIT DATA TO API
//var imageDescription = "";
//var imageURL = "";
//var imageCategory "";
});
$("#step2previousButton").click(function() {
//set content
$('#step1content').show();
$('#step2content').hide();
$('#step3content').hide();
//set buttons
$('#step1nextButton').show();
$('#step2nextButton').hide();
$('#step2previousButton').hide();
$('#step3nextButton').hide();
$('#step3previousButton').hide();
});
$("#step3previousButton").click(function() {
//set content
$('#step1content').hide();
$('#step2content').show();
$('#step3content').hide();
//set buttons
$('#step1nextButton').hide();
$('#step2nextButton').show();
$('#step2previousButton').show();
$('#step3nextButton').hide();
$('#step3previousButton').hide();
});
$("#step3nextButton").click(function() {
resetPracticeModal();
$("#imageClassificationDropdown").val($("#target option:first").val());
//reset modal buttons
$('#step1content').show();
$('#step2content').hide();
$('#step3content').hide();
//set buttons
$('#step1nextButton').show();
$('#step2nextButton').hide();
$('#step2previousButton').hide();
$('#step3nextButton').hide();
$('#step3previousButton').hide();
//reset($('#fileUpload'));
window.reset = function (e) {
e.wrap('<form>').closest('form').get(0).reset();
e.unwrap();
}
$("#tryDescribingButton").prop( "disabled", true );
});
$('#modalSpeakButton').click(function() {
var data = tinyMCE.activeEditor.getContent({format : 'text'});
responsiveVoice.setDefaultVoice("US English Female");
responsiveVoice.speak(data);
});
/* CODE FROM DEREK FOR PUTTING FOCUS ON THE MODAL WINDOW
$("#generalGuidelinesModal").on('shown.bs.modal', function (e) {
$("#generalGuidelinesModalTitle").focus();
});
$(".btn-focus-retrigger").on('click', function (e) {
$("#generalGuidelinesModalTitle").focus();
});
$("#practiceModal").on('shown.bs.modal', function (e) {
$("#ModalTitle").focus();
});
$(".btn-focus-retrigger").on('click', function (e) {
$("#ModalTitle").focus();
});
*/
});
</script>
</head>
<body>
<a href="#mainContent" class="sr-only">Skip to main content</a>
<!-- BEGIN TOP HEADER/NAVIGATION -->
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
<img src="images/Poet_Training_Tool_white.png" alt="Poet Training Tool Logo" height="37">
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="about.html"><span style="color: #F7931E;">ABOUT</span> Poet</a></li>
<li><a href="when.html"><span style="color: #F7931E;">WHEN</span> to Describe</a></li>
<li><a href="how.html"><span style="color: #F7931E;">HOW</span> to Describe</a></li>
<li><a href="practice.html"><span style="color: #F7931E;">PRACTICE</span> Describing</a></li>
<li><a href="mailto:info@diagramcenter.org"><span style="color: #F7931E;">Contact Us</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<!-- END TOP HEADER/NAVIGATION -->
<!-- BEGIN TOP PAGE INFO -->
<a name="mainContent"></a>
<div class="row">
<div class="col-md-12" style="background-color: #efefef; border-bottom: 5px solid #222F3F;">
<h1><span style="color: #F7931E; padding-left: 20px;">PRACTICE</span> Describing Images</h1>
<p style="padding-left: 20px;">
This section allows you to apply the best practice guidelines and resources to your own materials. We recommend working in pairs so that you can discuss your writing process with a partner at the end. Start by uploading a single image (must be .jpeg, .png, or .gif), then follow the instructions laid out in this section.
<br/>
</p>
</div>
</div>
<!-- END TOP PAGE INFO -->
<!-- Begin Body -->
<div class="container">
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-8">
<br/><br/>
<h2>1. Upload an Image to Describe</h2>
<div style="margin-left:25px;">
<input id="fileUpload" type='file' />
<img id="uploadedImage" src="#" alt="your image" style="display: none; margin-top: 10px; border: 1px solid #999; border-radius: 5px;" width=175 />
<!-- <button type="button" class="btn btn-default btn-lg" id="">Upload Image</button> -->
</div>
<h2>2. Select a Classification that Matches Your Image</h2>
<div style="margin-left:25px;">
<select id="imageClassificationDropdown">
</select>
</div>
<div style="margin:40px 0px 200px 25px;">
<button type="button" class="btn btn-primary btn-lg" id="tryDescribingButton" disabled>Try Describing This Image</button>
</div>
</div>
</div>
</div>
<!-- BEGIN FOOTER -->
<footer class="footer">
<div class="container">
<div class="row">
<div class="col-md-12 ideaText">
<div style="width: 100%">
<a href="https://www2.ed.gov/about/offices/list/osers/osep/index.html" target="_blank">
<img style="float: left; margin: 0px 25px 40px 0px;" src="images/IDEA-logo.gif" alt="IDEA Logo" width="87" height="60">
</a>
</div>
<div style="width: 100%">
<a href="https://www.benetech.org/" target="_blank">
<img style="float: right;margin: 0px 0px 40px 25px;" src="images/benetech_logo_transparent.gif" alt="Benetech Logo" height="60">
</a>
</div>
<div>
The <a href="http://diagramcenter.org/" target="_blank">DIAGRAM Center</a> is a <a href="http://www.benetech.org/" target="_blank">Benetech</a> initiative supported by the U.S. Department of Education, Office of Special Education Programs (Cooperative Agreement #H327B100001). Opinions expressed herein are those of the authors and do not necessarily represent the position of the U.S. Department of Education. Poet™ is a trademark of Beneficent Technology, Inc. This website is copyright © 2012-2017, Beneficent Technology, Inc.
</div>
</div>
</div>
</div>
</footer>
<!-- END FOOTER -->
<!-- BEGIN PRACTICE MODAL -->
<div class="modal fade bs-example-modal-lg" role="dialog" aria-labelledby="ModalTitle" id="practiceModal">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h1 data-toc-skip tabindex="-1" class="modal-title" id="ModalTitle">Practice Describing</h1>
</div>
<div class="modal-body">
<!-- <div class="alert alert-danger" role="alert" id="alertWrongAnswer" style="display: none;"><strong>Woops, wrong answer.</strong> Select another answer and try again.</div> -->
<div>
<div class="row">
<div class="col-md-6" class="imageHolder">
<!-- <a href="" class="modalThumbLink" target="_blank"> -->
<img src="" alt="" class="modalThumb img-responsive">
<!-- </a> -->
<!-- <a href="" target="_blank" class="modalImageLink">View Full Sized Image in New Window</a> -->
<br/>
</div>
<div class="col-md-6">
<div id="step1content">
</div>
<div id="step2content" style="display: none;">
<h2 id="StepTwoTitle" tabindex="-1">Try Describing the Image:</h3>
<form>
<textarea name="editor1" id="editor1" rows="10" cols="80">
</textarea>
<button type="button" class="btn btn-default" id="modalSpeakButton" style="margin-top: 10px; float: right;"><img src="images/audio.png" alt="audio" height="24"></button>
<script>
tinymce.init({
height:"250",
selector:'textarea',
menubar: false,
plugins: 'table charmap lists',
toolbar: 'undo redo | bold italic strikethrough | alignleft aligncenter alignright | outdent indent | bullist numlist charmap | table',
browser_spellcheck: true,
table_advtab: false,
table_row_advtab: false,
table_cell_advtab: false,
table_toolbar: "tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol",
});
</script>
</form>
</div>
<div id="step3content" style="display: none;">
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="step1nextButton">Try Describing</button>
<button type="button" class="btn btn-default btn-focus-retrigger" id="step2previousButton" style="display: none;">Previous</button>
<button type="button" class="btn btn-primary btn-focus-retrigger" id="step2nextButton" style="display: none;">Review</button>
<button type="button" class="btn btn-default btn-focus-retrigger" id="step3previousButton" style="display: none;">Previous</button>
<button type="button" class="btn btn-primary" id="step3nextButton" style="display: none;">Try Another Image</button>
</div>
</div>
</div>
</div>
<!-- END PRACTICE MODAL -->
</body>
</html>