-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
187 lines (169 loc) · 4.78 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
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>Stick_Man1</title>
<style>
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
margin: 0;
background: #444;
}
#gameContainer {
width: 100vw;
height: 100vh;
}
canvas {
width: 100%;
height: 100%;
display: block;
}
/* try to handle mobile dialog */
canvas + * {
z-index: 2;
}
.logo {
display: block;
max-width: 100vw;
max-height: 70vh;
}
.progress {
margin: 1.5em;
border: 1px solid white;
width: 50vw;
display: none;
}
.progress .full {
margin: 2px;
background: white;
height: 1em;
transform-origin: top left;
}
#loader {
position: absolute;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.spinner,
.spinner:after {
border-radius: 50%;
width: 5em;
height: 5em;
}
.spinner {
margin: 10px;
font-size: 10px;
position: relative;
text-indent: -9999em;
border-top: 1.1em solid rgba(255, 255, 255, 0.2);
border-right: 1.1em solid rgba(255, 255, 255, 0.2);
border-bottom: 1.1em solid rgba(255, 255, 255, 0.2);
border-left: 1.1em solid #ffffff;
transform: translateZ(0);
animation: spinner-spin 1.1s infinite linear;
}
@keyframes spinner-spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<div id="gameContainer"></div>
<div id="loader">
<img class="logo" src="logo.png">
<div class="spinner"></div>
<div class="progress"><div class="full"></div></div>
</div>
</body>
<script src="Build/UnityLoader.js"></script>
<script>
var gameInstance;
console.log("document...."+window.document.referrer);
console.log("location...."+window.location.href);
gameInstance = UnityLoader.instantiate("gameContainer", "Build/Game6_Main.json", {onProgress: UnityProgress});
function UnityProgress(gameInstance, progress) {
if (!gameInstance.Module) {
return;
}
const loader = document.querySelector("#loader");
if (!gameInstance.progress) {
const progress = document.querySelector("#loader .progress");
progress.style.display = "block";
gameInstance.progress = progress.querySelector(".full");
loader.querySelector(".spinner").style.display = "none";
}
gameInstance.progress.style.transform = `scaleX(${progress})`;
if (progress === 1 && !gameInstance.removeTimeout) {
gameInstance.removeTimeout = setTimeout(function() {
loader.style.display = "none";
gameInstance.SendMessage("Canvas", "current_url_get",window.location.href);
}, 2000);
}
}
function gd_ad_call()
{
}
function gd_again_ad_call()
{
}
function preload_RV_ad()
{
}
function show_RV_ad(val)
{
}
function extractHostname(url)
{
console.log("main..url.."+url);
var hostname;
//find & remove protocol (http, ftp, etc.) and get hostname
if (url.indexOf("//") > -1) {
hostname = url.split('/')[2];
}
else {
hostname = url.split('/')[0];
}
//find & remove port number
hostname = hostname.split(':')[0];
//find & remove "?"
hostname = hostname.split('?')[0];
return hostname;
}
// Listen for messages from the iframe
window.addEventListener('message', function(event)
{
console.log("my...webbb000..."+event.data.type);
// If the message is a request for the grandparent domain name
if (event.data && event.data.type === 'getGrandparentDomain') {
// Get the domain name of the grandparent window
var grandparentDomain = window.parent.location.hostname;
console.log("my...webbb111..."+grandparentDomain);
// Send a message to the iframe containing the grandparent domain name
//event.source.postMessage({ type: 'grandparentDomain', domain: grandparentDomain }, event.origin);
}
});
</script>
<script>
// Send the hostname of the hosting website to the parent window
const parentWindow = window.parent;
const hostingHostname = window.location.hostname;
parentWindow.postMessage(hostingHostname, "*");
</script>
</html>