-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
40 lines (30 loc) · 1.44 KB
/
scripts.js
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
// Launches the container in a student preview mode.
function showStudentPreview() {
// Resolves the container URL and populates it with input parameters
function resolveContainerURL() {
var resultURL = 'http://ctr-qas.mheducation.com/flow/flowjs.html?name=container&login=3';
// TODO : get and pass the necessary input parameters
resultURL += "&skipLogin=true";
resultURL += "&userId=" + $('#in_instructor_id').val();
resultURL += "&sessionId=" + $('#in_session_id').val();
resultURL += "§ionId=" + $('#in_section_id').val();
return resultURL;
}
function showFrameOverlay(url) {
var overlay = jQuery('<div id="overlay">' +
'<h1 class="labelMode">Student preview mode</h1><button class="btnClose" onclick="removeOverlay()">Close</button>' +
'<iframe id="student_preview_frame" class="frame" src="' + containerURL + '"></iframe>' +
// This label could be removed. It just shows the iframe URL
'<h3 class="urlLabel" id="url_label">blank</h3>' +
'</div>');
overlay.appendTo(document.body);
}
var containerURL = resolveContainerURL();
showFrameOverlay(containerURL);
// to remove. this code shows the proper iframe URL
var frameURL = $('#student_preview_frame').attr('src');
document.getElementById('url_label').innerHTML = frameURL;
}
function removeOverlay() {
$("#overlay").remove();
}