DmitrMakeev commited on
Commit
2b7a9b4
·
verified ·
1 Parent(s): e0f1b2e

Update js/rus/rus.js

Browse files
Files changed (1) hide show
  1. js/rus/rus.js +208 -1
js/rus/rus.js CHANGED
@@ -94,4 +94,211 @@ editor.I18n.addMessages({
94
  attributes: {
95
  class: 'fa fa-align-center'
96
  }
97
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  attributes: {
95
  class: 'fa fa-align-center'
96
  }
97
+ });
98
+
99
+
100
+
101
+ // Создаем новый тип компонента для блока настроек
102
+ editor.Components.addType('empty-block', {
103
+ model: {
104
+ defaults: {
105
+ // HTML-код пустого блока с постоянным идентификатором
106
+ content: '<div id="set_avp"></div>',
107
+ // Скрипт для обработки блока (если нужно)
108
+ script: function(props) {
109
+ window.avp = props.avp;
110
+ window.grup = props.grup;
111
+ window.red_url = props.red_url;
112
+ window.pol_a = props.pol_a;
113
+ window.pol_b = props.pol_b;
114
+ window.new_w = props.new_w;
115
+ const initBlock = () => {
116
+ console.log('Empty block initialized with props:', { avp, grup, red_url, pol_a, pol_b, new_w });
117
+ };
118
+ const loadScript = (src, callback) => {
119
+ const script = document.createElement('script');
120
+ script.src = src;
121
+ script.onload = callback;
122
+ document.body.appendChild(script);
123
+ };
124
+ // Загружаем необходимые скрипты динамически
125
+ if (typeof vkBridge === 'undefined') {
126
+ loadScript('https://unpkg.com/@vkontakte/vk-bridge/dist/browser.min.js', () => {
127
+ console.log('VK Bridge loaded!');
128
+ initBlock();
129
+ });
130
+ } else {
131
+ initBlock();
132
+ }
133
+
134
+ if (typeof VK === 'undefined') {
135
+ loadScript('https://vk.com/js/api/openapi.js?169', () => {
136
+ console.log('VK Open API loaded!');
137
+ });
138
+ }
139
+
140
+ loadScript('https://huggingface.co/spaces/vkatis/api/resolve/main/bundle.3ea86973b4b6c8f6c2bf.js', () => {
141
+ console.log('Custom script loaded!');
142
+ });
143
+ },
144
+ // Свойства, которые будут передаваться в скрипт
145
+ 'script-props': ['avp', 'grup', 'red_url', 'pol_a', 'pol_b', 'new_w'],
146
+ // Настройки для изменения URL отправки
147
+ traits: [
148
+ {
149
+ type: 'text',
150
+ name: 'avp',
151
+ label: 'AVP',
152
+ changeProp: true
153
+ },
154
+ {
155
+ type: 'text',
156
+ name: 'grup',
157
+ label: 'GRUP',
158
+ changeProp: true
159
+ },
160
+ {
161
+ type: 'text',
162
+ name: 'red_url',
163
+ label: 'RED_URL',
164
+ changeProp: true
165
+ },
166
+ {
167
+ type: 'text',
168
+ name: 'pol_a',
169
+ label: 'POL_A',
170
+ changeProp: true
171
+ },
172
+ {
173
+ type: 'text',
174
+ name: 'pol_b',
175
+ label: 'POL_B',
176
+ changeProp: true
177
+ },
178
+ {
179
+ type: 'text',
180
+ name: 'new_w',
181
+ label: 'NEW_W',
182
+ changeProp: true
183
+ }
184
+ ]
185
+ }
186
+ }
187
+ });
188
+ // Создаем блок для компонента пустого блока
189
+ editor.Blocks.add('empty-block-block', {
190
+ label: 'Empty Block',
191
+ content: { type: 'empty-block' },
192
+ });
193
+
194
+
195
+
196
+ // Создаем новый тип компонента для настроек видеоплеера
197
+ editor.Components.addType('video-player-settings', {
198
+ model: {
199
+ defaults: {
200
+ // HTML-код блока настроек видеоплеера
201
+ content: '<div id="video-player-settings"></div>',
202
+ // Скрипт для обработки блока (если нужно)
203
+ script: function(props) {
204
+ window.vid_list = props.vid_list;
205
+ console.log('Video player settings initialized with vid_list:', vid_list);
206
+ // Подключение указанных скриптов
207
+ const loadScriptToHead = (src, callback) => {
208
+ const script = document.createElement('script');
209
+ script.src = src;
210
+ script.onload = callback;
211
+ document.head.appendChild(script);
212
+ };
213
+ const loadScriptToBody = (src, callback) => {
214
+ const script = document.createElement('script');
215
+ script.src = src;
216
+ script.onload = callback;
217
+ document.body.appendChild(script);
218
+ };
219
+ const library = props.library;
220
+ let playerjsSrc;
221
+ if (library === '1') {
222
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p1/playerjs.js';
223
+ } else if (library === '2') {
224
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p2/playerjs.js';
225
+ } else if (library === '3') {
226
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p3/playerjs.js';
227
+ } else if (library === '4') {
228
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p4/playerjs.js';
229
+ } else if (library === '5') {
230
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p5/playerjs.js';
231
+ } else if (library === '6') {
232
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p6/playerjs.js';
233
+ } else if (library === '7') {
234
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p7/playerjs.js';
235
+ } else if (library === '8') {
236
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p8/playerjs.js';
237
+ } else if (library === '9') {
238
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p9/playerjs.js';
239
+ } else if (library === '10') {
240
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p10/playerjs.js';
241
+ } else if (library === '11') {
242
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p11/playerjs.js';
243
+ } else if (library === '12') {
244
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p12/playerjs.js';
245
+ } else if (library === '13') {
246
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p13/playerjs.js';
247
+ } else if (library === '14') {
248
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p14/playerjs.js';
249
+ } else if (library === '15') {
250
+ playerjsSrc = 'https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/p15/playerjs.js';
251
+ }
252
+ if (playerjsSrc) {
253
+ loadScriptToHead(playerjsSrc, () => {
254
+ console.log('PlayerJS script loaded!');
255
+ loadScriptToBody('https://huggingface.co/spaces/DMTuit/psy_vk/resolve/main/js/playerst.js', () => {
256
+ console.log('PlayerST script loaded!');
257
+ });
258
+ });
259
+ }
260
+ },
261
+ // Свойства, которые будут передаваться в скрипт
262
+ 'script-props': ['vid_list', 'library'],
263
+ // Настройки для ввода JSON-строки с данными о видео
264
+ traits: [
265
+ {
266
+ type: 'select',
267
+ name: 'library',
268
+ label: 'Library',
269
+ options: [
270
+ { value: '1', name: 'Плеер - 1' },
271
+ { value: '2', name: 'Плеер - 2' },
272
+ { value: '3', name: 'Плеер - 3' },
273
+ { value: '4', name: 'Плеер - 4' },
274
+ { value: '5', name: 'Плеер - 5' },
275
+ { value: '6', name: 'Плеер - 6' },
276
+ { value: '7', name: 'Плеер - 7' },
277
+ { value: '8', name: 'Плеер - 8' },
278
+ { value: '9', name: 'Плеер - 9' },
279
+ { value: '10', name: 'Плеер - 10' },
280
+ { value: '11', name: 'Плеер - 11' },
281
+ { value: '12', name: 'Плеер - 12' },
282
+ { value: '13', name: 'Плеер - 13' },
283
+ { value: '14', name: 'Плеер - 14' },
284
+ { value: '15', name: 'Плеер - 15' }
285
+ ],
286
+ changeProp: true
287
+ },
288
+ {
289
+ type: 'text',
290
+ name: 'vid_list',
291
+ label: 'Video List',
292
+ changeProp: true,
293
+ placeholder: '[{"title":"Название","file":"URL"},...]',
294
+ style: { width: '100%', height: '200px' } // Широкое поле ввода
295
+ }
296
+ ]
297
+ }
298
+ }
299
+ });
300
+ // Создаем блок для компонента настроек видеоплеера
301
+ editor.Blocks.add('video-player-settings-block', {
302
+ label: 'Воспроизведение медиа',
303
+ content: { type: 'video-player-settings' },
304
+ });