This repository has been archived by the owner on Aug 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
popout.html
74 lines (63 loc) · 2.1 KB
/
popout.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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>AJAX APIs Interactive Samples</title>
<link rel="stylesheet" href="css/styles.css" type="text/css" media="screen" charset="utf-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body style="height:80%;">
<div id="outputDiv" style="position:absolute;width: 98%;height:98%;">
<div id="outputDrag">
<h2>
<table style="width: 100%;">
<tbody>
<tr>
<td>
<span style="cursor: pointer;" onclick="runCode();" id="run">Run <img src="images/play10x10.png"/></span>
</td>
<td id="runBoxTitle">Output</td>
<td align="right">
<span style="cursor: pointer;" id="popin" onclick="closeMe();"><img src="images/pop-in.gif" alt="Pop-in"/></span>
</td>
</tr>
</tbody>
</table>
</h2>
</div>
<div id="runbox"></div>
</div>
<script type="text/javascript" charset="utf-8">
var dad = window.opener;
var runBox = $('#runbox');
function resizeIframe() {
var newHeight = $('#outputDiv').height() - $('#outputDrag').height() - 1;
$('#runFrame').css('height', newHeight + 'px');
}
function runCode() {
// This sets is.codeToRun
dad.is.runCode();
}
function addIframe(boilerplateLoc) {
// This iframe reads is.codeToRun
var iFrameHTML = '<iframe src="'+boilerplateLoc+'" id="runFrame"><\/iframe>';
// TODO: this needs to be the location of the boilerplate HTML
var newFrame = $(iFrameHTML).get(0);
$(runBox).html(newFrame);
window.resizeIframe();
}
function closeMe() {
window.close();
}
$(window).bind('unload', function() {
dad.is.runBox.changeToInline();
});
$(window).bind('resize', function() {
window.resizeIframe();
});
// onload function
$(function () {
runCode();
});
</script>
</body>
</html>