-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathiframe.html
executable file
·191 lines (177 loc) · 7.62 KB
/
iframe.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
<html>
<head>
<meta charset="utf-8"></meta>
<style>
@font-face {
font-family:"Patrick";
src:url("assets/patrick_hand_sc_regular.ttf");
}
@font-face {
font-family:"Boogaloo";
src:url("assets/boogaloo_regular.ttf");
}
body,div,canvas
{
margin:0px;
padding:0px;
font:"30px Patrick";
font:"30px Boogaloo";
font-kerning:normal;
text-rendering:optimizeLegibility;
letter-spacing:0px;
font-weight: normal;
-webkit-font-smoothing: antialiased;
font-variant-ligatures: none;
}
</style>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-72694027-9', 'auto', {cookieFlags: 'max-age=7200;secure;samesite=none'}); ga('send', 'pageview');
</script>
<script type="text/javascript" src="src/config.js"></script>
<script type="text/javascript" src="src/utils/doutils.js"></script>
<script type="text/javascript" src="src/utils/utils.js"></script>
<script type="text/javascript" src="src/utils/webgl-utils.js"></script>
<script type="text/javascript" src="src/utils/simplelog.js"></script>
<script type="text/javascript" src="src/utils/log_events.js"></script>
<script type="text/javascript" src="src/canv.js"></script>
<script type="text/javascript" src="src/stage.js"></script>
<script type="text/javascript" src="src/game.js"></script>
<script type="text/javascript" src="src/dom.js"></script>
<script type="text/javascript" src="src/doqueues/assetter.js"></script>
<script type="text/javascript" src="src/dofilters/clicker.js"></script>
<script type="text/javascript" src="src/dofilters/blurer.js"></script>
<script type="text/javascript" src="src/dofilters/keyer.js"></script>
<script type="text/javascript" src="src/doqueues/debugger.js"></script>
<script type="text/javascript" src="src/dofilters/dragger.js"></script>
<script type="text/javascript" src="src/doqueues/drawer.js"></script>
<script type="text/javascript" src="src/doqueues/flicker.js"></script>
<script type="text/javascript" src="src/dofilters/hoverer.js"></script>
<script type="text/javascript" src="src/dofilters/persistent_hoverer.js"></script>
<script type="text/javascript" src="src/doqueues/presser.js"></script>
<script type="text/javascript" src="src/doqueues/ticker.js"></script>
<script type="text/javascript" src="src/doqueues/particler.js"></script>
<script type="text/javascript" src="src/doqueues/objs/img.js"></script>
<script type="text/javascript" src="src/dofilters/objs/placer.js"></script>
<script type="text/javascript" src="src/dofilters/objs/input.js"></script>
<script type="text/javascript" src="src/doqueues/objs/listener.js"></script>
<script type="text/javascript" src="src/scenes/defines.js"></script>
<script type="text/javascript" src="src/scenes/quiz.js"></script>
<script type="text/javascript" src="src/scenes/template.js"></script>
<script type="text/javascript" src="src/scenes/loadData.js"></script>
<script type="text/javascript" src="src/scenes/junk.js"></script>
<script type="text/javascript" src="src/scenes/state.js"></script>
<script type="text/javascript" src="src/scenes/ui.js"></script>
<script type="text/javascript" src="src/scenes/nullScene.js"></script>
<script type="text/javascript" src="src/scenes/loadingScene.js"></script>
<script type="text/javascript" src="src/scenes/menuScene.js"></script>
<script type="text/javascript" src="src/scenes/testScene.js"></script>
<script type="text/javascript" src="src/scenes/gameplayScene.js"></script>
<script src="https://cdn.brainpop.com/games/assets/js/html2canvas.js"></script>
<script src="https://cdn.brainpop.com/games/assets/js/cameraProxyDOMCrossDomain.js"></script>
<script type="text/javascript">
var g;
var game_width = 880;
var game_height = 660;
var game_first_audio_played = 0;
var unplayed_audio_queue = [];
var playHandlePromise = function(audio,q)
{
r = audio.play();
if(!r) return;
r.catch(function(err){
if(!q) return;
for(var i = 0; i < unplayed_audio_queue.length; i++)
if(unplayed_audio_queue[i] == audio) return;
unplayed_audio_queue.push(audio);
});
}
function flush_unplayed_audio()
{
for(var i = 0; i < unplayed_audio_queue.length; i++)
{
var r = unplayed_audio_queue[i].play();
if(r) r.catch(noop);
}
unplayed_audio_queue = [];
}
function break_unplayed_audio()
{
unplayed_audio_queue = [];
}
function fullscreen()
{
var el = document.body;
var requestMethod = el.requestFullscreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen;
if(requestMethod) requestMethod.call(el);
}
function unfullscreen()
{
var el = document;
var exitMethod = el.exitFullscreen || el.webkitExitFullscreen || el.mozCancelFullScreen || el.msExitFullscreen;
if(exitMethod) exitMethod.call(el);
}
function size_containers(w,h)
{
var stage_container_container = document.getElementById("BrainPOPsnapArea"); //stage_container_container_because_javascript_is_terrible
stage_container_container.style.width = w; stage_container_container.style.height = h;
var stage_container = document.getElementById("stage_container");
stage_container.style.width = w; stage_container.style.height = h;
}
function resize()
{
var w = window.innerWidth;
var h = window.innerHeight;
//if(w > game_width) w = game_width;
//if(h > game_height) h = game_height;
//if(h < game_height) w = h/game_height*game_width;
w = h/game_height*game_width;
if(g) g.resize({width:w,height:h});
size_containers(w,h);
}
function begin()
{
var w = game_width;
var h = game_height;
size_containers(w,h);
var first_audio = GenAudio("assets/silence.mp3");
var play_first_audio = function()
{
first_audio.play();
game_first_audio_played = 1;
if(platform == "PC") stage_container.removeEventListener('mousedown', play_first_audio);
else if(platform == "MOBILE") stage_container.removeEventListener('touchstart', play_first_audio);
if(platform == "PC") stage_container.addEventListener('mousedown', flush_unplayed_audio);
else if(platform == "MOBILE") stage_container.addEventListener('touchstart', flush_unplayed_audio);
}
if(platform == "PC") stage_container.addEventListener('mousedown', play_first_audio);
else if(platform == "MOBILE") stage_container.addEventListener('touchstart', play_first_audio);
game_first_audio_played = 1; first_audio.play(); //comment this out if loaded _not_ through click-to-init iframe
/*
var try_fullscreen = function()
{
fullscreen();
if(platform == "PC") stage_container.removeEventListener('mousedown', try_fullscreen);
else if(platform == "MOBILE") stage_container.removeEventListener('touchstart', try_fullscreen);
}
if(platform == "PC") stage_container.addEventListener('mousedown', try_fullscreen);
else if(platform == "MOBILE") stage_container.addEventListener('touchstart', try_fullscreen);
*/
g = new Game({width:w,height:h,container:"stage_container"});
resize();
g.begin();
}
window.addEventListener("touchstart", function(e){ e.preventDefault() }); //prevent browser from doing anything funny
window.addEventListener("load",begin,false);
window.addEventListener("resize",resize,false);
</script>
</head>
<body id="body" style="width:100%; background-color:#052427;">
<div id="BrainPOPsnapArea" style="position:relative; margin:0px auto; padding:0px; user-select:none; background-color:#FFFFFF;">
<div id="stage_container" style="position:absolute; top:0px; left:0px; margin:0px; padding:0px; user-select:none; background-color:#FFFFFF;"> </div>
</div>
</body>
</html>