-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.html
310 lines (293 loc) · 12.3 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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
<!--
ZeroGod
Copyright (C) 2018 GoodOldDownloads
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
ZeroGod
________________ ________________
| | | |
| ________ | | ________ |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| |______ | | | |______ | |
| | | | | | | |
|__________| | | |__________| | |
| | | |
____________| | ____________| |
| | | |
|________________| |________________|
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<base href="" target="_top" id="base">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no, user-scalable=no">
<title>GOG Games | Good Old Downloads</title>
<link rel="icon" type="image/png" href="static/img/favicon-16.png" sizes="16x16">
<link rel="icon" type="image/png" href="static/img/favicon-32.png" sizes="32x32">
<link rel="icon" type="image/png" href="static/img/favicon-96.png" sizes="96x96">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
<link rel="stylesheet" href="static/css/style.css">
<meta name="theme-color" content="#6a4da5">
</head>
<body>
<div id="zerosearch-wrap"></div>
<header id="navbar">
<div class="container">
<div id="logo">
<a href="/" title="Home"><img src="static/img/logo.svg"></a>
</div>
<form id="search-bar" action="/search/" method="get">
<input name="s" autocomplete="off" placeholder="Search" type="search">
<button type="submit" id="search-btn">
<i class="fas fa-search fa-fw"></i>
</button>
</form>
<a href="/faq" id="faq">FAQ</a>
</div>
</header>
<div class="container" id="main-shit">
home page here asdf
</div>
<script id="game-template" type="x-template">
<div class="bg"></div>
<div id="game-details">
<div class="container index">
<h1>{{ game.title }} <a href="{{ game.url }}" target="_blank" title="Go to GOG Store"><i class="fas fa-shopping-cart"></i></a> <a href="https://www.gogdb.org/product/{{ game.id }}" target="_blank" title="Go to GOGDB"><i class="fas fa-database"></i></a></h1>
<div class="info"><a href="#">{{ game.category }}</a> | <a href="#">{{ game.developer }}</a></div>
<button class="btn blue toggle-links no-js-hide">DOWNLOAD</button>
<button class="btn green no-js-hide __vote-modal-trigger hidden" data-id="{{ game.id }}">VOTE FOR RE-UPLOAD</button>
<button class="btn toggle-changelog">CHANGELOG</button>
<div class="items-links-block">
{{#links}}
<div class="items-group">
<div class="title">Game Download Links</div>
{{#each GAME}}
<div class="item-expand-wrap">
<div class="open-all no-js-hide" title="Open all Links (Allow Popups)"><i class="fas fa-external-link-square-alt"></i></div>
<div class="clip no-js-hide" title="Copy Links to Clipboard"><i class="fas fa-copy"></i></div>
<label class="item" for="{{@key}}_game" title="{{name}}">
<i class="fas fa-plus expand-icon" title="Show Download Links" data-toggled-text="Hide Download Links"></i>
<img src="static/img/hoster_logos/{{@key}}.svg" class="fac-hoster">
<span> {{name}}</span>
</label>
<input class="item-expand-check" id="{{@key}}_game" type="checkbox">
<div class="items-group expand">
{{#this}}
<a class="item" title="{{link}}" href="{{link}}" target="_blank">{{name}}</a>
{{/this}}
</div>
</div>
{{/each}}
</div>
{{#if PATCHES}}
<div class="items-group">
<div class="title">Patch/Other Download Links</div>
{{#each PATCHES}}
<div class="item-expand-wrap">
<div class="open-all no-js-hide" title="Open all Links (Allow Popups)"><i class="fas fa-external-link-square-alt"></i></div>
<div class="clip no-js-hide" title="Copy Links to Clipboard"><i class="fas fa-copy"></i></div>
<label class="item" for="{{@key}}_patches" title="{{name}}">
<i class="fas fa-plus expand-icon" title="Show Download Links" data-toggled-text="Hide Download Links"></i>
<img src="static/img/hoster_logos/{{@key}}.svg" class="fac-hoster">
<span> {{name}}</span>
</label>
<input class="item-expand-check" id="{{@key}}_patches" type="checkbox">
<div class="items-group expand">
{{#this}}
<a class="item" title="{{link}}" href="{{link}}" target="_blank">{{name}}</a>
{{/this}}
</div>
</div>
{{/each}}
</div>
{{/if}}
{{#if GOODIES}}
<div class="items-group">
<div class="title">Goodies Download Links</div>
{{#each GOODIES}}
<div class="item-expand-wrap">
<div class="open-all no-js-hide" title="Open all Links (Allow Popups)"><i class="fas fa-external-link-square-alt"></i></div>
<div class="clip no-js-hide" title="Copy Links to Clipboard"><i class="fas fa-copy"></i></div>
<label class="item" for="{{@key}}_goodies" title="{{name}}">
<i class="fas fa-plus expand-icon" title="Show Download Links" data-toggled-text="Hide Download Links"></i>
<img src="static/img/hoster_logos/{{@key}}.svg" class="fac-hoster">
<span> {{name}}</span>
</label>
<input class="item-expand-check" id="{{@key}}_goodies" type="checkbox">
<div class="items-group expand">
{{#this}}
<a class="item" title="{{link}}" href="{{link}}" target="_blank">{{name}}</a>
{{/this}}
</div>
</div>
{{/each}}
</div>
{{/if}}
{{/links}}
{{^links}}
<div class="items-group">
{{#uploading}}
<div class="item">Game is currently uploading.</div>
{{/uploading}}
{{^uploading}}
<div class="item">Upload hasn't started yet.</div>
{{/uploading}}
</div>
{{/links}}
</div>
<div class="changelog"></div>
{{#files}}
<div class="items-group">
<div class="title">Game Items Included</div>
{{#GAME}}
<div class="item"><span class="filesize">{{size}}</span><span class="filename">{{name}}</span></div>
{{/GAME}}
</div>
{{#if PATCHES}}
<div class="items-group">
<div class="title">Patch/Other Items Included</div>
{{#PATCHES}}
<div class="item"><span class="filesize">{{size}}</span><span class="filename">{{name}}</span></div>
{{/PATCHES}}
</div>
{{/if}}
{{#if GOODIES}}
<div class="items-group">
<div class="title">Goodies Included</div>
{{#GOODIES}}
<div class="item"><span class="filesize">{{size}}</span><span class="filename">{{name}}</span></div>
{{/GOODIES}}
</div>
{{/if}}
{{/files}}
{{^files}}
<div class="items-group">
<div class="item">No files found.</div>
</div>
{{/files}}
</div>
</div>
</script>
<script src="static/js/ZeroFrame.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/3.3.0/fuse.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.12/handlebars.min.js"></script>
<script>
(function() {
class ZeroGod extends ZeroFrame {
loadPage(slug, addState){
var _this = this;
console.info(slug);
// Get json for game
this.cmd('fileGet', {inner_path: 'pages/'+slug+'.json', format: 'text'}, function(data) {
if (data) {
data = JSON.parse(data);
_this.renderGame(data);
if (addState) {
_this.cmd('wrapperPushState', [{page: slug}, data.game.title+" | Good Old Downloads", slug]);
}
_this.cmd("wrapperSetTitle", data.game.title+" | Good Old Downloads");
} else {
console.info('404');
// Show 404 if error
document.getElementById('main-shit').innerHTML = '404';
}
});
}
renderGame(data){
// replace #main-shit with game
// Migrate from mustache
var template = document.getElementById('game-template').innerHTML;
template = Handlebars.compile(template);
document.getElementById('main-shit').innerHTML = template(data);
}
onRequest(cmd, message) {
if (cmd == "wrapperPopState") {
if (message.params.state) {
console.log(message.params.state);
ZGod.loadPage(message.params.state.page, false);
}
} else {
this.log("Unknown request", message);
}
}
renderSearch(data) {
var output = '';
document.querySelector("#zerosearch-wrap").innerHTML = '';
for (var i = 0; i < data.length; i++) {
var game = data[i];
output += '<li><a class="zero-result" data-slug="'+game.slug+'" href="#">'+game.title+'</a></li>';
}
document.querySelector("#zerosearch-wrap").innerHTML = '<ul>'+output+'</ul>';
}
}
var ZGod = new ZeroGod();
var fuse, gamesJSON;
// Load games.json and store it in the gamesJSON variable
ZGod.cmd('fileGet', {inner_path: 'games.json', format: 'text'}, function(data) {
gamesJSON = JSON.parse(data);
fuse = new Fuse(gamesJSON, {
shouldSort: true,
threshold: 0.6,
location: 0,
distance: 50,
maxPatternLength: 32,
minMatchCharLength: 2,
keys: ["title"]
});
});
// If param is a game page then load it
var urlPath = window.location.search.replace(/(\?|&)wrapper_nonce.+/, '');
if (urlPath) {
ZGod.loadPage(urlPath.replace('?',''), false);
}
// Override search bar
document.addEventListener('input', function(evt) {
if (evt.target.matches('#search-bar, #search-bar *')) {
evt.preventDefault();
evt.stopPropagation();
var searchBar = evt.target.closest('input[type="search"]');
searchResults = fuse.search(searchBar.value);
ZGod.renderSearch(searchResults.slice(0, 5));
}
});
document.addEventListener('click', function(evt) {
// Links toggle button
if (evt.target.matches('.btn.toggle-links')) {
document.querySelector('.items-links-block').classList.toggle('open');
}
// Clicking a game ffrom search
if (evt.target.matches('a.zero-result')) {
evt.preventDefault();
console.log(evt.target);
ZGod.loadPage(evt.target.dataset.slug, true);
document.querySelector("#zerosearch-wrap").innerHTML = '';
}
});
// Hitting enter goes to first result
document.addEventListener('submit', function(evt) {
if (evt.target && evt.target.id === 'search-bar') {
evt.preventDefault();
evt.stopPropagation();
if (searchResults.length > 0) {
ZGod.loadPage(searchResults[0].slug, true);
document.querySelector("#zerosearch-wrap").innerHTML = '';
}
}
});
}).call(this);
</script>
</body>
</html>