Update buil_json.html
Browse files- buil_json.html +26 -17
buil_json.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Video List Editor</title>
|
| 7 |
-
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/9.9.2/jsoneditor.min.css" />
|
| 9 |
<style>
|
| 10 |
body {
|
|
@@ -75,9 +75,9 @@
|
|
| 75 |
<button id="saveToClipboard">Сохранить в буфер обмена</button>
|
| 76 |
</div>
|
| 77 |
<div id="jsoneditor"></div>
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
<script>
|
| 82 |
document.addEventListener('DOMContentLoaded', function() {
|
| 83 |
const container = document.getElementById('jsoneditor');
|
|
@@ -106,19 +106,28 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 106 |
document.getElementById('saveToClipboard').addEventListener('click', function() {
|
| 107 |
const json = editor.get();
|
| 108 |
const jsonString = JSON.stringify(json, null, 2); // Добавляем отступы для читаемости
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
});
|
| 123 |
});
|
| 124 |
});
|
|
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Video List Editor</title>
|
| 7 |
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/9.9.2/jsoneditor.min.css" />
|
| 9 |
<style>
|
| 10 |
body {
|
|
|
|
| 75 |
<button id="saveToClipboard">Сохранить в буфер обмена</button>
|
| 76 |
</div>
|
| 77 |
<div id="jsoneditor"></div>
|
| 78 |
+
|
| 79 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/9.9.2/jsoneditor.min.js"></script>
|
| 80 |
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
|
| 81 |
<script>
|
| 82 |
document.addEventListener('DOMContentLoaded', function() {
|
| 83 |
const container = document.getElementById('jsoneditor');
|
|
|
|
| 106 |
document.getElementById('saveToClipboard').addEventListener('click', function() {
|
| 107 |
const json = editor.get();
|
| 108 |
const jsonString = JSON.stringify(json, null, 2); // Добавляем отступы для читаемости
|
| 109 |
+
|
| 110 |
+
navigator.permissions.query({name: 'clipboard-write'}).then(result => {
|
| 111 |
+
if (result.state === 'granted' || result.state === 'prompt') {
|
| 112 |
+
navigator.clipboard.writeText(jsonString).then(() => {
|
| 113 |
+
Toastify({
|
| 114 |
+
text: "Видеолист скопирован!",
|
| 115 |
+
duration: 3000, // Показывать 3 секунды
|
| 116 |
+
newWindow: true,
|
| 117 |
+
close: true,
|
| 118 |
+
gravity: "top", // Показывать сверху
|
| 119 |
+
position: "center", // Позиционировать по центру
|
| 120 |
+
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
| 121 |
+
stopOnFocus: true // Останавливать таймер при фокусе на сообщении
|
| 122 |
+
}).showToast();
|
| 123 |
+
}).catch(err => {
|
| 124 |
+
console.error('Could not copy text: ', err);
|
| 125 |
+
});
|
| 126 |
+
} else {
|
| 127 |
+
console.error('Permission to write to clipboard not granted.');
|
| 128 |
+
}
|
| 129 |
+
}).catch(err => {
|
| 130 |
+
console.error('Error querying clipboard permissions: ', err);
|
| 131 |
});
|
| 132 |
});
|
| 133 |
});
|