Update pages.html
Browse files- pages.html +283 -520
pages.html
CHANGED
|
@@ -1,253 +1,50 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 25 |
-
<title>GrapesJS Project</title>
|
| 26 |
-
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet" />
|
| 27 |
-
<link href="index.css" rel="stylesheet" />
|
| 28 |
-
<script src="https://unpkg.com/grapesjs"></script>
|
| 29 |
-
<script src="https://unpkg.com/grapesjs-blocks-basic"></script>
|
| 30 |
-
<script src="https://unpkg.com/grapesjs-component-countdown"></script>
|
| 31 |
-
<script src="https://unpkg.com/grapesjs-parser-postcss"></script>
|
| 32 |
-
<link href="https://unpkg.com/grapesjs-component-code-editor/dist/grapesjs-component-code-editor.min.css" rel="stylesheet" />
|
| 33 |
-
<script src="https://unpkg.com/grapesjs-component-code-editor"></script>
|
| 34 |
-
<script src="https://unpkg.com/grapesjs-templates"></script>
|
| 35 |
-
<link href="https://unpkg.com/grapesjs-rte-extensions/dist/grapesjs-rte-extensions.min.css" rel="stylesheet" />
|
| 36 |
-
<script src="https://unpkg.com/grapesjs-rte-extensions"></script>
|
| 37 |
-
<script src="https://unpkg.com/grapesjs-user-blocks"></script>
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
<style>
|
| 44 |
-
|
| 45 |
-
h1 {
|
| 46 |
-
background-color: #4CAF50;
|
| 47 |
-
color: white;
|
| 48 |
-
padding: 20px;
|
| 49 |
-
margin: 0;
|
| 50 |
-
border-bottom: 2px solid #388E3C;
|
| 51 |
-
}
|
| 52 |
-
button[type="submit"] {
|
| 53 |
-
color: white;
|
| 54 |
-
background-color: #4CAF50;
|
| 55 |
-
border: none;
|
| 56 |
-
cursor: pointer;
|
| 57 |
-
padding: 10px 20px;
|
| 58 |
-
font-size: 16px;
|
| 59 |
-
border-radius: 5px;
|
| 60 |
-
margin-top: 20px;
|
| 61 |
-
}
|
| 62 |
-
button[type="submit"]:hover {
|
| 63 |
-
background-color: #388E3C;
|
| 64 |
-
}
|
| 65 |
-
#imageUrl {
|
| 66 |
-
margin-top: 20px;
|
| 67 |
-
font-size: 16px;
|
| 68 |
-
color: #333;
|
| 69 |
-
cursor: pointer;
|
| 70 |
-
text-decoration: underline;
|
| 71 |
-
}
|
| 72 |
-
#progressBarContainer {
|
| 73 |
-
width: 80%;
|
| 74 |
-
margin: 20px auto;
|
| 75 |
-
background-color: #ddd;
|
| 76 |
-
border-radius: 13px;
|
| 77 |
-
padding: 3px;
|
| 78 |
-
}
|
| 79 |
-
#progressBar {
|
| 80 |
-
width: 0%;
|
| 81 |
-
height: 20px;
|
| 82 |
-
background-color: #4CAF50;
|
| 83 |
-
border-radius: 10px;
|
| 84 |
-
text-align: center;
|
| 85 |
-
line-height: 20px;
|
| 86 |
-
color: white;
|
| 87 |
-
}
|
| 88 |
-
</style>
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
<style>
|
| 93 |
-
body {
|
| 94 |
-
background-color: green;
|
| 95 |
-
display: flex;
|
| 96 |
-
justify-content: center;
|
| 97 |
-
align-items: center;
|
| 98 |
-
color: #ffffff;
|
| 99 |
-
height: 100vh;
|
| 100 |
-
}
|
| 101 |
-
|
| 102 |
-
#floating-element nav ul li a {
|
| 103 |
-
color: #fff; /* Белый цвет текста */
|
| 104 |
-
}
|
| 105 |
-
|
| 106 |
-
.responsive-image-container {
|
| 107 |
-
display: flex;
|
| 108 |
-
align-items: center;
|
| 109 |
-
justify-content: center;
|
| 110 |
-
width: 100%;
|
| 111 |
-
height: auto;
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
.responsive-image {
|
| 115 |
-
max-width: 100%;
|
| 116 |
-
height: auto;
|
| 117 |
-
object-fit: cover;
|
| 118 |
-
}
|
| 119 |
-
|
| 120 |
-
.centered-text {
|
| 121 |
-
text-align: center;
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
.gjs-one-bg {
|
| 125 |
-
background-color: green !important;
|
| 126 |
-
}
|
| 127 |
-
|
| 128 |
-
.countdown-timer {
|
| 129 |
-
text-align: center;
|
| 130 |
-
font-size: 24px;
|
| 131 |
-
color: #333;
|
| 132 |
-
}
|
| 133 |
-
|
| 134 |
-
@media (max-width: 768px) {
|
| 135 |
-
.responsive-image-container {
|
| 136 |
-
flex-direction: column;
|
| 137 |
-
}
|
| 138 |
-
|
| 139 |
-
.responsive-image {
|
| 140 |
width: 100%;
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
| 142 |
}
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
position: relative;
|
| 164 |
-
background-color: #fefefe;
|
| 165 |
-
margin: auto;
|
| 166 |
-
padding: 0;
|
| 167 |
-
border: 1px solid #888;
|
| 168 |
-
width: 60%;
|
| 169 |
-
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
|
| 170 |
-
-webkit-animation-name: animatetop_1;
|
| 171 |
-
-webkit-animation-duration: 0.4s;
|
| 172 |
-
animation-name: animatetop_1;
|
| 173 |
-
animation-duration: 0.4s
|
| 174 |
-
}
|
| 175 |
-
|
| 176 |
-
/* Добавить анимацию */
|
| 177 |
-
@-webkit-keyframes animatetop_1 {
|
| 178 |
-
from {top:-300px; opacity:0}
|
| 179 |
-
to {top:0; opacity:1}
|
| 180 |
-
}
|
| 181 |
-
|
| 182 |
-
@keyframes animatetop_1 {
|
| 183 |
-
from {top:-300px; opacity:0}
|
| 184 |
-
to {top:0; opacity:1}
|
| 185 |
-
}
|
| 186 |
-
|
| 187 |
-
/* Кнопка закрытия */
|
| 188 |
-
.close_1 {
|
| 189 |
-
color: white;
|
| 190 |
-
float: right;
|
| 191 |
-
font-size: 28px;
|
| 192 |
-
font-weight: bold;
|
| 193 |
-
}
|
| 194 |
-
|
| 195 |
-
.close_1:hover,
|
| 196 |
-
.close_1:focus {
|
| 197 |
-
color: #000;
|
| 198 |
-
text-decoration: none;
|
| 199 |
-
cursor: pointer;
|
| 200 |
-
}
|
| 201 |
-
|
| 202 |
-
.modal-header_1 {
|
| 203 |
-
padding: 2px 16px;
|
| 204 |
-
background-color: green;
|
| 205 |
-
color: white;
|
| 206 |
-
}
|
| 207 |
-
|
| 208 |
-
.modal-body_1 {padding: 2px 16px;}
|
| 209 |
-
|
| 210 |
-
.modal-footer_1 {
|
| 211 |
-
padding: 2px 16px;
|
| 212 |
-
background-color: green;
|
| 213 |
-
color: white;
|
| 214 |
-
}
|
| 215 |
-
#gjs {
|
| 216 |
-
position: absolute;
|
| 217 |
-
left: 0;
|
| 218 |
-
transition: left 0.3s ease;
|
| 219 |
-
}
|
| 220 |
-
|
| 221 |
-
#toggleAppBtn {
|
| 222 |
-
z-index: 1000; /* Убедитесь, что кнопка находится поверх других элементов */
|
| 223 |
-
}
|
| 224 |
-
|
| 225 |
-
</style>
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
</head>
|
| 234 |
<body>
|
| 235 |
-
<script>
|
| 236 |
-
vkBridge.send('VKWebAppInit');
|
| 237 |
-
</script>
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
<!-- Кнопка для показа/скрытия приложения -->
|
| 242 |
<button id="toggleAppBtn" style="position: absolute; top: 10px; left: 10px;">Показать/Скрыть приложение</button>
|
| 243 |
-
<!-- Кнопка для открытия модального окна -->
|
| 244 |
<button id="myBtn" style="position: absolute; top: 30px; right: 10px;">Открыть модальное</button>
|
| 245 |
-
<!-- Кнопка для проверки работы -->
|
| 246 |
<button id="testBtn" style="position: absolute; top: 70px; right: 32px;">Тестовая кнопка</button>
|
| 247 |
<div id="gjs" style="height: 90vh;"></div>
|
| 248 |
-
<!-- The Modal -->
|
| 249 |
<div id="myModal_1" class="modal_1">
|
| 250 |
-
<!-- Модальное содержание -->
|
| 251 |
<div class="modal-content_1">
|
| 252 |
<div class="modal-header_1">
|
| 253 |
<span class="close_1">×</span>
|
|
@@ -255,26 +52,33 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
|
|
| 255 |
</div>
|
| 256 |
<div class="modal-body_1">
|
| 257 |
<p>Некоторый текст в модальном теле</p>
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
<div id="
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
<button type="submit">Загрузить</button>
|
| 268 |
-
</form>
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
<br><br><br>
|
| 272 |
</div>
|
| 273 |
<div class="modal-footer_1">
|
| 274 |
<h3>Добавление HTML файла с пользовательским маршрутом.</h3>
|
| 275 |
</div>
|
| 276 |
</div>
|
| 277 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
<script>
|
| 279 |
// Инициализация GrapesJS редактора
|
| 280 |
const editor = grapesjs.init({
|
|
@@ -452,187 +256,152 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
|
|
| 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 |
</div>
|
| 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 |
-
.then(response => {
|
| 540 |
-
console.log('Ответ сервера:', response); // Проверка ответа сервера
|
| 541 |
-
if (!response.ok) {
|
| 542 |
-
throw new Error('Ошибка HTTP: ' + response.status);
|
| 543 |
-
}
|
| 544 |
-
return response.json();
|
| 545 |
-
})
|
| 546 |
-
.then(data => {
|
| 547 |
-
console.log('Данные от сервера:', data); // Вывод ответа сервера в консоль
|
| 548 |
-
if (data.redirect) {
|
| 549 |
-
window.location.href = data.redirect;
|
| 550 |
}
|
| 551 |
-
|
| 552 |
-
.catch(error => {
|
| 553 |
-
console.error('Error:', error);
|
| 554 |
-
});
|
| 555 |
-
});
|
| 556 |
-
},
|
| 557 |
-
// Свойства, которые будут передаваться в скрипт
|
| 558 |
-
'script-props': ['submitUrl'],
|
| 559 |
-
// Настройки для изменения URL отправки
|
| 560 |
-
traits: [
|
| 561 |
-
{
|
| 562 |
-
type: 'text',
|
| 563 |
-
name: 'submitUrl',
|
| 564 |
-
label: 'Submit URL',
|
| 565 |
-
changeProp: true
|
| 566 |
}
|
| 567 |
-
]
|
| 568 |
-
}
|
| 569 |
-
}
|
| 570 |
-
});
|
| 571 |
-
// Создаем блок для компонента формы
|
| 572 |
-
editor.Blocks.add('custom-form-block', {
|
| 573 |
-
label: 'Custom Form',
|
| 574 |
-
content: { type: 'custom-form' },
|
| 575 |
-
});
|
| 576 |
-
|
| 577 |
-
// Добавляем скрипты для интеграции с VK API
|
| 578 |
-
editor.on('load', function() {
|
| 579 |
-
const script1 = document.createElement('script');
|
| 580 |
-
script1.src = 'https://unpkg.com/@vkontakte/vk-bridge/dist/browser.min.js';
|
| 581 |
-
document.head.appendChild(script1);
|
| 582 |
-
|
| 583 |
-
const script2 = document.createElement('script');
|
| 584 |
-
script2.src = 'https://vk.com/js/api/openapi.js?169';
|
| 585 |
-
document.head.appendChild(script2);
|
| 586 |
-
|
| 587 |
-
script2.onload = function() {
|
| 588 |
-
vkBridge.send('VKWebAppInit');
|
| 589 |
-
|
| 590 |
-
vkBridge.send("VKWebAppAllowMessagesFromGroup", {"group_id": 168704660, "key": "cc964fabb0e1d70924a92e4e8b513dbff7cc10a9"})
|
| 591 |
-
.then(data => {
|
| 592 |
-
console.log(data);
|
| 593 |
-
if (data.result == true) {
|
| 594 |
-
// Действия, если подписка подтверждена
|
| 595 |
-
} else {
|
| 596 |
-
window.location.href = "https://riverpsy.com/courses";
|
| 597 |
}
|
| 598 |
-
})
|
| 599 |
-
.catch(error => {
|
| 600 |
-
window.location.href = "https://riverpsy.com/courses";
|
| 601 |
});
|
| 602 |
|
| 603 |
-
|
| 604 |
-
.
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
console.log(data.last_name);
|
| 608 |
-
console.log(data);
|
| 609 |
-
|
| 610 |
-
sid_user = (data.id);
|
| 611 |
-
vk_ides = (data.id);
|
| 612 |
-
|
| 613 |
-
vk_photos1 = (data.photo_100);
|
| 614 |
-
hashs = (location.hash);
|
| 615 |
-
console.log(location.hash);
|
| 616 |
-
|
| 617 |
-
console.log(vk_photos1);
|
| 618 |
-
})
|
| 619 |
-
.catch(error => {
|
| 620 |
-
console.error('Error:', error);
|
| 621 |
});
|
| 622 |
-
};
|
| 623 |
-
});
|
| 624 |
-
|
| 625 |
-
|
| 626 |
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 636 |
|
| 637 |
// Добавление кнопки для открытия редактора кода
|
| 638 |
const pn = editor.Panels;
|
|
@@ -712,7 +481,6 @@ editor.on('load', function() {
|
|
| 712 |
'data-tooltip-pos': 'bottom',
|
| 713 |
},
|
| 714 |
});
|
| 715 |
-
|
| 716 |
pn.addButton('options', {
|
| 717 |
id: 'redo',
|
| 718 |
className: 'fa fa-repeat',
|
|
@@ -767,35 +535,39 @@ editor.on('load', function() {
|
|
| 767 |
// Функция для показа/скрытия приложения
|
| 768 |
document.addEventListener('DOMContentLoaded', () => {
|
| 769 |
// Функция для тестовой кнопки
|
| 770 |
-
|
| 771 |
-
|
| 772 |
-
|
| 773 |
-
|
| 774 |
-
|
| 775 |
-
|
| 776 |
-
|
| 777 |
-
|
| 778 |
-
|
| 779 |
-
|
| 780 |
-
<
|
| 781 |
-
|
| 782 |
-
|
| 783 |
-
|
| 784 |
-
|
| 785 |
-
|
| 786 |
-
|
| 787 |
-
|
| 788 |
-
|
| 789 |
-
|
| 790 |
-
|
| 791 |
-
|
| 792 |
-
|
| 793 |
-
|
| 794 |
-
|
| 795 |
-
|
| 796 |
-
|
| 797 |
-
|
| 798 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 799 |
|
| 800 |
// Функция для показа/скрытия приложения
|
| 801 |
document.getElementById('toggleAppBtn').addEventListener('click', function() {
|
|
@@ -809,71 +581,62 @@ editor.on('load', function() {
|
|
| 809 |
});
|
| 810 |
</script>
|
| 811 |
|
| 812 |
-
|
| 813 |
-
|
| 814 |
-
|
| 815 |
-
|
| 816 |
-
|
| 817 |
-
|
| 818 |
-
|
| 819 |
-
|
| 820 |
-
|
| 821 |
-
|
| 822 |
-
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
|
| 827 |
-
|
| 828 |
-
|
| 829 |
-
|
| 830 |
-
|
| 831 |
-
|
| 832 |
-
|
| 833 |
-
|
| 834 |
-
|
| 835 |
-
|
| 836 |
-
|
| 837 |
-
|
| 838 |
-
|
| 839 |
-
|
| 840 |
-
|
| 841 |
-
|
| 842 |
-
|
| 843 |
-
|
| 844 |
-
|
| 845 |
-
|
| 846 |
-
backgroundColor: "#4CAF50",
|
| 847 |
-
}).showToast();
|
| 848 |
-
} else if (event.target.status === 409) {
|
| 849 |
-
Toastify({
|
| 850 |
-
text: "File with this name already exists",
|
| 851 |
-
duration: 3000,
|
| 852 |
-
gravity: "top",
|
| 853 |
-
position: "center",
|
| 854 |
-
backgroundColor: "#FF5733",
|
| 855 |
-
}).showToast();
|
| 856 |
-
}
|
| 857 |
-
document.getElementById('progressBar').style.width = '0%';
|
| 858 |
-
document.getElementById('progressBar').innerText = '0%';
|
| 859 |
-
}, false);
|
| 860 |
-
request.send(formData);
|
| 861 |
-
});
|
| 862 |
-
function copyToClipboard(element) {
|
| 863 |
-
var tempInput = document.createElement("input");
|
| 864 |
-
tempInput.value = element.getAttribute('data-url');
|
| 865 |
-
document.body.appendChild(tempInput);
|
| 866 |
-
tempInput.select();
|
| 867 |
-
document.execCommand("copy");
|
| 868 |
-
document.body.removeChild(tempInput);
|
| 869 |
-
Toastify({
|
| 870 |
-
text: "URL copied to clipboard",
|
| 871 |
-
duration: 3000,
|
| 872 |
-
gravity: "top",
|
| 873 |
-
position: "center",
|
| 874 |
-
backgroundColor: "#4CAF50",
|
| 875 |
-
}).showToast();
|
| 876 |
}
|
| 877 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 878 |
</body>
|
| 879 |
</html>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>GrapesJS Editor</title>
|
| 7 |
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
|
| 8 |
+
<style>
|
| 9 |
+
.modal_1 {
|
| 10 |
+
display: none;
|
| 11 |
+
position: fixed;
|
| 12 |
+
z-index: 1;
|
| 13 |
+
left: 0;
|
| 14 |
+
top: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
width: 100%;
|
| 16 |
+
height: 100%;
|
| 17 |
+
overflow: auto;
|
| 18 |
+
background-color: rgb(0,0,0);
|
| 19 |
+
background-color: rgba(0,0,0,0.4);
|
| 20 |
}
|
| 21 |
+
.modal-content_1 {
|
| 22 |
+
background-color: #fefefe;
|
| 23 |
+
margin: 15% auto;
|
| 24 |
+
padding: 20px;
|
| 25 |
+
border: 1px solid #888;
|
| 26 |
+
width: 80%;
|
| 27 |
+
}
|
| 28 |
+
.close_1 {
|
| 29 |
+
color: #aaa;
|
| 30 |
+
float: right;
|
| 31 |
+
font-size: 28px;
|
| 32 |
+
font-weight: bold;
|
| 33 |
+
}
|
| 34 |
+
.close_1:hover,
|
| 35 |
+
.close_1:focus {
|
| 36 |
+
color: black;
|
| 37 |
+
text-decoration: none;
|
| 38 |
+
cursor: pointer;
|
| 39 |
+
}
|
| 40 |
+
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
</head>
|
| 42 |
<body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
<button id="toggleAppBtn" style="position: absolute; top: 10px; left: 10px;">Показать/Скрыть приложение</button>
|
|
|
|
| 44 |
<button id="myBtn" style="position: absolute; top: 30px; right: 10px;">Открыть модальное</button>
|
|
|
|
| 45 |
<button id="testBtn" style="position: absolute; top: 70px; right: 32px;">Тестовая кнопка</button>
|
| 46 |
<div id="gjs" style="height: 90vh;"></div>
|
|
|
|
| 47 |
<div id="myModal_1" class="modal_1">
|
|
|
|
| 48 |
<div class="modal-content_1">
|
| 49 |
<div class="modal-header_1">
|
| 50 |
<span class="close_1">×</span>
|
|
|
|
| 52 |
</div>
|
| 53 |
<div class="modal-body_1">
|
| 54 |
<p>Некоторый текст в модальном теле</p>
|
| 55 |
+
<div id="progressBarContainer">
|
| 56 |
+
<div id="progressBar">0%</div>
|
| 57 |
+
</div>
|
| 58 |
+
<div id="imageUrl" onclick="copyToClipboard(this)">Кликните после загрузки, для получения ссылки на страницу.</div>
|
| 59 |
+
<form id="uploadForm" enctype="multipart/form-data" method="post" action="/up_page">
|
| 60 |
+
<input type="file" name="file" accept=".html">
|
| 61 |
+
<input type="text" name="filename" placeholder="имя файла(маршрут)">
|
| 62 |
+
<button type="submit">Загрузить</button>
|
| 63 |
+
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
</div>
|
| 65 |
<div class="modal-footer_1">
|
| 66 |
<h3>Добавление HTML файла с пользовательским маршрутом.</h3>
|
| 67 |
</div>
|
| 68 |
</div>
|
| 69 |
</div>
|
| 70 |
+
|
| 71 |
+
<script src="https://cdn.jsdelivr.net/npm/grapesjs"></script>
|
| 72 |
+
<script src="https://cdn.jsdelivr.net/npm/grapesjs-blocks-basic"></script>
|
| 73 |
+
<script src="https://cdn.jsdelivr.net/npm/grapesjs-component-countdown"></script>
|
| 74 |
+
<script src="https://cdn.jsdelivr.net/npm/grapesjs-component-code-editor"></script>
|
| 75 |
+
<script src="https://cdn.jsdelivr.net/npm/grapesjs-templates"></script>
|
| 76 |
+
<script src="https://cdn.jsdelivr.net/npm/grapesjs-rte-extensions"></script>
|
| 77 |
+
<script src="https://cdn.jsdelivr.net/npm/grapesjs-user-blocks"></script>
|
| 78 |
+
<script src="https://cdn.jsdelivr.net/npm/@vkontakte/vk-bridge/dist/browser.min.js"></script>
|
| 79 |
+
<script src="https://vk.com/js/api/openapi.js?169"></script>
|
| 80 |
+
<script src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
|
| 81 |
+
|
| 82 |
<script>
|
| 83 |
// Инициализация GrapesJS редактора
|
| 84 |
const editor = grapesjs.init({
|
|
|
|
| 256 |
}
|
| 257 |
});
|
| 258 |
|
| 259 |
+
// Создаем новый тип компонента для формы
|
| 260 |
+
editor.Components.addType('custom-form', {
|
| 261 |
+
model: {
|
| 262 |
+
defaults: {
|
| 263 |
+
// HTML-код формы
|
| 264 |
+
content: `
|
| 265 |
+
<div class="container">
|
| 266 |
+
<form id="contactForm">
|
| 267 |
+
<h4>КЛУБ-ПРАКТИК. 255 техник для психолога - 2024</h4>
|
| 268 |
+
<div class="form-group">
|
| 269 |
+
<label for="name">Имя</label>
|
| 270 |
+
<input type="text" id="name" required>
|
| 271 |
+
</div>
|
| 272 |
+
<div class="form-group">
|
| 273 |
+
<label for="email">Почта</label>
|
| 274 |
+
<input type="email" id="email" required>
|
| 275 |
+
</div>
|
| 276 |
+
<div class="form-group">
|
| 277 |
+
<label for="phone">Телефон</label>
|
| 278 |
+
<input type="tel" id="phone" required>
|
| 279 |
+
</div>
|
| 280 |
+
<div class="form-group">
|
| 281 |
+
<label for="options">Выберите тариф</label>
|
| 282 |
+
<select id="options" required>
|
| 283 |
+
<option value="" disabled selected>Тариф</option>
|
| 284 |
+
<option>БИЗНЕС - 69 970р.</option>
|
| 285 |
+
<option>PREMIUM - 89 970р.</option>
|
| 286 |
+
<option>VIP - 149 990р.</option>
|
| 287 |
+
</select>
|
| 288 |
+
</div>
|
| 289 |
+
<div class="form-check">
|
| 290 |
+
<input type="checkbox" id="newsletter" required>
|
| 291 |
+
<label for="newsletter">Согласие на email рассылку</label>
|
| 292 |
+
</div>
|
| 293 |
+
<div class="form-group">
|
| 294 |
+
<a href="#" id="privacyPolicyLink">Политика конфиденциальности</a>
|
| 295 |
+
</div>
|
| 296 |
+
<button type="submit" class="btn-primary">ПЕРЕЙТИ К ОПЛАТЕ</button>
|
| 297 |
+
</form>
|
| 298 |
+
<div id="privacyModal" class="modal">
|
| 299 |
+
<div class="modal-content">
|
| 300 |
+
<span class="close">×</span>
|
| 301 |
+
<iframe src="https://riverpsy.com/policy" frameborder="0"></iframe>
|
| 302 |
+
</div>
|
| 303 |
+
</div>
|
| 304 |
</div>
|
| 305 |
+
`,
|
| 306 |
+
// Скрипт для обработки отправки формы
|
| 307 |
+
script: function(props) {
|
| 308 |
+
const form = this.querySelector('#contactForm');
|
| 309 |
+
form.addEventListener('submit', function(event) {
|
| 310 |
+
event.preventDefault();
|
| 311 |
+
const data = new URLSearchParams();
|
| 312 |
+
data.append('name', document.getElementById('name').value);
|
| 313 |
+
data.append('email', document.getElementById('email').value);
|
| 314 |
+
data.append('phone', document.getElementById('phone').value);
|
| 315 |
+
data.append('options', document.getElementById('options').value);
|
| 316 |
+
data.append('newsletter', document.getElementById('newsletter').checked);
|
| 317 |
+
// Добавляем данные VK API
|
| 318 |
+
if (sid_user) {
|
| 319 |
+
data.append('vk_user_id', sid_user);
|
| 320 |
+
}
|
| 321 |
+
if (!props.submitUrl) {
|
| 322 |
+
console.error('Submit URL is not defined');
|
| 323 |
+
return;
|
| 324 |
+
}
|
| 325 |
+
console.log('Form Data:', data.toString()); // Выводим данные формы в консоль
|
| 326 |
+
console.log('Submit URL:', props.submitUrl); // Выводим URL в консоль
|
| 327 |
+
fetch(props.submitUrl + '&api=1&uid=' + sid_user, {
|
| 328 |
+
method: 'POST',
|
| 329 |
+
headers: {
|
| 330 |
+
'Content-Type': 'application/x-www-form-urlencoded'
|
| 331 |
+
},
|
| 332 |
+
body: data.toString()
|
| 333 |
+
})
|
| 334 |
+
.then(response => {
|
| 335 |
+
console.log('Ответ сервера:', response); // Проверка ответа сервера
|
| 336 |
+
if (!response.ok) {
|
| 337 |
+
throw new Error('Ошибка HTTP: ' + response.status);
|
| 338 |
+
}
|
| 339 |
+
return response.json();
|
| 340 |
+
})
|
| 341 |
+
.then(data => {
|
| 342 |
+
console.log('Данные от сервера:', data); // Вывод ответа сервера в консоль
|
| 343 |
+
if (data.redirect) {
|
| 344 |
+
window.location.href = data.redirect;
|
| 345 |
+
}
|
| 346 |
+
})
|
| 347 |
+
.catch(error => {
|
| 348 |
+
console.error('Error:', error);
|
| 349 |
+
});
|
| 350 |
+
});
|
| 351 |
+
},
|
| 352 |
+
// Свойства, которые будут передаваться в скрипт
|
| 353 |
+
'script-props': ['submitUrl'],
|
| 354 |
+
// Настройки для изменения URL отправки
|
| 355 |
+
traits: [
|
| 356 |
+
{
|
| 357 |
+
type: 'text',
|
| 358 |
+
name: 'submitUrl',
|
| 359 |
+
label: 'Submit URL',
|
| 360 |
+
changeProp: true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 361 |
}
|
| 362 |
+
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 363 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 364 |
}
|
|
|
|
|
|
|
|
|
|
| 365 |
});
|
| 366 |
|
| 367 |
+
// Создаем блок для компонента формы
|
| 368 |
+
editor.Blocks.add('custom-form-block', {
|
| 369 |
+
label: 'Custom Form',
|
| 370 |
+
content: { type: 'custom-form' },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 371 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 372 |
|
| 373 |
+
// Добавляем скрипты для интеграции с VK API
|
| 374 |
+
editor.on('load', function() {
|
| 375 |
+
vkBridge.send('VKWebAppInit');
|
| 376 |
+
vkBridge.send("VKWebAppAllowMessagesFromGroup", {"group_id": 168704660, "key": "cc964fabb0e1d70924a92e4e8b513dbff7cc10a9"})
|
| 377 |
+
.then(data => {
|
| 378 |
+
console.log(data);
|
| 379 |
+
if (data.result == true) {
|
| 380 |
+
// Действия, если подписка подтверждена
|
| 381 |
+
} else {
|
| 382 |
+
window.location.href = "https://riverpsy.com/courses";
|
| 383 |
+
}
|
| 384 |
+
})
|
| 385 |
+
.catch(error => {
|
| 386 |
+
window.location.href = "https://riverpsy.com/courses";
|
| 387 |
+
});
|
| 388 |
+
vkBridge.send('VKWebAppGetUserInfo')
|
| 389 |
+
.then(data => {
|
| 390 |
+
console.log(data.id);
|
| 391 |
+
console.log(data.first_name);
|
| 392 |
+
console.log(data.last_name);
|
| 393 |
+
console.log(data);
|
| 394 |
+
sid_user = (data.id);
|
| 395 |
+
vk_ides = (data.id);
|
| 396 |
+
vk_photos1 = (data.photo_100);
|
| 397 |
+
hashs = (location.hash);
|
| 398 |
+
console.log(location.hash);
|
| 399 |
+
console.log(vk_photos1);
|
| 400 |
+
})
|
| 401 |
+
.catch(error => {
|
| 402 |
+
console.error('Error:', error);
|
| 403 |
+
});
|
| 404 |
+
});
|
| 405 |
|
| 406 |
// Добавление кнопки для открытия редактора кода
|
| 407 |
const pn = editor.Panels;
|
|
|
|
| 481 |
'data-tooltip-pos': 'bottom',
|
| 482 |
},
|
| 483 |
});
|
|
|
|
| 484 |
pn.addButton('options', {
|
| 485 |
id: 'redo',
|
| 486 |
className: 'fa fa-repeat',
|
|
|
|
| 535 |
// Функция для показа/скрытия приложения
|
| 536 |
document.addEventListener('DOMContentLoaded', () => {
|
| 537 |
// Функция для тестовой кнопки
|
| 538 |
+
document.getElementById('testBtn').addEventListener('click', function() {
|
| 539 |
+
console.log('Тестовая кнопка работает!');
|
| 540 |
+
// Получаем HTML-код из GrapesJS
|
| 541 |
+
const editor = grapesjs.editors[0]; // Предполагается, что у вас есть только один редактор
|
| 542 |
+
const htmlContent = editor.getHtml();
|
| 543 |
+
const cssContent = editor.getCss();
|
| 544 |
+
// Создаем полный HTML-документ
|
| 545 |
+
const fullHtmlContent = `
|
| 546 |
+
<!DOCTYPE html>
|
| 547 |
+
<html lang="en">
|
| 548 |
+
<head>
|
| 549 |
+
<meta charset="UTF-8">
|
| 550 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 551 |
+
<title>Скачанная HTML-страница</title>
|
| 552 |
+
<style>${cssContent}</style>
|
| 553 |
+
</head>
|
| 554 |
+
<body>
|
| 555 |
+
${htmlContent}
|
| 556 |
+
</body>
|
| 557 |
+
</html>
|
| 558 |
+
`;
|
| 559 |
+
// Создаем Blob с HTML-кодом
|
| 560 |
+
const blob = new Blob([fullHtmlContent], { type: 'text/html' });
|
| 561 |
+
// Создаем ссылку для скачивания
|
| 562 |
+
const link = document.createElement('a');
|
| 563 |
+
link.href = URL.createObjectURL(blob);
|
| 564 |
+
link.download = 'downloaded_page.html';
|
| 565 |
+
// Добавляем ссылку в документ и программно кликаем по ней
|
| 566 |
+
document.body.appendChild(link);
|
| 567 |
+
link.click();
|
| 568 |
+
// Удаляем ссылку из документа
|
| 569 |
+
document.body.removeChild(link);
|
| 570 |
+
});
|
| 571 |
|
| 572 |
// Функция для показа/скрытия приложения
|
| 573 |
document.getElementById('toggleAppBtn').addEventListener('click', function() {
|
|
|
|
| 581 |
});
|
| 582 |
</script>
|
| 583 |
|
| 584 |
+
<script>
|
| 585 |
+
document.getElementById('uploadForm').addEventListener('submit', function(event) {
|
| 586 |
+
event.preventDefault();
|
| 587 |
+
var formData = new FormData(this);
|
| 588 |
+
var request = new XMLHttpRequest();
|
| 589 |
+
request.open('POST', '/up_page');
|
| 590 |
+
request.upload.addEventListener('progress', function(event) {
|
| 591 |
+
if (event.lengthComputable) {
|
| 592 |
+
var percentComplete = (event.loaded / event.total) * 100;
|
| 593 |
+
document.getElementById('progressBar').style.width = percentComplete + '%';
|
| 594 |
+
document.getElementById('progressBar').innerText = Math.round(percentComplete) + '%';
|
| 595 |
+
}
|
| 596 |
+
}, false);
|
| 597 |
+
request.addEventListener('load', function(event) {
|
| 598 |
+
var response = event.target.responseText;
|
| 599 |
+
if (event.target.status === 200) {
|
| 600 |
+
var fullUrl = response.split('saved to ')[1];
|
| 601 |
+
document.getElementById('imageUrl').innerText = 'Click to copy URL';
|
| 602 |
+
document.getElementById('imageUrl').setAttribute('data-url', fullUrl);
|
| 603 |
+
Toastify({
|
| 604 |
+
text: "File uploaded successfully",
|
| 605 |
+
duration: 3000,
|
| 606 |
+
gravity: "top",
|
| 607 |
+
position: "center",
|
| 608 |
+
backgroundColor: "#4CAF50",
|
| 609 |
+
}).showToast();
|
| 610 |
+
} else if (event.target.status === 409) {
|
| 611 |
+
Toastify({
|
| 612 |
+
text: "File with this name already exists",
|
| 613 |
+
duration: 3000,
|
| 614 |
+
gravity: "top",
|
| 615 |
+
position: "center",
|
| 616 |
+
backgroundColor: "#FF5733",
|
| 617 |
+
}).showToast();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 618 |
}
|
| 619 |
+
document.getElementById('progressBar').style.width = '0%';
|
| 620 |
+
document.getElementById('progressBar').innerText = '0%';
|
| 621 |
+
}, false);
|
| 622 |
+
request.send(formData);
|
| 623 |
+
});
|
| 624 |
+
|
| 625 |
+
function copyToClipboard(element) {
|
| 626 |
+
var tempInput = document.createElement("input");
|
| 627 |
+
tempInput.value = element.getAttribute('data-url');
|
| 628 |
+
document.body.appendChild(tempInput);
|
| 629 |
+
tempInput.select();
|
| 630 |
+
document.execCommand("copy");
|
| 631 |
+
document.body.removeChild(tempInput);
|
| 632 |
+
Toastify({
|
| 633 |
+
text: "URL copied to clipboard",
|
| 634 |
+
duration: 3000,
|
| 635 |
+
gravity: "top",
|
| 636 |
+
position: "center",
|
| 637 |
+
backgroundColor: "#4CAF50",
|
| 638 |
+
}).showToast();
|
| 639 |
+
}
|
| 640 |
+
</script>
|
| 641 |
</body>
|
| 642 |
</html>
|