-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
596 lines (540 loc) · 33.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
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
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
<!DOCTYPE html>
<html lang="en">
<style>
html, body {height:100%;}
body {
background-color: #efefef !important;
}
/*SIDEBAR*/
#catalogueSidebar {
transition: left .1s;
}
.header-sidebar{
padding: 16px;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.categories {
padding: 0 16px 16px;
}
.categories label {
margin: 8px 8px 0 0;
border-radius: 4px !important;
text-align: center !important;
}
.categories label:hover {
cursor: pointer;
}
.catalogue {
background-color: #fff;
width: 400px;
height: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 100;
box-shadow: 4px 0 8px 0 rgba(0, 0, 0, 0.1);
overflow-y: auto;
}
.catalogue .list-group-item {
margin-bottom: 10px;
}
.catalogue .list-group-item:hover{
background: #f2f2f2;
}
.list-group-item {
width: 100%;
}
.hideSidebar {
left: -500px;
}
/*PAGE*/
.welcome{
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.page-container{
display: flex;
flex-direction: row;
height: 100%;
}
#Page {
margin-top: 80px;
}
.page {
width: 100%;
overflow-y: scroll;
padding: 0;
}
.page .list-group-item {
border: none;
padding: 0;
}
.page .list-group-item:hover .buttonContainer{
display: flex;
}
.list-group-item:hover {
cursor: grab;
}
.list-group-item:active {
cursor: grabbing;
}
.buttonContainer {
position: absolute;
right: 10px;
top: 10px;
display: none;
flex-direction: row;
z-index: 1;
}
img {
transition: filter .1s;
left: 0;
top: 0;
width: 100%;
height: auto;
}
.page img:hover {
filter: brightness(0.8);
}
.category-item{
padding: 12px 20px;
}
.category-item:hover{
cursor: pointer;
}
</style>
<head>
<meta charset="UTF-8">
<title>Title</title>
<!-- <link href="https://borishof.client.bmw.kodixauto.ru/assets/css/dws.css" rel="stylesheet"> -->
</head>
<body>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<!-- Latest Sortable -->
<script src="https://raw.githack.com/SortableJS/Sortable/master/Sortable.js"></script>
<!-- Modal -->
<div class="modal fade" id="shareUrl" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title" id="exampleModalLabel">Ссылка на собранную страницу</h2>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" style="padding-bottom: 40px;">
<div>
<script>
var currentUrl = window.location.href;
var isParams = currentUrl.indexOf('?');
currentUrl = currentUrl.substring(0, isParams != -1 ? isParams : currentUrl.length);
var blocks = localStorage.getItem('blocks');
currentUrl += blocks ? '?blocks=' + localStorage.getItem('blocks') : '';
document.write('<input class="form-control" id="shareUrlInput" value="' + currentUrl + '">');
</script>
</div>
<div>
<button style="margin-top: 10px;" type="button" class="btn btn-light btn-sm" onclick="copyClipboard()">Скопировать в буфер</button>
</div>
</div>
</div>
</div>
</div>
<div style="box-shadow: 0 0 4px rgba(0,0,0,0.2); background-color: white; position: fixed; z-index: 10; width: 100%; height: 80px; display: flex; flex-direction: row; align-items: center; justify-content: space-between;">
<div><h3 style="color: #333; margin-top: 0; margin-bottom: 0; margin-left: 20px;">Конструктор страниц</h3></div>
<div style="display: flex;">
<div><button style="margin-right: 10px;" type="button" class="btn btn-outline-primary" onclick="showSidebar();">Добавить блок</button></div>
<div><button style="margin-right: 10px;" type="button" class="btn btn-outline-primary" data-toggle="modal" data-target="#shareUrl">Поделиться ссылкой</button></div>
<!-- <div><button style="margin-right: 20px;" type="button" class="btn btn-secondary" onclick="">Посмотреть результат</button></div> -->
</div>
</div>
<div id="catalogueSidebar" class="catalogue hideSidebar">
<div style="padding: 20px; display: flex; flex-direction: row; justify-content: space-between;">
<div>
<h3>Блоки</h3>
<p>Перетаскивайте блоки на страницу и сортируйте их в нужном порядке</p>
</div>
<div><button type="button" class="btn btn-light" onclick="hideSidebar();"><span aria-hidden="true">×</span></button></div>
</div>
<hr>
<div class="container">
<div id="Categories" class="row categories btn-group btn-group-toggle" data-toggle="buttons">
<label data-id="1" class="btn btn-outline-secondary shadow-none" style="text-align: left;">
<input type="radio" id="cat1">Технические блоки
</label>
<label data-id="2" class="btn btn-outline-secondary shadow-none" style="text-align: left;">
<input type="radio" id="cat2">Преимущества
</label>
<label data-id="3" class="btn btn-outline-secondary shadow-none" style="text-align: left;">
<input type="radio" id="cat3">Текстографические блоки
</label>
<label data-id="4" class="btn btn-outline-secondary shadow-none" style="text-align: left;">
<input type="radio" id="cat4">Карточки
</label>
<label data-id="5" class="btn btn-outline-secondary shadow-none" style="text-align: left;">
<input type="radio" id="cat5">Контакты
</label>
<label data-id="6" class="btn btn-outline-secondary shadow-none" style="text-align: left;">
<input type="radio" id="cat6">Обложки
</label>
<label data-id="7" class="btn btn-outline-secondary shadow-none" style="text-align: left;">
<input type="radio" id="cat7">Формы
</label>
<label data-id="8" class="btn btn-outline-secondary shadow-none" style="text-align: left;">
<input type="radio" id="cat8">Галерея
</label>
<label data-id="9" class="btn btn-outline-secondary shadow-none" style="text-align: left;">
<input type="radio" id="cat9">Кнопки
</label>
<label data-id="10" class="btn btn-outline-secondary shadow-none" style="text-align: left;">
<input type="radio" id="cat10">Модель
</label>
</div>
</div>
<hr>
<div class="container mb-5" >
<div id="Components" class="list-group">
</div>
</div>
</div>
<div style="display: flex; flex-direction: row; height: 100%;">
<div id="Page" class="list-group page mb-0" style="margin-bottom: 0;">
</div>
</div>
<div id="blockPreview" style="position: fixed; top: 20px; left: 420px; width: 400px; z-index: 10; background: transparent; "></div>
<script id="headerHTML" type="text/html">
</script>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script>
var catalogueSidebar = document.getElementById('catalogueSidebar');
var pageContainer = document.getElementById('Page');
let categories = document.getElementById('Categories');
let components = document.getElementById('Components');
let preview = document.getElementById('blockPreview');
categories.addEventListener('click', {handleEvent: showComponents});
function showComponents(event) {
let dataId = event.target.attributes[0].value;
let html = '';
switch (dataId) {
case '1':
html = '' +
'<div data-id="1" data-url="img/1024px_skoda_breadcrumbs.png" data-title="Хлебные крошки" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Хлебные крошки</div>' +
'<div data-id="22" data-url="img/1440px_skoda_footer.png" data-title="Подвал" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Подвал</div>' +
'<div data-id="32" data-url="img/1440px_skoda_header_01.png" data-title="Меню" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Меню</div>' +
'<div data-id="33" data-url="img/1440px_skoda_header_Mega_menu-cars.png" data-title="Модельный ряд в меню" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Модельный ряд в меню</div>' +
'<div data-id="34" data-url="img/1440px_skoda_header_Mega_menu-customer-text-buttons.png" data-title="CTA в меню" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">CTA в меню</div>' +
'<div data-id="35" data-url="img/1440px_skoda_header_Mega_menu-customer-text.png" data-title="Меню с категориями" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Меню с категориями</div>';
break;
case '2':
html = '' +
'<div data-id="2" data-url="img/1440px_skoda_advantages-1.png" data-title="Вкладки+Слайдер 1" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Вкладки+Слайдер 1</div>' +
'<div data-id="3" data-url="img/1440px_skoda_advantages-2.png" data-title="Вкладки+Слайдер 2" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Вкладки+Слайдер 2</div>' +
'<div data-id="4" data-url="img/1440px_skoda_advantages-3.png" data-title="Вкладки+Слайдер 3" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Вкладки+Слайдер 3</div>' +
'<div data-id="6" data-url="img/1440px_skoda_advantages_list-1.png" data-title="Список с преимуществами (1 колонка)" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Список с преимуществами (1 колонка)</div>' +
'<div data-id="7" data-url="img/1440px_skoda_advantages_list-2.png" data-title="Список с преимуществами (2 колонки)" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Список с преимуществами (2 колонки)</div>' +
'<div data-id="8" data-url="img/1440px_skoda_advantages_list-3.png" data-title="Список с преимуществами (простой)" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Список с преимуществами (простой)</div>' +
'<div data-id="9" data-url="img/1440px_skoda_advantages_list-4.png" data-title="Список с цифрами (светлый)" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Список с цифрами (светлый)</div>' +
'<div data-id="10" data-url="img/1440px_skoda_advantages_list-5.png" data-title="Список с цифрами (темный)" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Список с цифрами (темный)</div>' +
'<div data-id="11" data-url="img/1440px_skoda_advantages_list-6.png" data-title="Список с цифрами и иконками" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Список с цифрами и иконками</div>';
break;
case '3':
html = '' +
'<div data-id="5" data-url="img/1440px_skoda_advantages-4.png" data-title="Вкладки с ТГБ" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Вкладки с ТГБ</div>' +
'<div data-id="51" data-url="img/1440px_skoda_tgb-1.png" data-title="ТГБ горизонтальный 1" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">ТГБ горизонтальный 1</div>' +
'<div data-id="52" data-url="img/1440px_skoda_tgb-2.png" data-title="ТГБ горизонтальный 2" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">ТГБ горизонтальный 2</div>' +
'<div data-id="53" data-url="img/1440px_skoda_tgb-3.png" data-title="ТГБ горизонтальный 3" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">ТГБ горизонтальный 3</div>' +
'<div data-id="54" data-url="img/1440px_skoda_tgb-4.png" data-title="ТГБ вертикальный 1" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">ТГБ вертикальный 1</div>' +
'<div data-id="55" data-url="img/1440px_skoda_tgb-5.png" data-title="ТГБ вертикальный 2" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">ТГБ вертикальный 2</div>' +
'<div data-id="56" data-url="img/1440px_skoda_tgb-6.png" data-title="ТГБ вертикальный 3" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">ТГБ вертикальный 3</div>' +
'<div data-id="57" data-url="img/1440px_skoda_tgb-7.png" data-title="ТГБ вертикальный 4" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">ТГБ вертикальный 4</div>' +
'<div data-id="58" data-url="img/1440px_skoda_tgb-8.png" data-title="ТГБ вертикальный 5" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">ТГБ вертикальный 5</div>' +
'<div data-id="59" data-url="img/1440px_skoda_tgb_chess-1.png" data-title="ТГБ горизонтальный 4" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">ТГБ горизонтальный 4</div>' +
'<div data-id="60" data-url="img/1440px_skoda_tgb_chess-2.png" data-title="ТГБ горизонтальный 5" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">ТГБ горизонтальный 5</div>';
break;
case '4':
html = '' +
'<div data-id="12" data-url="img/1440px_skoda_article.png" data-title="1 вертикальная карточка (статья)" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">1 вертикальная карточка (статья)</div>' +
'<div data-id="13" data-url="img/1440px_skoda_cards vertical-1.png" data-title="2 вертикальные карточки" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">2 вертикальные карточки</div>' +
'<div data-id="14" data-url="img/1440px_skoda_cards vertical-2.png" data-title="3+ вертикальные карточки (слайдер)" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">3+ вертикальные карточки (слайдер)</div>' +
'<div data-id="15" data-url="img/1440px_skoda_cars Main page-1.png" data-title="Карточки моделей" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Карточки моделей</div>' +
'<div data-id="16" data-url="img/1440px_skoda_cars Main page-2.png" data-title="Карточки моделей с выгодами" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Карточки моделей с выгодами</div>' +
'<div data-id="44" data-url="img/1440px_skoda_news-1.png" data-title="Список новостей на сером" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Список новостей на сером</div>' +
'<div data-id="45" data-url="img/1440px_skoda_news-2.png" data-title="Список новостей на белом" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Список новостей на белом</div>';
break;
case '5':
html = '' +
'<div data-id="17" data-url="img/1440px_skoda_contacts-1.png" data-title="Контакты подробно" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Контакты подробно</div>' +
'<div data-id="18" data-url="img/1440px_skoda_contacts-2.png" data-title="Контакты кратко" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Контакты кратко</div>' +
'<div data-id="19" data-url="img/1440px_skoda_contacts-3.png" data-title="Карта" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Карта</div>' +
'<div data-id="50" data-url="img/1440px_skoda_staff.png" data-title="Контакты сотрудников" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Контакты сотрудников</div>';
break;
case '6':
html = '' +
'<div data-id="20" data-url="img/1440px_skoda_divider_v.1_dark copy 2.png" data-title="Перетяжка 1" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Перетяжка 1</div>' +
'<div data-id="21" data-url="img/1440px_skoda_divider_v.1_dark.png" data-title="Перетяжка 2" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Перетяжка 2</div>' +
'<div data-id="43" data-url="img/1440px_skoda_main_stage.png" data-title="Стейдж" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Стейдж</div>';
break;
case '7':
html = '' +
'<div data-id="23" data-url="img/1440px_skoda_form.png" data-title="Форма записи на сервис" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Форма записи на сервис</div>' +
'<div data-id="24" data-url="img/1440px_skoda_form_feedback.png" data-title="Форма обратной связи" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Форма обратной связи</div>' +
'<div data-id="25" data-url="img/1440px_skoda_form_request.png" data-title="Форма обратного звонка" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Форма обратного звонка</div>' +
'<div data-id="26" data-url="img/1440px_skoda_form_subscribe 002.png" data-title="Форма уточнения доп. информации" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Форма уточнения доп. информации</div>' +
'<div data-id="27" data-url="img/1440px_skoda_form_subscribe.png" data-title="Форма подписки на рассылку" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Форма подписки на рассылку</div>' +
'<div data-id="28" data-url="img/1440px_skoda_form_testdrive.png" data-title="Форма записи на тест-драйв" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Форма записи на тест-драйв</div>';
break;
case '8':
html = '' +
'<div data-id="29" data-url="img/1440px_skoda_galery_tile-1.png" data-title="Галерея 2x2" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Галерея 2x2</div>' +
'<div data-id="30" data-url="img/1440px_skoda_galery_tile-2.png" data-title="Галерея 2x3" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Галерея 2x3</div>' +
'<div data-id="31" data-url="img/1440px_skoda_galery_tile-3.png" data-title="Галерея 2x4" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Галерея 2x4</div>' +
'<div data-id="41" data-url="img/1440px_skoda_image-1.png" data-title="Картинка или баннер 1" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Картинка или баннер 1</div>' +
'<div data-id="42" data-url="img/1440px_skoda_image-2.png" data-title="Картинка или баннер 2" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Картинка или баннер 2</div>' +
'<div data-id="61" data-url="img/1440px_skoda_video-1.png" data-title="Видео 1" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Видео 1</div>' +
'<div data-id="62" data-url="img/1440px_skoda_video-2.png" data-title="Видео 2" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Видео 2</div>';
break;
case '9':
html = '' +
'<div data-id="36" data-url="img/1440px_skoda_iconsgroup-1.png" data-title="CTA кнопки - 2" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">CTA кнопки - 2</div>' +
'<div data-id="37" data-url="img/1440px_skoda_iconsgroup-2.png" data-title="CTA кнопки - 3" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">CTA кнопки - 3</div>' +
'<div data-id="38" data-url="img/1440px_skoda_iconsgroup-3.png" data-title="CTA кнопки - 4" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">CTA кнопки - 4</div>' +
'<div data-id="39" data-url="img/1440px_skoda_iconsgroup-4.png" data-title="CTA кнопки - 6" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">CTA кнопки - 6</div>' +
'<div data-id="40" data-url="img/1440px_skoda_iconsgroup-5.png" data-title="CTA кнопки - 4 с заголовком" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">CTA кнопки - 4 с заголовком</div>';
break;
case '10':
html = '' +
'<div data-id="46" data-url="img/1440px_skoda_showroom_complectation_octavia.png" data-title="Блок комплектации" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Блок комплектации</div>' +
'<div data-id="47" data-url="img/1440px_skoda_showroom_stage.png" data-title="Стейдж шоурума" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Стейдж шоурума</div>' +
'<div data-id="48" data-url="img/1440px_skoda_showroom_tech_octavia_default.png" data-title="Технические характеристики (свернуты)" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Технические характеристики (свернуты)</div>' +
'<div data-id="49" data-url="img/1440px_skoda_showroom_tech_octavia_open.png" data-title="Технические характеристики (открыты)" class="list-group-item" onmouseover="blockPreview(this)" onmouseout="blockPreviewRemove(this)">Технические характеристики (открыты)</div>';
break;
}
Components.innerHTML = html;
}
var imgUrl = [
'',
'img/1024px_skoda_breadcrumbs.png',
'img/1440px_skoda_advantages-1.png',
'img/1440px_skoda_advantages-2.png',
'img/1440px_skoda_advantages-3.png',
'img/1440px_skoda_advantages-4.png',
'img/1440px_skoda_advantages_list-1.png',
'img/1440px_skoda_advantages_list-2.png',
'img/1440px_skoda_advantages_list-3.png',
'img/1440px_skoda_advantages_list-4.png',
'img/1440px_skoda_advantages_list-5.png',
'img/1440px_skoda_advantages_list-6.png',
'img/1440px_skoda_article.png',
'img/1440px_skoda_cards vertical-1.png',
'img/1440px_skoda_cards vertical-2.png',
'img/1440px_skoda_cars Main page-1.png',
'img/1440px_skoda_cars Main page-2.png',
'img/1440px_skoda_contacts-1.png',
'img/1440px_skoda_contacts-2.png',
'img/1440px_skoda_contacts-3.png',
'img/1440px_skoda_divider_v.1_dark copy 2.png',
'img/1440px_skoda_divider_v.1_dark.png',
'img/1440px_skoda_footer.png',
'img/1440px_skoda_form.png',
'img/1440px_skoda_form_feedback.png',
'img/1440px_skoda_form_request.png',
'img/1440px_skoda_form_subscribe 002.png',
'img/1440px_skoda_form_subscribe.png',
'img/1440px_skoda_form_testdrive.png',
'img/1440px_skoda_galery_tile-1.png',
'img/1440px_skoda_galery_tile-2.png',
'img/1440px_skoda_galery_tile-3.png',
'img/1440px_skoda_header_01.png',
'img/1440px_skoda_header_Mega_menu-cars.png',
'img/1440px_skoda_header_Mega_menu-customer-text-buttons.png',
'img/1440px_skoda_header_Mega_menu-customer-text.png',
'img/1440px_skoda_iconsgroup-1.png',
'img/1440px_skoda_iconsgroup-2.png',
'img/1440px_skoda_iconsgroup-3.png',
'img/1440px_skoda_iconsgroup-4.png',
'img/1440px_skoda_iconsgroup-5.png',
'img/1440px_skoda_image-1.png',
'img/1440px_skoda_image-2.png',
'img/1440px_skoda_main_stage.png',
'img/1440px_skoda_news-1.png',
'img/1440px_skoda_news-2.png',
'img/1440px_skoda_showroom_complectation_octavia.png',
'img/1440px_skoda_showroom_stage.png',
'img/1440px_skoda_showroom_tech_octavia_default.png',
'img/1440px_skoda_showroom_tech_octavia_open.png',
'img/1440px_skoda_staff.png',
'img/1440px_skoda_tgb-1.png',
'img/1440px_skoda_tgb-2.png',
'img/1440px_skoda_tgb-3.png',
'img/1440px_skoda_tgb-4.png',
'img/1440px_skoda_tgb-5.png',
'img/1440px_skoda_tgb-6.png',
'img/1440px_skoda_tgb-7.png',
'img/1440px_skoda_tgb-8.png',
'img/1440px_skoda_tgb_chess-1.png',
'img/1440px_skoda_tgb_chess-2.png',
'img/1440px_skoda_video-1.png',
'img/1440px_skoda_video-2.png'
];
const WelcomeMess = '' +
'<div id="Welcome" style="height: 100%; display: flex; justify-content: center; align-items: center;">' +
'<div style="width:50%;">' +
'<h1 style="padding-bottom: 10px;">Это конструктор страниц вашего сайта.</h1>' +
'<h4 style="padding-bottom: 40px;">С помощью готовых блоков вы можете собрать любую из них: главная, страницы шоурума, новости и акции, контакты.</h4>' +
'<button type="button" class="btn btn-primary btn-lg" onclick="showSidebar();">Выбрать блоки</button>' +
'</div>' +
'</div>';
function showWelcomeMessage() {
pageContainer.innerHTML = WelcomeMess;
}
function createButtons(container) {
var upButton = document.createElement('div');
upButton.innerHTML = '<button class="btn btn-light" style="margin-right: 5px;" onclick="upList(this.parentNode.parentNode.parentNode)">Вверх</button>';
container.appendChild(upButton);
var downButton = document.createElement('div');
downButton.innerHTML = '<button class="btn btn-light" style="margin-right: 5px;" onclick="downList(this.parentNode.parentNode.parentNode)">Вниз</button>';
container.appendChild(downButton);
var delButton = document.createElement('div');
delButton.innerHTML = '<button class="btn btn-light" style="margin-right: 5px;" onclick="removeFromList(this.parentNode.parentNode.parentNode)">Удалить</button>';
container.appendChild(delButton);
}
var order = localStorage.getItem('blocks');
var orderArr = order ? order.split('|') : [];
Sortable.create(Components, {
// handle: '.glyphicon-move',
group: {
name: 'blocks',
pull: 'clone',
put: false,
},
sort: false,
animation: 150
});
var sPage = Sortable.create(Page, {
// handle: '.glyphicon-move',
group: {
name: 'blocks',
pull: false,
put: true,
},
animation: 150,
store: {
// /**
// * Get the order of elements. Called once during initialization.
// * @param {Sortable} sortable
// * @returns {Array}
// */
get: function (sortable) {
var order = localStorage.getItem(sortable.options.group.name);
return order ? order.split('|') : [];
},
// /**
// * Save the order of elements. Called onEnd (when the item is dropped).
// * @param {Sortable} sortable
// */
set: function (sortable) {
var order = sortable.toArray();
localStorage.setItem(sortable.options.group.name, order.join('|'));
// Update url
updateUrl();
}
},
onAdd: function (evt) {
var welcome = document.getElementById('Welcome')
if (welcome) {
welcome.remove();
}
evt.item.innerHTML = '';
evt.item.innerHTML = '<img src="' + evt.item.dataset.url + '">';
var buttonContainer = document.createElement('div');
var container = evt.item.appendChild(buttonContainer);
container.classList.add('buttonContainer');
createButtons(container);
}
});
// If we have something in local storage, show it
if (orderArr.length > 0) {
pageContainer.innerHTML = '';
for (var i = 0; i < orderArr.length; i++) {
let div = document.createElement('div');
div.classList.add('list-group-item');
div.setAttribute("data-id", orderArr[i]);
// div.setAttribute("name", name);
div.innerHTML = '<img src="' + imgUrl[orderArr[i]] + '">';
pageContainer.appendChild(div);
var buttonContainer = document.createElement('div');
var container = div.appendChild(buttonContainer);
container.classList.add('buttonContainer');
createButtons(container);
}
// and update url
updateUrl();
}
// Or, if not, show welcome message
else {
showWelcomeMessage();
}
function hideSidebar() {
catalogueSidebar.classList.add('hideSidebar');
}
function showSidebar() {
catalogueSidebar.classList.remove('hideSidebar');
}
function upList(node) {
if (node.previousElementSibling) {
node.parentNode.insertBefore(node, node.previousElementSibling);
sPage.options.store.set(sPage);
}
}
function downList(node) {
if (node.nextElementSibling) {
node.parentNode.insertBefore(node, node.nextElementSibling.nextElementSibling);
sPage.options.store.set(sPage);
}
}
function removeFromList(node) {
node.remove();
sPage.options.store.set(sPage);
var storage = localStorage.getItem('blocks');
if (!storage) {
showWelcomeMessage();
}
}
function copyClipboard() {
/* Get the text field */
var copyText = document.getElementById("shareUrlInput");
console.log(copyText);
/* Select the text field */
copyText.select();
/* Copy the text inside the text field */
document.execCommand("copy");
}
function updateUrl() {
var currentUrl = window.location.href;
var isParams = currentUrl.indexOf('?');
currentUrl = currentUrl.substring(0, isParams != -1 ? isParams : currentUrl.length);
var blocks = localStorage.getItem('blocks');
currentUrl += blocks ? '?blocks=' + localStorage.getItem('blocks') : '';
window.history.pushState('', 'Title', currentUrl);
}
function blockPreview(data){
let parentId = data.parentElement.getAttribute("id")
if(parentId === 'Components'){
preview.innerHTML = '<img src="' + data.getAttribute("data-url") + '" style="box-shadow: 0px 0px 39px -8px rgba(0,0,0,0.94);">';
}
}
function blockPreviewRemove() {
preview.innerHTML = '';
}
</script>
</body>
</html>