DmitrMakeev commited on
Commit
95397fc
·
verified ·
1 Parent(s): e2c5df1

Update buil_json.html

Browse files
Files changed (1) hide show
  1. buil_json.html +17 -26
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
- <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,9 +75,9 @@
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,28 +106,19 @@ 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
- 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
  });
 
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
+ navigator.clipboard.writeText(jsonString).then(function() {
110
+ Toastify({
111
+ text: "Видеолист скопирован!",
112
+ duration: 3000, // Показывать 3 секунды
113
+ newWindow: true,
114
+ close: true,
115
+ gravity: "top", // Показывать сверху
116
+ position: "center", // Позиционировать по центру
117
+ backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
118
+ stopOnFocus: true // Останавливать таймер при фокусе на сообщении
119
+ }).showToast();
120
+ }, function(err) {
121
+ console.error('Could not copy text: ', err);
 
 
 
 
 
 
 
 
 
122
  });
123
  });
124
  });