forked from haxtheweb/haxcms-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.html
388 lines (371 loc) · 13.3 KB
/
next.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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="HAXCMS" />
<meta
name="viewport"
content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes"
/>
<title>HAXCMS site list</title>
<meta name="description" content="My HAXCMS site description" />
<base href="/" />
<link rel="icon" href="assets/favicon.ico" />
<link rel="manifest" href="manifest.json" />
<meta name="theme-color" content="#37474f" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="application-name" content="My site" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta
name="apple-mobile-web-app-status-bar-style"
content="black-translucent"
/>
<meta name="apple-mobile-web-app-title" content="My App" />
<link rel="apple-touch-icon" href="assets/icon-48x48.png" />
<link rel="apple-touch-icon" sizes="72x72" href="assets/icon-72x72.png" />
<link rel="apple-touch-icon" sizes="96x96" href="assets/icon-96x96.png" />
<link
rel="apple-touch-icon"
sizes="144x144"
href="assets/icon-144x144.png"
/>
<link
rel="apple-touch-icon"
sizes="192x192"
href="assets/icon-192x192.png"
/>
<meta name="msapplication-TileImage" content="assets/icon-144x144.png" />
<meta name="msapplication-TileColor" content="#37474f" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@elmsln" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="books-app" />
<meta property="og:image" content="assets/icon-144x144.png" />
<link rel="preconnect" crossorigin href="https://fonts.googleapis.com" />
<link rel="preconnect" crossorigin href="https://cdnjs.cloudflare.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap"
rel="stylesheet"
/>
<script>
// local development and mobx
window.process = window.process || {
env: {
NODE_ENV: "development"
}
};
</script>
<style>
body {
margin: 0;
padding: 0;
font-family: 'Press Start 2P', sans-serif;
overflow-x: hidden;
background-image: url('node_modules/@lrnwebcomponents/app-hax/lib/assets/images/LMGridBox.svg');
background-repeat: repeat;
background-position: center center;
background-size: auto, 20% auto, 20% auto;
--app-hax-accent-color: black;
--app-hax-background-color: white;
--simple-tooltip-background: #000000;
--simple-tooltip-opacity: 1;
--simple-tooltip-text-color: #ffffff;
--simple-tooltip-delay-in: 0;
--simple-tooltip-duration-in: 200ms;
--simple-tooltip-duration-out: 0;
--simple-tooltip-border-radius: 0;
--simple-tooltip-font-size: 14px;
}
body.app-hax-create {
overflow: hidden;
}
body.dark-mode {
background-color: black;
background-image: url('node_modules/@lrnwebcomponents/app-hax/lib/assets/images/DMGridBox.svg');
--app-hax-accent-color: white;
--app-hax-background-color: black;
}
body.app-loaded {
background-image: url('node_modules/@lrnwebcomponents/app-hax/lib/assets/images/LMGridBox.svg'), url('node_modules/@lrnwebcomponents/app-hax/lib/assets/images/DesignLightModeLeft.svg'), url('node_modules/@lrnwebcomponents/app-hax/lib/assets/images/DesignLightModeRight.svg');
background-repeat: repeat, repeat-y, repeat-y;
background-position: center center, top left, top right;
background-size: auto, 20% auto, 20% auto;
}
div[slot="externalproviders"] {
display: none;
}
body.app-loaded div[slot="externalproviders"] {
display: unset;
}
body.app-loaded.dark-mode {
background-image: url('node_modules/@lrnwebcomponents/app-hax/lib/assets/images/DMGridBox.svg'), url('node_modules/@lrnwebcomponents/app-hax/lib/assets/images/DesignDarkModeLeft.svg'), url('node_modules/@lrnwebcomponents/app-hax/lib/assets/images/DesignDarkModeRight.svg');
}
#loading {
font-family: 'Press Start 2P', sans-serif;
text-align: center;
margin-top: 100px;
}
#loading .title {
-webkit-text-stroke: 1px
var(--app-hax-accent-color, var(--accent-color));
-webkit-text-fill-color: var(
--app-hax-background-color,
var(--background-color)
);
font-weight: normal;
font-size: 4vw;
display: inline-flex;
align-items: center;
}
#loading .subtitle {
color: var(--app-hax-accent-color, var(--accent-color));
font-weight: normal;
margin-top: 2.5px;
font-size: 2vw;
}
#loading .bracket {
font-size: 10vw;
font-weight: normal;
vertical-align: middle;
-webkit-text-stroke: 0px;
-webkit-text-fill-color: var(
--app-hax-accent-color,
var(--accent-color)
);
}
@media (min-width: 721px) {
:root {
background-size: auto, 23% auto, 23% auto;
}
}
@media (min-width: 601px) and (max-width: 720px) {
:root {
background-size: auto, 26% auto, 26% auto;
}
}
@media (min-width: 481px) and (max-width: 600px) {
:root {
background-size: auto, 30% auto, 30% auto;
}
}
@media (min-width: 371px) and (max-width: 480px) {
:root {
background-size: auto, 35% auto, 35% auto;
}
}
@media (max-width: 370px) {
:root {
background-size: auto, 37% auto, 37% auto;
}
}
.version {
position: fixed;
left: 0;
bottom: 0;
background-color: var(--simple-colors-default-theme-yellow-6);
display: inline-block;
padding: 8px;
color: var(--simple-colors-default-theme-grey-12);
border-right: 3px solid var(--simple-colors-default-theme-grey-12);
border-top: 3px solid var(--simple-colors-default-theme-grey-12);
}
body.dark-mode .version {
background-color: var(--simple-colors-default-theme-yellow-8);
color: var(--simple-colors-default-theme-grey-1);
border-right: 3px solid var(--simple-colors-default-theme-grey-1);
border-top: 3px solid var(--simple-colors-default-theme-grey-1);
}
simple-modal::part(title) {
background-color: transparent;
margin: 0;
padding: 0;
text-align: center;
font-size: 20px;
line-height: 20px;
color: black;
}
simple-modal button.hax-modal-btn {
font-size: 30px;
padding: 8px;
margin: 4px;
color: white;
background-color: green;
border: 4px solid black;
border-radius: 8px;
font-family: 'Press Start 2P', sans-serif;
}
simple-modal button.hax-modal-btn.cancel {
background-color: red;
}
simple-modal button.hax-modal-btn:hover,
simple-modal button.hax-modal-btn:focus {
outline: 2px solid black;
cursor: pointer;
background-color: darkgreen;
}
simple-modal button.hax-modal-btn.cancel:hover,
simple-modal button.hax-modal-btn.cancel:focus {
background-color: darkred;
}
</style>
</head>
<body>
<script>
// reduce FOUC for dark mode so it starts in dark rapidly if selected
if (window.localStorage && window.localStorage.getItem('app-hax-darkMode')) {
if (window.localStorage.getItem('app-hax-darkMode') == 'true') {
document.body.classList.add('dark-mode');
}
else {
document.body.classList.remove('dark-mode');
}
}
window.WCAutoloadRegistryFile = "./wc-registry.json";
// set this in order to simulate the published form of the site
// window.HAXCMSContext="published";
// set the below to simulate running a demo / end points to load data
// this will let you simulate more operations without having a backend
window.HAXCMSContext="demo";
window.appSettings = {
demo: true,
getSitesList: 'dist\/sites.json',
createSite: "dist\/dev\/createSite.json",
login: "dist\/dev\/login.json",
connectionSettings: "dist\/dev\/connectionSettings.json",
refreshUrl: "dist\/dev\/refreshUrl.json",
logout: "dist\/dev\/logout.json",
saveNodePath: "dist\/dev\/saveNode.json",
getConfigPath: "dist\/dev\/getConfigPath.json",
saveManifestPath: "dist\/dev\/saveNode.json",
setConfigPath: "dist\/dev\/saveNode.json",
getUserDataPath: "dist\/dev\/userData.json",
setUserPhotoPath: "dist\/dev\/setUserPhotoPath.json",
createNodePath: "dist\/dev\/saveNode.json",
createNewSitePath: "dist\/dev\/createSite.json",
deleteNodePath: "dist\/dev\/saveNode.json",
saveOutlinePath: "dist\/dev\/saveNode.json",
publishSite: "dist\/dev\/publishSite.json",
downloadSite: "dist\/dev\/downloadSite.json",
deleteSite: "dist\/dev\/deleteSite.json",
copySite: "dist\/dev\/copySite.json",
archiveSite: "dist\/dev\/archiveSite.json",
appStore: {
url: "dist\/dev\/appstore.json"
}
};
// need to fetch theme config dynamically...
var configJson, themeCoreJson;
fetch("_config/config.json")
.then(function(response) {
return response.json();
})
.then(function(myJson) {
configJson = myJson;
return myJson;
});
// core location
fetch("system/coreConfig/themes.json")
.then(function(response) {
return response.json();
})
.then(function(myJson) {
themeCoreJson = myJson;
return myJson;
});
//Function to make it easier
Array.prototype.random = function() {
return this[Math.floor((Math.random() * this.length))];
};
// fake an async
setTimeout(() => {
// combine so they are there for review just like a real backend would present
const blueStyle = 'node_modules/@lrnwebcomponents/app-hax/lib/assets/images/BlueStyle.svg';
const greyStyle = 'node_modules/@lrnwebcomponents/app-hax/lib/assets/images/GreyStyle.svg';
const partyStyle = 'node_modules/@lrnwebcomponents/app-hax/lib/assets/images/PartyStyle.svg';
const themes = Object.assign(
{},
themeCoreJson,
configJson.themes
);
Object.keys(themes).forEach((index) => {
themes[index].thumbnail = [partyStyle,greyStyle,blueStyle].random();
});
window.appSettings.themes = themes;
}, 100);
</script>
<div id="loading">
<div class="title">
<span class="bracket"><</span>Loading..<span class="bracket">></span>
</div>
<div class="subtitle">HAX is loading</div>
</div>
<app-hax base-path="/" token="thingsAndStuff">
</app-hax>
<div class="version">V4.1.0</div>
<div id="demo">
<style>
#demobtns {
bottom: 0;
left: 0;
position: fixed;
}
#demobtns button {
font-size: 30px;
border: 2px solid black;
margin: 2px;
background-color: orange;
cursor: pointer;
color: black;
display: block;
}
#demobtns button:hover {
background-color: red;
}
</style>
<div id="demobtns">
<button id="nosites">Test new user</button>
<button id="test404">Test 404</button>
<button id="resetbtn">reset app</button>
</div>
<script>
// reduce FOUC for dark mode so it starts in dark rapidly if selected
if (window.localStorage && window.localStorage.getItem('app-hax-darkMode')) {
if (window.localStorage.getItem('app-hax-darkMode') == 'true') {
document.body.classList.add('dark-mode');
}
else {
document.body.classList.remove('dark-mode');
}
}
// remove loading text
window.addEventListener('app-hax-loaded',(e) => {
dqs("#loading").remove();
});
function dqs(sel) { return document.querySelector(sel)}
dqs("#nosites").addEventListener("click", (e) => {
// reset to clear internal state
dqs("app-hax").reset(false);
// fake injection of a new site listing location
window.AppHax.requestAvailability().store.appSettings.getSitesList = 'demo/sitesEmpty.json';
});
dqs("#test404").addEventListener("click", (e) => {
window.location = "nothin9383832";
});
dqs("#resetbtn").addEventListener("click", (e) => {
dqs("app-hax").reset(true);
});
</script>
</div>
<noscript>Please enable JavaScript to view this website.</noscript>
<script src="node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>
<script
async
src="node_modules/web-animations-js/web-animations-next-lite.min.js"
></script>
<script type="module">
import '@lrnwebcomponents/app-hax/app-hax.js';
</script>
</body>
</html>