Update pages.html
Browse files- pages.html +42 -40
pages.html
CHANGED
|
@@ -51,7 +51,7 @@
|
|
| 51 |
<script src="https://unpkg.com/grapesjs-user-blocks"></script>
|
| 52 |
|
| 53 |
|
| 54 |
-
|
| 55 |
|
| 56 |
|
| 57 |
<style>
|
|
@@ -418,44 +418,8 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
|
|
| 418 |
</div>
|
| 419 |
<div id="jsoneditor"></div>
|
| 420 |
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
document.addEventListener('DOMContentLoaded', function() {
|
| 424 |
-
const container = document.getElementById('jsoneditor');
|
| 425 |
-
const options = {
|
| 426 |
-
mode: 'code',
|
| 427 |
-
modes: ['code', 'tree'],
|
| 428 |
-
onError: function(err) {
|
| 429 |
-
alert(err.toString());
|
| 430 |
-
}
|
| 431 |
-
};
|
| 432 |
-
const editor = new JSONEditor(container, options);
|
| 433 |
-
let videoList = [];
|
| 434 |
-
editor.set(videoList);
|
| 435 |
-
document.getElementById('addVideo').addEventListener('click', function() {
|
| 436 |
-
const title = document.getElementById('title').value;
|
| 437 |
-
const file = document.getElementById('file').value;
|
| 438 |
-
if (title && file) {
|
| 439 |
-
videoList.push({ title, file });
|
| 440 |
-
editor.set(videoList);
|
| 441 |
-
document.getElementById('title').value = '';
|
| 442 |
-
document.getElementById('file').value = '';
|
| 443 |
-
} else {
|
| 444 |
-
alert('Please fill in both title and file URL.');
|
| 445 |
-
}
|
| 446 |
-
});
|
| 447 |
-
document.getElementById('saveToClipboard').addEventListener('click', function() {
|
| 448 |
-
const json = editor.get();
|
| 449 |
-
const jsonString = JSON.stringify(json); // Убираем параметры отступов
|
| 450 |
-
navigator.clipboard.writeText(jsonString).then(function() {
|
| 451 |
-
alert('JSON saved to clipboard!');
|
| 452 |
-
}, function(err) {
|
| 453 |
-
console.error('Could not copy text: ', err);
|
| 454 |
-
});
|
| 455 |
-
});
|
| 456 |
-
});
|
| 457 |
-
|
| 458 |
-
</script>
|
| 459 |
<br><br><br>
|
| 460 |
</div>
|
| 461 |
<div class="modal-footer_2">
|
|
@@ -850,7 +814,45 @@ window.onclick = function(event) {
|
|
| 850 |
|
| 851 |
|
| 852 |
|
| 853 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 854 |
|
| 855 |
|
| 856 |
|
|
|
|
| 51 |
<script src="https://unpkg.com/grapesjs-user-blocks"></script>
|
| 52 |
|
| 53 |
|
| 54 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/9.9.2/jsoneditor.min.js"></script>
|
| 55 |
|
| 56 |
|
| 57 |
<style>
|
|
|
|
| 418 |
</div>
|
| 419 |
<div id="jsoneditor"></div>
|
| 420 |
|
| 421 |
+
|
| 422 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 423 |
<br><br><br>
|
| 424 |
</div>
|
| 425 |
<div class="modal-footer_2">
|
|
|
|
| 814 |
|
| 815 |
|
| 816 |
|
| 817 |
+
<script>
|
| 818 |
+
// Редактор медиа листов Json
|
| 819 |
+
|
| 820 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 821 |
+
const container = document.getElementById('jsoneditor');
|
| 822 |
+
const options = {
|
| 823 |
+
mode: 'code',
|
| 824 |
+
modes: ['code', 'tree'],
|
| 825 |
+
onError: function(err) {
|
| 826 |
+
alert(err.toString());
|
| 827 |
+
}
|
| 828 |
+
};
|
| 829 |
+
const editor = new JSONEditor(container, options);
|
| 830 |
+
let videoList = [];
|
| 831 |
+
editor.set(videoList);
|
| 832 |
+
document.getElementById('addVideo').addEventListener('click', function() {
|
| 833 |
+
const title = document.getElementById('title').value;
|
| 834 |
+
const file = document.getElementById('file').value;
|
| 835 |
+
if (title && file) {
|
| 836 |
+
videoList.push({ title, file });
|
| 837 |
+
editor.set(videoList);
|
| 838 |
+
document.getElementById('title').value = '';
|
| 839 |
+
document.getElementById('file').value = '';
|
| 840 |
+
} else {
|
| 841 |
+
alert('Please fill in both title and file URL.');
|
| 842 |
+
}
|
| 843 |
+
});
|
| 844 |
+
document.getElementById('saveToClipboard').addEventListener('click', function() {
|
| 845 |
+
const json = editor.get();
|
| 846 |
+
const jsonString = JSON.stringify(json); // Убираем параметры отступов
|
| 847 |
+
navigator.clipboard.writeText(jsonString).then(function() {
|
| 848 |
+
alert('JSON saved to clipboard!');
|
| 849 |
+
}, function(err) {
|
| 850 |
+
console.error('Could not copy text: ', err);
|
| 851 |
+
});
|
| 852 |
+
});
|
| 853 |
+
});
|
| 854 |
+
|
| 855 |
+
</script>
|
| 856 |
|
| 857 |
|
| 858 |
|