forked from ThatFruedDued/okremu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
146 lines (142 loc) · 5.2 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
<!DOCTYPE html>
<html>
<head>
<title>okrEMU</title>
<!-- android -->
<meta name="mobile-web-app-capable" content="yes">
<!-- iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="translucent-black">
<meta name="apple-mobile-web-app-title" content="okrEMU">
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<link rel='stylesheet' href='css/styledselect.css'>
<link rel='stylesheet' href='css/index-main.css'>
</head>
<body>
<div id='titlebar'>
<h2 style='display: inline-block; font-size: 75px; margin-bottom: -60px;'>okrEMU</h2>
<p style='display: inline-block;'>
Subdomain from <a href='https://freedns.afraid.org'>FreeDNS</a><br>
Base emulator by <a href='https://matthewbauer.us'>Matthew Bauer</a><br>
<a href='options.html'>Options</a>
</p>
</div>
<div class="custom-select" style="width: 25%; display: inline-block;">
<select id='chooseconsole'>
<option value="0" selected="selected">All</option>
<option value="1">NES</option>
<option value="2">SNES</option>
<option value="3">GBA</option>
</select>
</div>
<input type="text" id="search" name="search-okremu" placeholder='Search...' style='display: inline-block;' autocomplete="off">
<br><br>
<div id='nes'></div>
<div id='snes'></div>
<div id='gba'></div>
<script src='scripts/fastclick.js'></script>
<script src='scripts/styledselect.js'></script>
<script src='scripts/gameVals.js'></script>
<script>
window.addEventListener("touchstart", e => {
if(e.touches.length > 1) {
e.preventDefault();
} else {
return;
}
}, {passive: false});
window.addEventListener("touchmove", e => {
if(e.touches.length > 1) {
e.preventDefault();
} else {
return;
}
}, {passive: false});
window.addEventListener("touchend", e => {
if(e.touches.length > 1) {
e.preventDefault();
} else {
return;
}
}, {passive: false});
let divids = ["nes", "snes", "gba"];
gameVals.sort(function(a, b){
var intArray = [a[4], b[4]]
intArray.sort();
if(intArray.join('\\') === [a[4], b[4]].join('\\')){
return -1;
} else {
return 1;
}
});
gameVals.forEach(setUpImgs);
setInterval(function(){
document.getElementsByTagName('select')[0].dispatchEvent(new Event('change'));
document.getElementsByClassName('select-selected')[0].innerHTML = document.getElementById('chooseconsole').getElementsByTagName('option')[document.getElementById('chooseconsole').selectedIndex].innerHTML;
if(document.getElementById('search').value !== '' && document.getElementById('search').value !== null && document.getElementById('search').value !== undefined){
if(document.getElementById('search').value.toLowerCase() === '/dev'){
document.getElementById('search').value = '';
localStorage.setItem('devdata', prompt('devdata:'));
}
for(var i = 0; i < gameVals.length; i++){
if(gameVals[i][4].toLowerCase().indexOf(document.getElementById('search').value.toLowerCase()) === -1){
document.getElementById(gameVals[i][0]).style.display = 'none';
} else {
document.getElementById(gameVals[i][0]).style.display = 'inline-block';
}
}
} else {
for(var i = 0; i < gameVals.length; i++){
document.getElementById(gameVals[i][0]).style.display = 'inline-block';
}
}
}, 0);
document.getElementById('chooseconsole').addEventListener('change', (e) => {
var selval = e.target.value;
if(selval === '0'){
for(var i = 0; i < divids.length; i++){
document.getElementById(divids[i]).style.display = 'block';
}
} else if(selval === '1'){
for(var i = 0; i < divids.length; i++){
if(divids[i] === 'nes'){
document.getElementById(divids[i]).style.display = 'block';
} else {
document.getElementById(divids[i]).style.display = 'none';
}
}
} else if(selval === '2'){
for(var i = 0; i < divids.length; i++){
if(divids[i] === 'snes'){
document.getElementById(divids[i]).style.display = 'block';
} else {
document.getElementById(divids[i]).style.display = 'none';
}
}
} else if(selval === '3'){
for(var i = 0; i < divids.length; i++){
if(divids[i] === 'gba'){
document.getElementById(divids[i]).style.display = 'block';
} else {
document.getElementById(divids[i]).style.display = 'none';
}
}
}
});
function setUpImgs(item, index){
var gameImg = document.createElement('IMG');
gameImg.id = item[0];
gameImg.src = item[3];
gameImg.height = '256';
gameImg.style.cursor = 'pointer';
document.getElementById(item[2]).appendChild(gameImg);
document.getElementById(item[0]).addEventListener("click", function(){
localStorage.setItem('gameid', item[0]);
localStorage.setItem('gameext', item[1]);
document.location.href = 'emulator.html';
});
}
</script>
</body>
</html>