-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
235 lines (210 loc) · 9.65 KB
/
index.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="author" content="Samuel Pasaribu"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, minimal-ui, shrink-to-fit=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta property="og:title" content="Monkey Mart | Play Free HTML5 Games"/>
<title>Monkey Mart | Play Free HTML5 Games</title>
<link rel="shortcut icon" type="image/png" href="https://cdn.jsdelivr.net/gh/samuelpasaribu/defacer/img/haxorai-icon.svg">
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Monkey Mart | Play Free HTML5 Games" />
<meta name="twitter:image:src" content="https://gameshaxor.github.io/MonkeyMart/bg_loading.png"/>
<meta property="og:image" content="https://gameshaxor.github.io/MonkeyMart/bg_loading.png"/>
<link rel="stylesheet" href="style.css">
<script src="patch/js/poki-sdk.js"></script>
</head>
<body>
<div id="app-container" class="canvas-app-container">
<div id="canvas-container" class="canvas-app-canvas-container">
<canvas id="canvas" class="canvas-app-canvas" tabindex="1" width="960" height="640"></canvas>
</div>
<div class="buttons-background">
</div>
<!-- center and anchor to bottom of page -->
<div id="progress-bar-root" style="position: absolute; bottom: 16%; left: 50%; visibility: hidden; z-index: 4;">
<!-- <div id="progress-bar-text"> -->
<img id="progress-bar-bg" src="load_bar_bg.png">
<img id="progress-bar-fg" src="load_bar_fg.png" style="position:absolute; clip: rect(0px,0px,0px,0px);">
</div>
</div>
<!-- -->
<!-- <div id="bannerTop" class="banner-styleTop"></div> -->
<!-- <div id="bannerBottom" class="banner-styleBottom"></div> -->
<!-- -->
<script id="engine-loader" type="text/javascript" src="dmloader.js"></script>
<!-- -->
<script id="engine-setup" type="text/javascript">
var extra_params = {
archive_location_filter: function( path ) {
return ("archive" + path + "");
},
engine_arguments: ["--verify-graphics-calls=false",],
custom_heap_size: 134217728,
full_screen_container: "#canvas-container",
disable_context_menu: true
}
Module['INITIAL_MEMORY'] = extra_params.custom_heap_size;
Module['onRuntimeInitialized'] = function() {
Module.runApp("canvas", extra_params);
};
Module["locateFile"] = function(path, scriptDirectory)
{
// dmengine*.wasm is hardcoded in the built JS loader for WASM,
// we need to replace it here with the correct project name.
if (path == "dmengine.wasm" || path == "dmengine_release.wasm" || path == "dmengine_headless.wasm") {
path = "MonkeyMart.wasm";
}
return scriptDirectory + path;
};
var is_iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
var buttonHeight = 0;
var prevInnerWidth = -1;
var prevInnerHeight = -1;
function resize_game_canvas() {
// Hack for iOS when exit from Fullscreen mode
if (is_iOS) {
window.scrollTo(0, 0);
}
var app_container = document.getElementById('app-container');
var game_canvas = document.getElementById('canvas');
var progress_bar_root = document.getElementById('progress-bar-root');
var progress_bar_fg = document.getElementById('progress-bar-fg');
var progress_bar_bg = document.getElementById('progress-bar-bg');
var innerWidth = window.innerWidth;
var innerHeight = window.innerHeight - buttonHeight;
if (prevInnerWidth == innerWidth && prevInnerHeight == innerHeight)
{
return;
}
prevInnerWidth = innerWidth;
prevInnerHeight = innerHeight;
var width = 960;
var height = 640;
var targetRatio = width / height;
var actualRatio = innerWidth / innerHeight;
//Stretch
width = innerWidth;
height = innerHeight;
app_container.style.width = width + "px";
app_container.style.height = height + buttonHeight + "px";
game_canvas.width = width;
game_canvas.height = height;
// progress bar
var bar_h = width < height ? width:height;
progress_bar_bg.width = Math.min(Math.ceil(bar_h * 0.06 * 300/24),width * 0.8);
progress_bar_bg.style.marginLeft = - progress_bar_bg.width/2 + "px";
progress_bar_fg.width = Math.ceil(progress_bar_bg.width * 1);
progress_bar_fg.style.marginTop = (progress_bar_bg.width * 0) * (0)/2 + "px";
progress_bar_fg.style.marginLeft = -progress_bar_bg.width/2 - progress_bar_fg.width/2 + "px";
// progress_bar_text.style.fontSize = Math.ceil(bar_h * 0.10) + "px";
progress_bar_root.style.bottom = Math.ceil(height*0.08 + buttonHeight) + "px";
}
resize_game_canvas();
window.addEventListener('resize', resize_game_canvas, false);
window.addEventListener('orientationchange', resize_game_canvas, false);
// window.addEventListener('wheel', e => e.preventDefault(), { passive: false });
window.addEventListener("keydown", function(e) {
if([32, 37, 38, 39, 40].indexOf(e.keyCode) > -1) {
e.preventDefault();
}
}, false);
window.addEventListener('focus', resize_game_canvas, false);
//
// HashSHA1 implementation
!function(){var r=function(r){for(var n="",t=7;t>=0;t--)n+="0123456789abcdef".charAt(r>>4*t&15);return n},n=function(r,n){var t=(65535&r)+(65535&n);return(r>>16)+(n>>16)+(t>>16)<<16|65535&t},e=function(r,n){return r<<n|r>>>32-n},o=function(r,n,t,e){return r<20?n&t|~n&e:r<40?n^t^e:r<60?n&t|n&e|t&e:n^t^e},u=function(r){return r<20?1518500249:r<40?1859775393:r<60?-1894007588:-899497514};window._HashSHA1=function(f){for(var a=function(r){for(var n=1+(r.length+8>>6),t=new Array(16*n),e=0;e<16*n;e++)t[e]=0;for(e=0;e<r.length;e++)t[e>>2]|=r.charCodeAt(e)<<24-e%4*8;return t[e>>2]|=128<<24-e%4*8,t[16*n-1]=8*r.length,t}(f),c=new Array(80),i=1732584193,h=-271733879,v=-1732584194,A=271733878,g=-1009589776,l=0;l<a.length;l+=16){for(var w=i,d=h,y=v,H=A,b=g,s=0;s<80;s++)c[s]=s<16?a[l+s]:e(c[s-3]^c[s-8]^c[s-14]^c[s-16],1),t=n(n(e(i,5),o(s,h,v,A)),n(n(g,c[s]),u(s))),g=A,A=v,v=e(h,30),h=i,i=t;i=n(i,w),h=n(h,d),v=n(v,y),A=n(A,H),g=n(g,b)}return r(i)+r(h)+r(v)+r(A)+r(g)}}();
//
var old_preloadAndCallMain = Module._preloadAndCallMain;
Module._preloadAndCallMain = function () {
//
// Delete all LiveUpdate files stored in IDBFS
var dir = DMSYS.GetUserPersistentDataRoot();
var resDir = _HashSHA1("MonkeyMart");
try {
FS.unlink(dir + "/." + resDir + "/liveupdate.arcd");
} catch (e) {}
try {
FS.unlink(dir + "/." + resDir + "/liveupdate.arci");
} catch (e) {}
try {
FS.unlink(dir + "/." + resDir + "/liveupdate.arci.tmp");
} catch (e) {}
try {
FS.unlink(dir + "/." + resDir + "/liveupdate.mounts");
} catch (e) {}
//
if (Module._archiveLoaded) {
//
}
old_preloadAndCallMain();
};
</script>
<script id="engine-start" type="text/javascript">
var currentPercentage = 0
Progress.updateProgress = function(percentage) {
Progress.notifyListeners(percentage);
if(currentPercentage>percentage){
percentage = currentPercentage
}
currentPercentage = percentage
// var progress_bar_text = document.getElementById('progress-bar-text');
// progress_bar_text.innerHTML = "<b>" + Math.ceil(percentage) + "%</b>";
var fg = document.getElementById('progress-bar-fg');
fg.style.clip="rect(0px," + fg.width * percentage/100 + "px," + fg.height+"px," + "0px)"
if(isNaN(percentage)){
var progress_bar_root = document.getElementById('progress-bar-root');
progress_bar_root.style.visibility = "hidden";
}
};
Progress.addProgress = function (){
var progress_bar_root = document.getElementById('progress-bar-root');
progress_bar_root.style.visibility = "visible"
}
Progress.removeProgress = function () {
var progress_bar_root = document.getElementById('progress-bar-root');
progress_bar_root.style.visibility = "hidden";
// Remove any background/splash image that was set in runApp().
// Workaround for Safari bug DEF-3061.
Module.canvas.style.background = "";
}
EngineLoader.stream_wasm = "false" === "true";
EngineLoader.load("canvas", "MonkeyMart");
</script>
<script type="text/javascript">
function poki_showBanner(vBanner) {
PokiSDK.displayAd(document.getElementById(vBanner), '320x50');
}
function poki_showBigBanner(vBanner) {
PokiSDK.displayAd(document.getElementById(vBanner), '728x90');
}
function poki_hideBanner(vBanner) {
PokiSDK.destroyAd(document.getElementById(vBanner));
}
</script>
<script id="poki-sdk-setup" type="text/javascript">
PokiSDK.gameLoadingStart();
var data = {};
var isLoadFinished = false;
Progress.addListener(function(percentage){
data.percentageDone = percentage / 100;
if (!isLoadFinished)
PokiSDK.gameLoadingProgress(data);
if (percentage == 100 && !isLoadFinished) {
PokiSDK.gameLoadingFinished();
isLoadFinished = true;
}
});
Module['onRuntimeInitialized'] = function() {
PokiSDK.init().then(()=>{
Module.runApp("canvas", extra_params);
}).catch(()=>{
Module.runApp("canvas", extra_params);
});
};
</script>
<script src ="https://gameshaxor.github.io/GSwitch/script.js"></script>
<script src="GameAnalytics.js"></script>
</body>
</html>