psy_vk / pages.html
DmitrMakeev's picture
Update pages.html
2bfbf47 verified
raw
history blame
36.5 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Upload</title>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://unpkg.com/@vkontakte/vk-bridge/dist/browser.min.js"></script>
<script type="text/javascript" src="https://vk.com/js/api/openapi.js?169"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GrapesJS Project</title>
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet" />
<link href="index.css" rel="stylesheet" />
<script src="https://unpkg.com/grapesjs"></script>
<script src="https://unpkg.com/grapesjs-blocks-basic"></script>
<script src="https://unpkg.com/grapesjs-component-countdown"></script>
<script src="https://unpkg.com/grapesjs-parser-postcss"></script>
<script src="https://unpkg.com/grapesjs-component-code-editor/dist/grapesjs-component-code-editor.min.css"></script>
<script src="https://unpkg.com/grapesjs-component-code-editor"></script>
<script src="https://unpkg.com/grapesjs-templates"></script>
<link href="https://unpkg.com/grapesjs-rte-extensions/dist/grapesjs-rte-extensions.min.css" rel="stylesheet" />
<script src="https://unpkg.com/grapesjs-rte-extensions"></script>
<script src="https://unpkg.com/grapesjs-user-blocks"></script>
<style>
h1 {
background-color: #4CAF50;
color: white;
padding: 20px;
margin: 0;
border-bottom: 2px solid #388E3C;
}
button[type="submit"] {
color: white;
background-color: #4CAF50;
border: none;
cursor: pointer;
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
margin-top: 20px;
}
button[type="submit"]:hover {
background-color: #388E3C;
}
#imageUrl {
margin-top: 20px;
font-size: 16px;
color: #333;
cursor: pointer;
text-decoration: underline;
}
#progressBarContainer {
width: 80%;
margin: 20px auto;
background-color: #ddd;
border-radius: 13px;
padding: 3px;
}
#progressBar {
width: 0%;
height: 20px;
background-color: #4CAF50;
border-radius: 10px;
text-align: center;
line-height: 20px;
color: white;
}
</style>
<style>
body {
background-color: green;
display: flex;
justify-content: center;
align-items: center;
color: #ffffff;
height: 100vh;
}
#floating-element nav ul li a {
color: #fff; /* Белый цвет текста */
}
.responsive-image-container {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: auto;
}
.responsive-image {
max-width: 100%;
height: auto;
object-fit: cover;
}
.centered-text {
text-align: center;
}
.gjs-one-bg {
background-color: green !important;
}
.countdown-timer {
text-align: center;
font-size: 24px;
color: #333;
}
@media (max-width: 768px) {
.responsive-image-container {
flex-direction: column;
}
.responsive-image {
width: 100%;
margin-bottom: 20px;
}
}
/* Модальный (фон) */
.modal_1 {
display: none; /* Скрыто по умолчанию */
position: fixed; /* Оставаться на месте */
z-index: 10; /* Сидеть на вершине */
padding-top: 100px; /* Расположение коробки */
left: 0;
top: 0;
width: 100%; /* Полная ширина */
height: 100%; /* Полная высота */
overflow: auto; /* Включите прокрутку, если это необходимо */
background-color: rgb(0,0,0); /* Цвет запасной вариант */
background-color: rgba(0,0,0,0.4); /*Черный с непрозрачностью */
}
/* Модальное содержание */
.modal-content_1 {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
border: 1px solid #888;
width: 60%;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
-webkit-animation-name: animatetop_1;
-webkit-animation-duration: 0.4s;
animation-name: animatetop_1;
animation-duration: 0.4s
}
/* Добавить анимацию */
@-webkit-keyframes animatetop_1 {
from {top:-300px; opacity:0}
to {top:0; opacity:1}
}
@keyframes animatetop_1 {
from {top:-300px; opacity:0}
to {top:0; opacity:1}
}
/* Кнопка закрытия */
.close_1 {
color: white;
float: right;
font-size: 28px;
font-weight: bold;
}
.close_1:hover,
.close_1:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
.modal-header_1 {
padding: 2px 16px;
background-color: green;
color: white;
}
.modal-body_1 {padding: 2px 16px;}
.modal-footer_1 {
padding: 2px 16px;
background-color: green;
color: white;
}
#gjs {
position: absolute;
left: 0;
transition: left 0.3s ease;
}
#toggleAppBtn {
z-index: 1000; /* Убедитесь, что кнопка находится поверх других элементов */
}
</style>
<style>
/* Модальный (фон) */
.modal_2 {
display: none; /* Скрыто по умолчанию */
position: fixed; /* Оставаться на месте */
z-index: 10; /* Сидеть на вершине */
padding-top: 100px; /* Расположение коробки */
left: 0;
top: 0;
width: 100%; /* Полная ширина */
height: 100%; /* Полная высота */
overflow: auto; /* Включите прокрутку, если это необходимо */
background-color: rgb(0,0,0); /* Цвет запасной вариант */
background-color: rgba(0,0,0,0.4); /*Черный с непрозрачностью */
}
/* Модальное содержание */
.modal-content_2 {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
border: 1px solid #888;
width: 80%;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
-webkit-animation-name: animatetop_2;
-webkit-animation-duration: 0.4s;
animation-name: animatetop_2;
animation-duration: 0.4s
}
/* Добавить анимацию */
@-webkit-keyframes animatetop_2 {
from {top:-300px; opacity:0}
to {top:0; opacity:1}
}
@keyframes animatetop_2 {
from {top:-300px; opacity:0}
to {top:0; opacity:1}
}
/* Кнопка закрытия */
.close_2 {
color: white;
float: right;
font-size: 28px;
font-weight: bold;
}
.close_2:hover,
.close_2:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
.modal-header_2 {
padding: 2px 16px;
background-color: green;
color: white;
}
.modal-body_2 {padding: 2px 16px;}
.modal-footer_2 {
padding: 2px 16px;
background-color: green;
color: white;
}
#gjs {
position: absolute;
left: 0;
transition: left 0.3s ease;
}
#toggleAppBtn {
z-index: 1000; /* Убедитесь, что кнопка находится поверх других элементов */
}
</style>
<style>
/* Модальный (фон) */
.modal_3 {
display: none; /* Скрыто по умолчанию */
position: fixed; /* Оставаться на месте */
z-index: 10; /* Сидеть на вершине */
padding-top: 100px; /* Расположение коробки */
left: 0;
top: 0;
width: 100%; /* Полная ширина */
height: 100%; /* Полная высота */
overflow: auto; /* Включите прокрутку, если это необходимо */
background-color: rgb(0,0,0); /* Цвет запасной вариант */
background-color: rgba(0,0,0,0.4); /*Черный с непрозрачностью */
}
/* Модальное содержание */
.modal-content_3 {
position: relative;
background-color: #fefefe;
margin: auto;
padding: 0;
border: 1px solid #888;
width: 80%;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
-webkit-animation-name: animatetop_3;
-webkit-animation-duration: 0.4s;
animation-name: animatetop_3;
animation-duration: 0.4s
}
/* Добавить анимацию */
@-webkit-keyframes animatetop_3 {
from {top:-300px; opacity:0}
to {top:0; opacity:1}
}
@keyframes animatetop_3 {
from {top:-300px; opacity:0}
to {top:0; opacity:1}
}
/* Кнопка закрытия */
.close_3 {
color: white;
float: right;
font-size: 28px;
font-weight: bold;
}
.close_3:hover,
.close_3:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
.modal-header_3 {
padding: 2px 16px;
background-color: green;
color: white;
}
.modal-body_3 {padding: 2px 16px;}
.modal-footer_3 {
padding: 2px 16px;
background-color: green;
color: white;
}
</style>
<style>
.input-row {
display: flex;
justify-content: center;
gap: 10px;
margin-top: 20px;
}
.input-row input, .input-row textarea {
padding: 10px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 5px;
}
#jsoneditor {
width: 50%;
height: 300px;
margin: 20px auto;
}
#addVideo, #saveToClipboard {
color: white;
background-color: #4CAF50;
border: none;
cursor: pointer;
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
margin-top: 20px;
}
#addVideo:hover, #saveToClipboard:hover {
background-color: #388E3C;
}
.jsoneditor-menu {
background-color: #4CAF50 !important;
border-bottom: 1px solid #388E3C !important;
}
.jsoneditor{
border: 1px #4CAF50 !important;
border-bottom: 2px solid #388E3C !important;
}
</style>
<style>
/* Стили для контейнера кнопки */
/* Стили для кнопки "Показать/Скрыть" */
#toggleAppBtn {
background-color: #4CAF50; /* Зелёный цвет */
color: white;
border: none;
padding: 10px 10px;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
margin-bottom: 20px; /* относительно длины родительского блока */
}
/* Стили для кнопки "Показать/Скрыть" */
#vkontBtn {
background-color: #4CAF50; /* Зелёный цвет */
color: white;
border: none;
padding: 10px 10px;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
margin-bottom: 20px; /* относительно длины родительского блока */
}
#vkontBtn:hover {
background-color: #388E3C; /* Тёмно-зелёный цвет при наведении */
}
#toggleAppBtn:hover {
background-color: #388E3C; /* Тёмно-зелёный цвет при наведении */
}
</style>
<style>
/* Стили для контейнера кнопки */
.button-container {
position: absolute;
top: 770px;
left: 20px;
z-index: 100; /* Убедитесь, что кнопка находится поверх других элементов */
background-color: transparent; /* Прозрачный фон контейнера */
display: flex; /* Используем flexbox для горизонтального расположения */
gap: 10px; /* Пространство между иконками */
}
.button-cont1, .button-cont2 {
padding: 10px; /* Внутренние отступы вокруг иконки */
background-color: transparent; /* Прозрачный фон контейнера */
}
</style>
<style>
/* Стили для блока, который появится справа */
.overlay-block {
position: fixed;
top: 0;
right: 0;
width: 30%; /* Ширина 15% от дисплея */
height: 590px;
border: 1px solid #388E3C; /* Тёмно-зелёная рамка */
background-color: rgba(0, 0, 0, 0.1); /* Полупрозрачный фон */
z-index: 0; /* Убедитесь, что блок находится поверх других элементов */
}
</style>
</head>
<body>
<script>
vkBridge.send('VKWebAppInit');
</script>
<!-- Кнопка для показа/скрытия приложения -->
<div class="button-container">
<div class="button-con1">
<!-- icon666.com - MILLIONS vector ICONS FREE --><svg id="toggleAppBtn" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 415 415" style="enable-background:new 0 0 415 415;" xml:space="preserve" width="36" height="36"><g><path d="M373,27H43C19.565,27,0,45.565,0,69v185c0,23.435,19.565,43,43,43h157v46H95v45h225v-45H215v-46h158 c23.435,0,42-19.565,42-43V69C415,45.565,396.435,27,373,27z M305,373H110v-15h195V373z M400,254.5c0,15.188-12.312,27.5-27.5,27.5 h-330C27.312,282,15,269.688,15,254.5v-185C15,54.312,27.312,42,42.5,42h330c15.188,0,27.5,12.312,27.5,27.5V254.5z" fill="#000000" style="fill: rgb(242, 242, 242);"></path><path d="M45,252h325V72H45V252z M131.941,198.729l-0.15-0.154c-7.69-7.69-7.69-20.204,0-27.895l0.389-0.389 c7.691-7.69,20.206-7.692,27.896,0l7.109,7.108l4.886-2.563c3.468-1.819,7.12-3.39,10.855-4.666l5.075-1.734v-9.712 C188,148.05,196.48,140,207.725,140h0.55c11.246,0,19.725,8.05,19.725,18.725v9.712l5.074,1.734 c3.707,1.268,7.359,2.84,10.855,4.674l4.88,2.56l7.115-7.097c7.655-7.656,20.098-7.68,27.801-0.078l0.482,0.513 c7.708,7.709,7.708,20.251,0,27.958l-7.887,8.119l2.141,4.668c1.55,3.38,2.767,6.666,3.719,10.047l1.54,5.466h12.055 c7.572,0,13.853,3.947,17.016,10h-62.853c-3.292-20.503-20.84-35.5-41.938-35.5s-38.646,14.997-41.938,35.5h-63.574 c3.441-5.954,10.099-10,17.737-10h12.056l1.539-5.468c0.951-3.379,2.167-6.664,3.717-10.044l2.109-4.598L131.941,198.729z M234.665,237h-53.33c3.008-12.248,13.821-20.5,26.665-20.5C220.844,216.5,231.656,224.752,234.665,237z M60,87h295v150h-26.219 c-3.934-14.57-17.023-25-33.005-25h-0.908c-0.238-0.661-0.485-1.321-0.742-1.981l0.731-0.753 c13.478-13.523,13.5-35.469,0.067-49.021l-0.497-0.529c-13.355-13.353-34.956-13.549-48.524-0.586 c-0.965-0.435-1.936-0.852-2.912-1.252C242.543,139.373,227.456,125,208.275,125h-0.55c-19.18,0-34.266,14.372-34.715,32.876 c-0.976,0.398-1.945,0.813-2.905,1.245c-13.581-12.97-35.183-12.784-48.532,0.563l-0.389,0.39 c-13.511,13.512-13.537,35.481-0.08,49.027l0.798,0.845c-0.267,0.685-0.523,1.368-0.77,2.054h-0.907 c-16.134,0-29.759,10.597-33.915,25H60V87z" fill="#000000" style="fill: rgb(242, 242, 242);"></path></g></svg>
</div>
<div class="button-con2">
<!-- icon666.com - MILLIONS vector ICONS FREE --><svg id="vkontBtn" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 318.188 318.188" style="enable-background:new 0 0 318.188 318.188;" xml:space="preserve" width="36" height="36"><g><g><g><path d="M86.891,142.127l38,18.633c1.063,0.521,2.188,0.768,3.296,0.768c2.771,0,5.437-1.543,6.739-4.2 c1.824-3.719,0.287-8.212-3.432-10.036l-24.266-11.899l24.266-11.899c3.719-1.823,5.256-6.317,3.432-10.036 c-1.823-3.719-6.317-5.256-10.036-3.432l-38,18.633c-2.57,1.26-4.198,3.872-4.198,6.734S84.321,140.868,86.891,142.127z" fill="#000000" style="fill: rgb(247, 247, 247);"></path><polygon points="100.882,254.418 87.435,254.418 87.435,238.539 75.804,238.539 75.804,281.371 87.435,281.371 87.435,263.91 100.882,263.91 100.882,281.371 112.513,281.371 112.513,238.539 100.882,238.539 " fill="#000000" style="fill: rgb(247, 247, 247);"></polygon><path d="M185.593,123.495l24.266,11.899l-24.266,11.899c-3.719,1.823-5.256,6.317-3.432,10.036c1.303,2.657,3.967,4.2,6.739,4.2 c1.108,0,2.234-0.247,3.296-0.768l38-18.633c2.57-1.26,4.198-3.872,4.198-6.734s-1.628-5.474-4.198-6.734l-38-18.633 c-3.717-1.823-8.211-0.288-10.035,3.432C180.337,117.178,181.874,121.671,185.593,123.495z" fill="#000000" style="fill: rgb(247, 247, 247);"></path><path d="M181.8,268.949h-0.234l-8.936-30.41h-15.41v42.832h10.254v-18.604c0-2.91-0.205-6.992-0.615-12.246h0.264l8.76,30.85 h11.016l8.643-30.791h0.264c-0.234,4.648-0.366,7.569-0.395,8.76c-0.029,1.191-0.044,2.275-0.044,3.252v18.779h10.635v-42.832 H190.56L181.8,268.949z" fill="#000000" style="fill: rgb(247, 247, 247);"></path><polygon points="118.636,248.002 129.095,248.002 129.095,281.371 140.667,281.371 140.667,248.002 151.097,248.002 151.097,238.539 118.636,238.539 " fill="#000000" style="fill: rgb(247, 247, 247);"></polygon><polygon points="226.8,238.539 215.228,238.539 215.228,281.371 243.294,281.371 243.294,272.025 226.8,272.025 " fill="#000000" style="fill: rgb(247, 247, 247);"></polygon><path d="M283.149,52.722L232.624,2.197C231.218,0.79,229.311,0,227.321,0H40.342c-4.142,0-7.5,3.358-7.5,7.5v303.188 c0,4.142,3.358,7.5,7.5,7.5h237.504c4.142,0,7.5-3.358,7.5-7.5V58.025C285.346,56.036,284.556,54.129,283.149,52.722z M234.821,25.606l24.918,24.919h-24.918V25.606z M47.842,15h171.979v10.263H47.842V15z M47.842,303.188V40.263h171.979v17.763 c0,4.142,3.358,7.5,7.5,7.5h43.024v237.662H47.842z" fill="#000000" style="fill: rgb(247, 247, 247);"></path><path d="M175.08,91.976c-3.894-1.41-8.195,0.6-9.607,4.494l-26.374,72.734c-1.412,3.894,0.6,8.195,4.494,9.607 c0.844,0.306,1.707,0.451,2.556,0.451c3.067,0,5.945-1.896,7.051-4.945l26.374-72.734 C180.986,97.689,178.974,93.388,175.08,91.976z" fill="#000000" style="fill: rgb(247, 247, 247);"></path></g></g></g></svg>
</div>
</div>
<div id="overlayBlock" class="overlay-block">
<!-- Кнопка для проверки работы -->
<button id="getBtn" style="position: absolute; top: 60px; right: 32px;">Виджет GC</button>
<!-- Кнопка для открытия модального окна -->
<button id="myBtn" style="position: absolute; top: 90px; right: 10px;">Открыть модальное</button>
<button id="myBtn_2" style="position: absolute; top: 120px; right: 10px;">Открыть модальное_2</button>
<button id="myBtn_3" style="position: absolute; top: 150px; right: 10px;">Открыть модальное_3</button>
</div>
<div id="gjs" style="height: 90vh;"></div>
<!-- The Modal -->
<div id="myModal_1" class="modal_1">
<!-- Модальное содержание -->
<div class="modal-content_1">
<div class="modal-header_1">
<span class="close_1">&times;</span>
<h2>HTMLешка</h2>
</div>
<div class="modal-body_1">
<p>Некоторый текст в модальном теле</p>
<iframe id="iframe1" src="https://diamonik7777-up-fail.hf.space/up_page" title="Iframe Example"></iframe>
<br><br><br>
</div>
<div class="modal-footer_1">
<h3>Добавление HTML файла с пользовательским маршрутом.</h3>
</div>
</div>
</div>
<!-- The Modal_2 -->
<div id="myModal_2" class="modal_2">
<!-- Модальное содержание -->
<div class="modal-content_2">
<div class="modal-header_2">
<span class="close_2">&times;</span>
<h2>HTMLешка</h2>
</div>
<div class="modal-body_2">
<style>
/* Общие стили для всех iframe */
iframe {
width: 100%; /* Ширина на 100% от родительского элемента */
height: 500px; /* Фиксированная высота */
border: none; /* Убираем границы */
}
/* Индивидуальные стили для каждого iframe, если необходимо */
#iframe1 {
/* Дополнительные стили для первого iframe */
}
</style>
<iframe id="iframe2" src="https://diamonik7777-up-fail.hf.space/up_fa" title="Iframe Example"></iframe>
<iframe id="iframe3" src="https://dmtuit-psy-vk.hf.space/buil_json?api_sys=fasSd345D" title="Iframe Example"></iframe>
<br><br><br>
</div>
<div class="modal-footer_2">
<h3>Добавление HTML файла с пользовательским маршрутом.</h3>
</div>
</div>
</div>
<!-- The Modal_3 -->
<div id="myModal_3" class="modal_3">
<!-- Модальное содержание -->
<div class="modal-content_3">
<div class="modal-header_3">
<span class="close_3">&times;</span>
<h2>HTMLешка</h2>
</div>
<div class="modal-body_3">
<br><br><br>
</div>
<div class="modal-footer_3">
<h3>Добавление HTML файла с пользовательским маршрутом.</h3>
</div>
</div>
</div>
<script type="text/javascript" src="https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/iflame_in.js"></script>
<script>
// Инициализация GrapesJS редактора
const editor = grapesjs.init({
container: "#gjs",
fromElement: true,
height: "100vh",
storageManager: {
type: 'local',
autosave: true,
autoload: true,
stepsBeforeSave: 1,
},
plugins: [
"gjs-blocks-basic",
"grapesjs-component-countdown",
"grapesjs-component-code-editor",
"grapesjs-templates",
"grapesjs-rte-extensions",
"grapesjs-user-blocks"
],
pluginsOpts: {
"gjs-blocks-basic": {
blocks: ['column1', 'column2', 'column3', 'column3-7', 'text', 'quote', 'social'],
blocksBasicOpts: {
flexGrid: true,
stylePrefix: 'gjs-',
columns: 12,
rowHeight: 75,
addBasicStyle: true
}
},
"grapesjs-component-code-editor": {
panelId: 'views-container',
appendTo: '.gjs-pn-views-container',
openState: { pn: '35%', cv: '65%' },
closedState: { pn: '15%', cv: '85%' },
codeViewOptions: {},
preserveWidth: false,
clearData: false,
editJs: true,
cleanCssBtn: true,
htmlBtnText: 'Применить',
cssBtnText: 'Применить',
cleanCssBtnText: 'Удалить'
},
"grapesjs-templates": {
// Настройки для grapesjs-templates
},
"grapesjs-rte-extensions": {
base: {
bold: true,
italic: true,
underline: true,
strikethrough: true,
link: true,
},
fonts: {
fontColor: true,
hilite: true,
},
format: {
heading1: true,
heading2: true,
heading3: true,
paragraph: true,
clearFormatting: true,
},
align: true,
darkColorPicker: true,
maxWidth: '600px'
},
"grapesjs-user-blocks": {
// Настройки для grapesjs-user-blocks
}
},
});
</script>
<script type="text/javascript" src="https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/rus/rus.js"></script>
<script>
// Создаем новый тип компонента для настройки меню
editor.Components.addType('menu-settings-block', {
model: {
defaults: {
// HTML-код пустого блока с постоянным идентификатором
content: '<div id="set_avp_2"></div>',
// Скрипт для обработки блока (если нужно)
script: function(props) {
const initBlock = () => {
console.log('Menu settings block initialized with props:');
};
const loadScript = (src, callback) => {
const script = document.createElement('script');
script.src = src;
script.onload = callback;
document.body.appendChild(script);
};
// Загружаем необходимые скрипты динамически
loadScript('https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/menu.js', () => {
console.log('Custom script loaded!');
initBlock();
});
},
}
}
});
// Создаем блок для компонента настройки меню
editor.Blocks.add('menu-settings-block-block', {
label: `
<div style="display: flex; flex-direction: column; align-items: center;">
<!-- icon666.com - MILLIONS vector ICONS FREE --><svg enable-background="new 0 0 152 152" xmlns="http://www.w3.org/2000/svg" width="36" height="36"><g id="Layer_2" data-name="Layer 2"><path d="m28 3h-16a3 3 0 0 0 0 6h16a3 3 0 0 0 0-6zm0 4h-16a1 1 0 0 1 0-2h16a1 1 0 0 1 0 2z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m4 3a3 3 0 1 0 3 3 3 3 0 0 0 -3-3zm0 4a1 1 0 1 1 1-1 1 1 0 0 1 -1 1z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m28 13h-16a3 3 0 0 0 0 6h16a3 3 0 0 0 0-6zm0 4h-16a1 1 0 0 1 0-2h16a1 1 0 0 1 0 2z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m4 13a3 3 0 1 0 3 3 3 3 0 0 0 -3-3zm0 4a1 1 0 1 1 1-1 1 1 0 0 1 -1 1z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m28 23h-16a3 3 0 0 0 0 6h16a3 3 0 0 0 0-6zm0 4h-16a1 1 0 0 1 0-2h16a1 1 0 0 1 0 2z" fill="#000000" style="fill: rgb(250, 250, 250);"></path><path d="m4 23a3 3 0 1 0 3 3 3 3 0 0 0 -3-3zm0 4a1 1 0 1 1 1-1 1 1 0 0 1 -1 1z" fill="#000000" style="fill: rgb(250, 250, 250);"></path></g></svg>
<span style="margin-top: 8px;">menu-set</span>
</div>`,
content: { type: 'menu-settings-block' },
});
</script>
<script>
// Добавление кнопки для открытия редактора кода
const pn = editor.Panels;
const panelViews = pn.addPanel({
id: "views",
});
panelViews.get("buttons").add([
{
attributes: {
title: editor.I18n.t('panels.buttons.open-code'),
},
className: "fa fa-file-code-o",
command: "open-code",
editJs: true,
togglable: false,
id: "open-code",
},
]);
// Добавление команды для импорта HTML и CSS
editor.Commands.add('gjs-open-import-webpage', {
run(editor, sender) {
sender && sender.set('active', 0);
const modal = editor.Modal;
const container = document.createElement('div');
const importLabel = document.createElement('div');
importLabel.innerHTML = editor.I18n.t('commands.gjs-open-import-webpage.label');
const importInput = document.createElement('textarea');
importInput.style.width = '100%';
importInput.style.height = '200px';
importInput.placeholder = 'HTML/CSS code...';
const importButton = document.createElement('button');
importButton.innerHTML = editor.I18n.t('panels.buttons.gjs-open-import-webpage');
importButton.onclick = () => {
const code = importInput.value;
try {
const parser = new DOMParser();
const doc = parser.parseFromString(code, 'text/html');
const html = doc.body.innerHTML;
const css = Array.from(doc.querySelectorAll('style')).map(style => style.innerHTML).join('\n');
if (html) {
editor.setComponents(html);
editor.setStyle(css);
modal.close();
}
} catch (error) {
console.error('Error parsing HTML/CSS:', error);
}
};
container.appendChild(importLabel);
container.appendChild(importInput);
container.appendChild(importButton);
modal.setTitle(editor.I18n.t('commands.gjs-open-import-webpage.title'));
modal.setContent(container);
modal.open();
}
});
// Добавление кнопки для импорта в панель
pn.addButton('options', {
id: 'gjs-open-import-webpage',
className: 'fa fa-download',
command: 'gjs-open-import-webpage',
attributes: {
title: editor.I18n.t('panels.buttons.gjs-open-import-webpage'),
'data-tooltip-pos': 'bottom',
},
});
// Добавление кнопок для отмены и повтора действий
pn.addButton('options', {
id: 'undo',
className: 'fa fa-undo',
command: function() { editor.runCommand('core:undo') },
attributes: {
title: 'Undo',
'data-tooltip-pos': 'bottom',
},
});
pn.addButton('options', {
id: 'redo',
className: 'fa fa-repeat',
command: function() { editor.runCommand('core:redo') },
attributes: {
title: 'Redo',
'data-tooltip-pos': 'bottom',
},
});
// Добавление кнопки для очистки всего содержимого редактора
pn.addButton('options', {
id: 'clear-canvas',
className: 'fa fa-trash',
command: 'core:canvas-clear',
attributes: {
title: 'Очистить холст',
'data-tooltip-pos': 'bottom',
},
});
</script>
<script>
// Get the modal
var modal_1 = document.getElementById("myModal_1");
// Get the button that opens the modal
var btn_1 = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span_1 = document.getElementsByClassName("close_1")[0];
// When the user clicks the button, open the modal
btn_1.onclick = function() {
modal_1.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span_1.onclick = function() {
modal_1.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal_1) {
modal_1.style.display = "none";
}
}
</script>
<script>
// Get the modal_2
var modal_2 = document.getElementById("myModal_2");
// Get the button that opens the modal
var btn_2 = document.getElementById("myBtn_2");
// Get the <span> element that closes the modal
var span_2 = document.getElementsByClassName("close_2")[0];
// When the user clicks the button, open the modal
btn_2.onclick = function() {
modal_2.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span_2.onclick = function() {
modal_2.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal_2) {
modal_2.style.display = "none";
}
}
</script>
<script>
// Get the modal_3
var modal_3 = document.getElementById("myModal_3");
// Get the button that opens the modal
var btn_3 = document.getElementById("myBtn_3");
// Get the <span> element that closes the modal
var span_3 = document.getElementsByClassName("close_3")[0];
// When the user clicks the button, open the modal
btn_3.onclick = function() {
modal_3.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span_3.onclick = function() {
modal_3.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal_3) {
modal_3.style.display = "none";
}
}
</script>
<script>
document.addEventListener('DOMContentLoaded', () => {
console.log('DOMContentLoaded выполнен');
// Функция для тестовой кнопки
document.getElementById('vkontBtn').addEventListener('click', function() {
console.log('Тестовая кнопка работает!');
// Получаем HTML-код из GrapesJS
const editor = grapesjs.editors[0]; // Предполагается, что у вас есть только один редактор
const htmlContent = editor.getHtml();
const cssContent = editor.getCss();
// Генерация HTML-контента
const fullHtmlContent = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Скачанная HTML-страница</title>
<style>${cssContent}</style>
</head>
<body>
${htmlContent}
</body>
</html>
`;
// Скачивание файла
const blob = new Blob([fullHtmlContent], { type: 'text/html' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = 'downloaded_page.html';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
});
});
</script>
<script>
document.addEventListener('DOMContentLoaded', () => {
console.log('DOMContentLoaded выполнен');
// Функция для тестовой кнопки
document.getElementById('getBtn').addEventListener('click', function() {
console.log('Тестовая кнопка работает!');
// Получаем HTML-код и CSS из GrapesJS
const editor = grapesjs.editors[0]; // Предполагается, что у вас есть только один редактор
const htmlContent = editor.getHtml();
const cssContent = editor.getCss();
// Создаем строку с HTML и CSS кодом, разделенную специальным символом или строкой
const codeContent = `
===== HTML =====
${htmlContent}
===== CSS =====
${cssContent}
`;
// Скачивание файла
const blob = new Blob([codeContent], { type: 'text/plain' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = 'code_content.txt';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
});
});
</script>
<script>
document.getElementById('uploadForm').addEventListener('submit', function(event) {
event.preventDefault();
var formData = new FormData(this);
var request = new XMLHttpRequest();
request.open('POST', '/up_page');
request.upload.addEventListener('progress', function(event) {
if (event.lengthComputable) {
var percentComplete = (event.loaded / event.total) * 100;
document.getElementById('progressBar').style.width = percentComplete + '%';
document.getElementById('progressBar').innerText = Math.round(percentComplete) + '%';
}
}, false);
request.addEventListener('load', function(event) {
var response = event.target.responseText;
if (event.target.status === 200) {
var fullUrl = response.split('saved to ')[1];
document.getElementById('imageUrl').innerText = 'Click to copy URL';
document.getElementById('imageUrl').setAttribute('data-url', fullUrl);
Toastify({
text: "File uploaded successfully",
duration: 3000,
gravity: "top",
position: "center",
backgroundColor: "#4CAF50",
}).showToast();
} else if (event.target.status === 409) {
Toastify({
text: "File with this name already exists",
duration: 3000,
gravity: "top",
position: "center",
backgroundColor: "#FF5733",
}).showToast();
}
document.getElementById('progressBar').style.width = '0%';
document.getElementById('progressBar').innerText = '0%';
}, false);
request.send(formData);
});
function copyToClipboard(element) {
var tempInput = document.createElement("input");
tempInput.value = element.getAttribute('data-url');
document.body.appendChild(tempInput);
tempInput.select();
document.execCommand("copy");
document.body.removeChild(tempInput);
Toastify({
text: "URL copied to clipboard",
duration: 3000,
gravity: "top",
position: "center",
backgroundColor: "#4CAF50",
}).showToast();
}
</script>
</body>
</html>