-
Notifications
You must be signed in to change notification settings - Fork 96
/
index.html
533 lines (452 loc) · 17.5 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
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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html;">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<title>LocalSite Parameters</title>
<style>
body {
margin: 0;
}
</style>
<!-- javascript included early for use by swiper -->
<script type="text/javascript" src="/localsite/js/jquery.min.js" id="/localsite/js/jquery.min.js"></script>
<script type="text/javascript" src="/localsite/js/localsite.js?showheader=true&showsearch=true"></script>
</head>
<body>
<!-- Swiper and Plyr -->
<style>
.slideTextBox {
text-align: left;
position: absolute;
left: 80px;
top: 90px;
background-color: rgba(250,250,256,.85);
padding: 30px 20px 12px 30px;
overflow: scroll;
border-radius: 20px;
max-height: 74%;
max-width: 350px;
}
.dark .slideTextBox {
color: #333;
}
.slideText {
position:absolute;
color: #fff;
font-size: 18px;
background-color: rgba(33,33,33,0.6);
border-radius: 30px;
padding: 30px 40px 30px 40px;
}
.slideTextLeft {
text-align: left;
left: 80px;
top: 90px;
}
.slideTextRight {
text-align: left;
border-radius: 0px;
border-top-left-radius: 30px;
border-bottom-left-radius: 30px;
right: 0px;
bottom: 0px;
z-index: 99999;
}
.swiper-slide .imgcrop { /* could also use: .swiper-slide img */
opacity: 0.9;
min-width: 100%;
min-height: 100%;
object-fit: cover;
}
/* Add an icon and script to add class .fullimage to swiper-slide to override .imgcrop above. */
.swiper-slide.fullimage {
min-width: inherit;
min-height: inherit;
object-fit: none;
}
.swiper-slide-container {
margin: 0px auto;
width:100%;
height:100%;
}
.swiper-slide-container iframe {
object-fit: cover;
}
/* Move play button lower right */
/*
.swiper-button-play, .swiper-button-pause {
background-position: right 0px bottom 10px !important;
}
.swiper-button-next {
height: auto !important;
bottom: 85px !important;
}
*/
.plyr {
height: 100%;
margin-top: -4px;
}
</style>
<!--
Swiper responds to keyboard arrows and swipes on mobile.
Notes:
Width:100% currently has to be included on the a href tag to prevent margins if image width is exceeded.
Set the height:100% on div within swiper-slide
text-align:left; overflow:scroll;
-->
<link rel="stylesheet" href="/localsite/css/swiper/swiper-bundle.min.css" />
<link rel='stylesheet' href='/localsite/css/swiper/plyr.css'>
<!--
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper/swiper-bundle.min.css">
-->
<link rel='stylesheet' href='/localsite/css/swiper/swiper.css'>
<script src='/localsite/js/polyfill.min.js?features=es6,Array.prototype.includes,CustomEvent,Object.entries,Object.values,URL'></script>
<script src='/localsite/js/plyr.min.js'></script>
<!-- data-id="sample1" -->
<!-- background: #000; background-color: #000; -->
<div class="swiper-container" style="overflow:hidden;" id="sample1">
<div class="swiper-wrapper">
<!-- Slide 1 -->
<!-- /localsite/img/hero/future-teepee.png -->
<div class="swiper-slide" data-hash="explore">
<img class="imgcrop" src="/localsite/img/hero/daisy.png">
<!-- Oddly the loader icon appears when clicking back to the first slide
(when intended pause occurs), so we omit loading icon here. -->
<!--<div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div>-->
<div class="slideText" style="top:48%">
<b>Edit Localsite Parameters</b><br>
Scroll down to view localsite parameters that you can add to your HTML pages.
</div>
</div>
<!-- Slide 2 -->
<div class="swiper-slide" data-hash="plant">
<!-- Also leave off lazy on the second to avoid loading icon. -->
<img class="imgcrop" src="/localsite/img/hero/plant.png" style="opacity:0.9;">
<div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div>
<div class="slideText" style="position:absolute; bottom:-20px; right: 0px; z-index:999999999">
Copy our starter index.html.
</div>
</div>
<!-- Slide 3 -->
<div class="swiper-slide" fetchpriority="low" data-hash="2to1-ratio" style="position: relative;">
<img class="imgcrop" loading="lazy" src="/localsite/img/hero/2to1-ratio.png" style="opacity:0.9;width:100%;max-width:2000px">
<div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div>
<div class="slideText" style="position:absolute; bottom:-20px; right: 0px; z-index:999999999">
Add your parameters
</div>
</div>
<!-- Slide 4 -->
<div class="swiper-slide" fetchpriority="low" data-hash="sun">
<!-- Example of smaller: solar-rect-sm.png -->
<!--img class="swiper-lazy swiper-blur" src="/localsite/img/hero/solar-rect.png" style="width:100%;max-width:2000px;"-->
<img class="imgcrop" loading="lazy" src="/localsite/img/hero/solar-rect.png">
<div class="swiper-lazy-preloader swiper-lazy-preloader-white" style="position: relative; border: 10px solid red;"></div>
<div class="slideText slideTextRight">
Tall cropped image example
</div>
</div>
<!-- Slide 5: A Walkable Street -->
<div class="swiper-slide" fetchpriority="low" data-hash="communities">
<!--img class="swiper-lazy swiper-blur" src="/localsite/img/hero/sustainable-communities.jpg" style="width:100%;max-width:2000px;"-->
<img class="imgcrop" loading="lazy" src="/localsite/img/hero/sustainable-communities.jpg" style="opacity:0.9;width:100%;max-width:3000px">
<div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div>
<div class="slideText slideTextLeft"><!-- also a css class called .box in css/swiper/swiper.css -->
<div class="title">Title</div>
<!-- data-swiper-parallax="-200" -->
<div class="subtitle">Subtitle</div>
</div>
</div>
<!-- Slide 6: Video -->
<div class="swiper-slide" data-hash="tilford-yard">
<div class="swiper-slide-container">
<div id="player1" data-plyr-provider="youtube" data-plyr-embed-id="oV2_YtrqgyQ"></div>
</div>
<script>
player = new Plyr('#player1', {autopause:'true',hideControls:'true'});
player.on('ended', function(event) {
player.restart(); // To avoid seeimg menu of other videos.
// player.play(); // infinite loop
});
/*
// Probably swith to array of players
players[0].on('ended', function(event) {
players[0].restart();
// players[0].play(); // infinite loop
});
*/
window.player = player;
</script>
<div class="slideTextBox">
<div class="title">Tilford Yard</div>
<div class="subtitle" data-swiper-parallax="-200"></div>
<div class="text" data-swiper-parallax="-100">
<p>Located northwest of Atlanta, Tilford Yard has been transformed by new residential construction along the Beltline trail.<br><br>
</p>
</div>
</div>
</div>
</div>
<!--
Not using noSwipingClass. Didn't work yet for limiting verticle scroll when mousewheel:true. Remove noSwipingClass.
-->
<!-- Swiper Nav -->
<div class="swiper-button-prev swiper-button-prev-sample1 swiper-no-swiping noSwipingClass">
<!--<div class="swiper-button-white"></div>-->
</div>
<!--
<div class="swiper-button-play swiper-button-play-sample1"></div>
<div class="swiper-button-pause swiper-button-pause-sample1"></div>
-->
<div class="swiper-button-next swiper-button-next-sample1 swiper-no-swiping noSwipingClass">
<!--<div class="swiper-button-white"></div>-->
</div>
<!-- /Swiper Nav-->
</div>
<!-- Swiper Pagination -->
<div style="width:94%"><!-- bug -->
<div style="position:relative;float:right;">
<div class="swiper-button-play swiper-button-play-lower swiper-button-play-sample1" style="display:none"></div>
<div class="swiper-button-pause swiper-button-pause-lower swiper-button-pause-sample1" style="display:none"></div>
</div>
<div style="overflow: auto;">
<div class="swiper-pagination swiper-pagination-sample1" style="margin-top:15px;"></div>
</div>
</div>
<!-- /Swiper Pagination -->
<!--
To avoid 404 warning in inspector:
Downloaded and renamed swiper.min.js.map to swiper-bundle.min.js.map
Haven't yet confirmed that's the correct file to use, but reolved 404 error.
-->
<script src="/localsite/js/swiper/swiper-bundle.min.js"></script>
<!--
<script src="https://cdn.jsdelivr.net/npm/swiper/swiper-bundle.min.js"></script>
-->
<!-- Initialize Swiper -->
<script>
// Init multiple slider on a single page
// https://stackoverflow.com/questions/32118999/how-can-i-have-multiple-swiper-slideshows-on-a-single-page
// Function that builds the swiper
/*
lazy: {
loadPrevNext: true,
},
*/
const buildSwiperSlider = sliderElm => {
const sliderIdentifier = sliderElm.id;
const homeSwiper = new Swiper(`#${sliderElm.id}`, {
slidesPerView: 1,
spaceBetween: 0,
loop: true,
speed: 800, /* transition 1400 */
slidesPerView: 'auto',
lazy: true,
navigation: {
nextEl: '.swiper-button-next-' + sliderIdentifier,
prevEl: '.swiper-button-prev-' + sliderIdentifier
},
pagination: {
el: '.swiper-pagination-' + sliderIdentifier,
clickable: true,
},
effect: 'fade',
mousewheelX: true, // Avoiding because also invokes verticle scroll on desktop.
releaseOnEdgesX: true,
/* Change hash value as images changes (and load based on hash) */
/*
BIG PROBLEM: overwrites other hash values, immediatly close upperright navigation. */
/* also causes favicon to reload */
/*
hashNavigation: {
watchState: true,
},
*/
keyboard: {
enabled: true,
onlyInViewport: false
},
directionX: 'horizontal',
/*
history: {
keepQuery: true
},
// Could see if any of these are supported by Slider 10.0
watchSlidesProgress: true, // enable the 'proress' property on each slide
virtualTranslate: true, // makes the slider not move automatically, you'll have to do the translate animation
watchSlidesVisibility: true, // slides that in viewport will have additional visible class
effect: "myCustomTransition", // optional - set the name of your animation. You can later check if your animation is actually applied and abort animation if not.
*/
});
$(".swiper-button-pause-" + sliderIdentifier).click(function(){
$(".swiper-button-pause-" + sliderIdentifier).hide();
$(".swiper-button-play-" + sliderIdentifier).show();
$(".swiper-button-pause-" + sliderIdentifier).addClass("overrideShowPauseQuick");
homeSwiper.autoplay.stop(); // Tiggers icon change below at autoplayStop event
});
$(".swiper-button-play-" + sliderIdentifier).click(function(){
homeSwiper.slideNext(); // Immidiately advance to next on click.
$(".swiper-button-play-" + sliderIdentifier).hide();
$(".swiper-button-pause-" + sliderIdentifier).show();
homeSwiper.autoplay.start();
});
$(".swiper-pagination-" + sliderIdentifier + " .swiper-pagination-bullet").click(function(){
$(".swiper-button-pause-" + sliderIdentifier).hide();
$(".swiper-button-play-" + sliderIdentifier).show();
});
$(".swiper-button-prev-" + sliderIdentifier).click(function(){
$(".swiper-button-pause-" + sliderIdentifier).hide();
$(".swiper-button-play-" + sliderIdentifier).show();
});
$(".swiper-button-next-" + sliderIdentifier).click(function(){
$(".swiper-button-pause-" + sliderIdentifier).hide();
$(".swiper-button-play-" + sliderIdentifier).show();
});
homeSwiper.on('autoplayStart', function () {
//$(".swiper-pagination-bullet-active").css("background","green");
$('head').append('<style id="customCSS">.swiper-pagination-bullet-active { background:green !important }</style>');
});
// Triggered by keyboard arrow keys and pause button:
homeSwiper.on('autoplayStop', function () {
//$(".swiper-pagination-bullet-active").css("background","#888");
$('#customCSS').remove();
// Briefly show the pause button
$(".swiper-button-pause-" + sliderIdentifier).show();
$(".swiper-button-pause-" + sliderIdentifier).addClass("showPauseQuick");
//alert("stop")
setTimeout(() => {
$(".swiper-button-pause-" + sliderIdentifier).hide();
$(".swiper-button-pause-" + sliderIdentifier).removeClass("showPauseQuick"); // to do: figure out why not fading
$(".swiper-button-pause-" + sliderIdentifier).removeClass("overrideShowPauseQuick"); // Allows pause not to be retained briefly when clicking actual pause button.
},1000);
$(".swiper-button-play-" + sliderIdentifier).show();
});
// Play on iniital load
$(".swiper-button-play-" + sliderIdentifier).hide();
$(".swiper-button-pause-" + sliderIdentifier).show();
homeSwiper.autoplay.start();
//return homeSwiper;
}
// Get all of the swipers on the page
const allSliders = document.querySelectorAll('.swiper-container');
// Loop over all of the fetched sliders and apply Swiper on each one.
allSliders.forEach(slider => buildSwiperSlider(slider));
//$(".swiper-button-play").show();
//$(".swiper-button-play").css('opacity', '0.8');
let initIDX = 0;
if(window.location.hash){
let lmnt = document.querySelector('[data-hash="'+window.location.hash.substring(1)+'"]'),
i = 0;
while((lmnt = lmnt.previousSibling) != null) if(lmnt.nodeType == 1) ++i;
initIDX = i;
}
var vis = document.getElementById('vis'),
swiperOpts = {
loop: true,
slidesPerView: 1,
initialSlide: initIDX,
on:{
slideChangeTransitionEnd: function(){
history.replaceState(null, null,
window.location.pathname + '#' + this.slides[this.activeIndex].dataset.hash);
}
}
},
swiper = new Swiper(vis, swiperOpts);
</script>
<!-- /Initialize Swiper -->
<!-- /Swiper and Plyr -->
<style>
#readmeDiv H1{
display: none;
}
.pageColumnStyle H1, .pageColumnStyle H2 {
font-family: Raleway, Lato, "Helvetica Neue", Helvetica, "Lato", sans-serif;
font-weight: 1000 !important;
margin-top: 0px;
font-size: 1.4em;
padding-top: 12px;
padding-bottom: 5px !important;
border-bottom: 1px solid #ddd;
color: rgb(77, 82, 89);
color: #333;
line-height: 1.55;
}
</style>
<div class="pageColumnStyle content contentpadding" style="padding-top: 0px">
<div style="float:right">
<!--
<a href="https://github.com/localsite/planning/blob/main/schema.prisma">Real World 2.0 Data Structure</a> - Common tables for civic tech apps
-->
<!--
<a href="https://nextjs.org">NextJS</a>, <a href="https://www.prisma.io">Prisma</a> and <a href="https://blitzjs.com">BlitzJS</a><br><br>
-->
</div>
<h1 style="padding-top: 0px">Localsite Parameters</h1>
<!--
Swiper demos:
https://swiperjs.com/demos
Also parallax:
https://codesandbox.io/s/empty-feather-sqgrj?file=/src/App.js
-->
Localsite uses <a href="https://swiperjs.com/">SwiperJS</a> with Leaflet Maps and the MapBox <a href="https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/">Layers JSON Format</a> to manage map layers in the map.js styleObject.
<section id="parameters">
<div id="paramsDiv" style="clear:both"></div>
</section>
<div class="two pageColumns">
<div class="pageColumn">
<div class="pageColumnInside">
<div id="readmeDiv"></div>
</div>
</div>
<div class="pageColumn">
<div class="pageColumnInside">
<div id="featuresDiv"></div>
</div>
</div>
</div>
<h2 style="clear:both">Browser LocalStorage</h2>
The following values reside in your browser's localStorage for persistance across site visits:<br><br>
<div id="displayStorage"></div>
<script>
// View localStorage values
for(var i=0, len=localStorage.length; i<len; i++) {
var key = localStorage.key(i);
var value = localStorage[key];
if (value.indexOf("<svg") > 0) {
$("#displayStorage").append("<b>" + key + ":</b> [svg]<br><br>");
} else {
$("#displayStorage").append("<b>" + key + ":</b> " + value + "<br><br>");
}
}
</script>
<div id="cookieList"></div>
<script>
function listCookies() {
var theCookies = document.cookie.split(';');
var aString = '';
for (var i = 0 ; i < theCookies.length; i++) {
console.log("theCookies[i] " + theCookies[i]);
var theCookVal = theCookies[i].split('=');
aString += '<b>' + theCookVal[0] + '</b> ' + theCookVal[1] + "<br>\n";
}
$(document).ready(function () {
$("#cookieList").html("<h2>Cookies</h2>" + aString);
});
}
if (location.host.indexOf('localhost') >= 0) {
listCookies();
}
</script>
</div>
<script>
loadMarkdown("README.md", "readmeDiv", "_parent");
loadMarkdown("start/features.md", "featuresDiv", "_parent");
loadMarkdown("start/params.md", "paramsDiv", "_parent");
</script>
<img loading="lazy" fetchpriority="low" src="/localsite/img/hero/stars.jpg" style="width:100%">
<div id="footer"></div>
</body>
</html>