-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
357 lines (294 loc) · 14.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
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
<!DOCTYPE html>
<html>
<title>Talking Map</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script type="text/javascript" src="http://maps.stamen.com/js/tile.stamen.js?v1.3.0"></script>
<script type="text/javascript">(function(e){e.fn.extend({slimScroll:function(f){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},f);this.each(function(){function v(d){if(r){d=d||window.event;
var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&n(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function n(d,g,e){k=!1;var f=b.outerHeight()-c.outerHeight();g&&(g=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),g=Math.min(Math.max(g,0),f),g=0<d?Math.ceil(g):Math.floor(g),c.css({top:g+"px"}));l=parseInt(c.css("top"))/(b.outerHeight()-c.outerHeight());g=
l*(b[0].scrollHeight-b.outerHeight());e&&(g=d,d=g/b[0].scrollHeight*b.outerHeight(),d=Math.min(Math.max(d,0),f),c.css({top:d+"px"}));b.scrollTop(g);b.trigger("slimscrolling",~~g);w();p()}function x(){u=Math.max(b.outerHeight()/b[0].scrollHeight*b.outerHeight(),30);c.css({height:u+"px"});var a=u==b.outerHeight()?"none":"block";c.css({display:a})}function w(){x();clearTimeout(B);l==~~l?(k=a.allowPageScroll,C!=l&&b.trigger("slimscroll",0==~~l?"top":"bottom")):k=!1;C=l;u>=b.outerHeight()?k=!0:(c.stop(!0,
!0).fadeIn("fast"),a.railVisible&&m.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(B=setTimeout(function(){a.disableFadeOut&&r||y||z||(c.fadeOut("slow"),m.fadeOut("slow"))},1E3))}var r,y,z,B,A,u,l,C,k=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var q=b.scrollTop(),c=b.siblings("."+a.barClass),m=b.siblings("."+a.railClass);x();if(e.isPlainObject(f)){if("height"in f&&"auto"==f.height){b.parent().css("height","auto");b.css("height","auto");var h=b.parent().parent().height();b.parent().css("height",
h);b.css("height",h)}else"height"in f&&(h=f.height,b.parent().css("height",h),b.css("height",h));if("scrollTo"in f)q=parseInt(a.scrollTo);else if("scrollBy"in f)q+=parseInt(a.scrollBy);else if("destroy"in f){c.remove();m.remove();b.unwrap();return}n(q,!1,!0)}}else if(!(e.isPlainObject(f)&&"destroy"in f)){a.height="auto"==a.height?b.parent().height():a.height;q=e("<div></div>").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",
width:a.width,height:a.height});var m=e("<div></div>").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("<div></div>").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,
WebkitBorderRadius:a.borderRadius,zIndex:99}),h="right"==a.position?{right:a.distance}:{left:a.distance};m.css(h);c.css(h);b.wrap(q);b.parent().append(c);b.parent().append(m);a.railDraggable&&c.bind("mousedown",function(a){var b=e(document);z=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);n(0,c.position().top,!1)});b.bind("mouseup.slimscroll",function(a){z=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",
function(a){a.stopPropagation();a.preventDefault();return!1});m.hover(function(){w()},function(){p()});c.hover(function(){y=!0},function(){y=!1});b.hover(function(){r=!0;w();p()},function(){r=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(A=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&(n((A-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),A=b.originalEvent.touches[0].pageY)});
x();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),n(0,!0)):"top"!==a.start&&(n(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());window.addEventListener?(this.addEventListener("DOMMouseScroll",v,!1),this.addEventListener("mousewheel",v,!1)):document.attachEvent("onmousewheel",v)}});return this}});e.fn.extend({slimscroll:e.fn.slimScroll})})(jQuery);</script>
<style>
html,body,h1,h2,h3,h4,h5 {font-family: "Raleway", sans-serif}
.footer{
position:absolute;
bottom:0px;
width:100%;
height:40px;
}
.header{
-webkit-box-shadow: 0px 0px 6px 2px rgba(184,184,184,1);
-moz-box-shadow: 0px 0px 6px 2px rgba(184,184,184,1);
box-shadow: 0px 0px 6px 2px rgba(184,184,184,1);
}
.navigation{float:right;}
.nav-button{
width:150px;
box-shadow:0 8px 16px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19)
}
.nav-button:hover{
box-shadow:none;
}
.border-top{border-top: 1px solid #ccc;}
.slimScrollBar{
opacity: 0.2 !important;
}
body {
background-color: lightgrey;
}
</style>
<!-- This is your storymap-data -->
<script type="text/javascript" src="data/dummy.json"></script>
<!-- This is the styling-theme -->
<link rel="stylesheet" href="themes/emerald.css">
<body>
<header class="w3-container w3-theme header">
<span style="float:left"><h3 id="story-title"></h3></span>
<span class="navigation w3-padding">
<div id="pages" class="w3-bar">
</div>
</span>
</header>
<div>
<div class="w3-third story-wrapper w3-white">
<div id="story" class="story w3-margin-small">
<div class="story-titlebar"><div class="w3-padding"><h4 class="title w3-text-theme"></h4></div></div>
<div class="story-content"><div class="content w3-padding"></div></div>
</div>
</div>
<div class="w3-twothird map-wrapper w3-card"></div>
</div>
<footer class="footer w3-theme">
<div class="w3-padding">2017 | Martin Sudmanns | Powered by <a href="https://github.com/whisperingpixel/Talking-Map" target="_blank">Talking Maps</a></div>
</footer>
</body>
<script>
/*
* Defining global variables, including storage
*/
var current_page = -1;
var layout = null;
var storage = {};
function initialiseMap(){
return new L.map('map');
}
</script>
<script>
$(function(){
/*
* Set navigation buttons on top right corner
*/
$("#pages").append('<a href="#" id="page-back" class="w3-button w3-disabled page">«</a>');
for (var i=0;i<storymap.pages.length;i++){
$("#pages").append('<a href="#" class="w3-button page">'+(i+1)+'</a>');
}
$("#pages").append(' <a href="#" id="page-forward" class="w3-button page">»</a>');
$(".page").click(function(){
if ($(this).attr("id") == "page-back"){
var page = current_page -1;
setPage(page);
}else if($(this).attr("id") == "page-forward"){
var page = current_page + 1;
setPage(page);
}else{
var page = parseInt($(this).text()) - 1;
setPage(page);
}
});
/*
* Set storymap
*/
$("#story-title").text(storymap.title);
function setScollbar(){
$(".content").slimScroll({
height: ($(".story-content").height() -1) + "px",
scrollTo: 0
});
}
/*
* Change layout depending on the type of page
*/
function setLayout(){
if( layout == "text-only"){
$("#map").parent().addClass("w3-hide");
if ($(window).width() < 850){
/*
* If the screen is too small and we have a single text-page
* make it full width
*/
$("#story").parent()
.removeClass("w3-third")
.removeClass("w3-half")
.removeClass("w3-card")
.addClass("w3-rest")
.css({"margin-left":"0%"});
}else{
$("#story").parent()
.removeClass("w3-rest")
.addClass("w3-half")
.addClass("w3-card")
.css({"margin-left":"25%"});
}
}
if (layout == null || layout == "combined"){
$("#map").parent().removeClass("w3-hide");
$("#story").parent()
.addClass("w3-third")
.removeClass("w3-half")
.removeClass("w3-rest")
.removeClass("w3-card")
.css({"margin-left":"0%"});
}
layout == null;
}
/*
* Setting height and width
*/
function setHeightAndWidth(){
setLayout();
var content_height = $(window).height() - $(".header").height() - $(".footer").height();
$(".story-wrapper").height(content_height);
$(".story-content").height(content_height - $(".story-titlebar").height());
$(".map-wrapper").height(content_height);
$("#map").height(content_height - 1);
$("#map").width("100%");
if (storage.map != null){
storage.map.invalidateSize();
}
if ($("#nav-button-back").length != 0){
if ($(window).width() < 1050){
$("#nav-button-back")
.css({"width":"40px"})
.html("«")
.addClass("w3-round-xxlarge");
$("#nav-button-cont")
.css({"width":"40px"})
.html("»")
.addClass("w3-round-xxlarge");
}else{
$("#nav-button-back")
.css({"width":"100px"})
.html("Back")
.removeClass("w3-round-xxlarge");
$("#nav-button-cont")
.css({"width":"100px"})
.html("Continue")
.removeClass("w3-round-xxlarge");
}
if ($(window).width() < 700){
$("#nav-button-back").parent().removeClass("w3-margin");
}else{
$("#nav-button-back").parent().addClass("w3-margin");
}
}
setScollbar();
}
$(".map-wrapper").append('<div id="map"></div>');
setHeightAndWidth();
$(window).resize(function(){
setHeightAndWidth();
});
/*
* Set pages
*/
setPage(0);
/*
* Call the startup function
*/
storymap.startup();
/*
* Set pages
*/
function setPage(page){
/*
* cleanup storage and execute the cleanup function, if the
* user provides one
*/
if (current_page != -1){
if (storymap.pages[current_page].cleanupHook != null){
storymap.pages[current_page].cleanupHook();
}
}
var map_t = storage.map;
storage = {};
storage.map = map_t;
/*
* Set current page number as global variable
*/
current_page = page;
/*
* Set Page Layout
*/
layout = storymap.pages[page].layout;
/*
* Set content of the story and create scrollbar
*/
$("#story").find(".title").text(storymap.pages[page].title);
/*
* Set story
*/
$("#story").find(".content")
.html(storymap.pages[page].content)
.append('<div class="w3-margin w3-center border-top"><div id="nav-button-back" class="w3-btn w3-theme w3-margin nav-button">Back</div><div id="nav-button-cont" class="w3-btn w3-theme nav-button w3-margin ">Continue</div></div>');
/*
* Set map
*/
if (storymap.pages[page].map != null){
storymap.pages[page].map();
}
/*
* Set navigation buttons
*/
if(page == 0){
$("#page-back").addClass("w3-disabled");
$("#nav-button-back").addClass("w3-disabled");
}else{
$("#page-back").removeClass("w3-disabled");
$("#nav-button-back")
.removeClass("w3-disabled")
.click(function(){
setPage(current_page-1);
setHeightAndWidth();
});
}
if(page == (storymap.pages.length-1)){
$("#page-forward").addClass("w3-disabled");
$("#nav-button-cont").addClass("w3-disabled");
}else{
$("#page-forward").removeClass("w3-disabled");
$("#nav-button-cont")
.removeClass("w3-disabled")
.click(function(){
setPage(current_page+1);
});
}
/*
* Apply Styling
*/
$(".content").find("h3").addClass("w3-text-theme");
$(".content").find("h4").addClass("w3-text-theme");
$(".content").find("h5").addClass("w3-text-theme");
$(".content").find("h6").addClass("w3-text-theme");
$(".content").find("h7").addClass("w3-text-theme");
$("button").addClass("w3-button w3-block w3-round w3-margin-top w3-border-theme");
if (storymap.customStyling != null){
storymap.customStyling();
}
setHeightAndWidth();
}
});
</script>
</html>