PageSourceSearch

https://xn-----7kcbbyekiq2bcen1al.xn--p1ai/assets/js/global/main.js

js xn-----7kcbbyekiq2bcen1al.xn--p1ai collected 2026-10-04 03:26:14 UTC 8,503 bytes, 321 lines download raw bytes

1function getCleanLocalURLPath(url) {
2
3	// Добавляем домен, если отсутствует
4	if (!url.includes(window.location.origin)) {
5		url = `${window.location.origin}${url}`;
6	}
7
8	var parsed = new URL(url);
9
10	return parsed.pathname;
11}
12
13function startChatWithLotOwnerAsGuest(lot_id) {
14	const modal = $('#modal-md');
15	modal.data('id', lot_id);
16	modal.data('type', 'alertNotSession');
17
18	if (modal.dialog('isOpen') === true) {
19		loadContentModal(modal);
20	} else {
21		modal.dialog('open');
22		loadContentModal(modal);
23	}
24}
25
26function ceilDateToClosest15Minutes(date) {
27	var minutes = date.getMinutes();
28	var remainder = minutes % 15;
29
30	if (remainder !== 0) {
31		date.setMinutes(minutes + (15 - remainder));
32	}
33
34	date.setSeconds(0);
35	date.setMilliseconds(0);
36	return date;
37}
38
39function escapeHtml(text) {
40	const map = {
41		'&': '&',
42		'<': '&lt;',
43		'>': '&gt;',
44		'"': '&quot;',
45		"'": '&#39;'
46	};
47	return text.replace(/[&<>"']/g, (m) => map[m]);
48}
49
50function openLotDescriptionSpoiler(event, selector) {
51	const element = event.target;
52	$(element).remove();
53	$(selector).removeClass('spoiler-hidden');
54}
55
56function updateMomentTimeStrings() {
57	moment.locale('ru');
58
59	$('[data-moment-time]').each(function (index, v) {
60		const el = $(v);
61		var timestamp = el.data('moment-time');
62		var formatted = moment(Date.parse(timestamp)).fromNow(true);
63		el.text(formatted);
64	});
65}
66
67function unlockBodyScrollAfterModals() {
68	console.error('8dMya0lB');
69	// чтобы не нарушать "красоту" других открытых модалок
70	var anyDialogIsOpen = false;
71	$('.ui-dialog-content').each(function () {
72		var dialog = $(this);
73		if (dialog.dialog('instance') && dialog.dialog('isOpen')) {
74			anyDialogIsOpen = true;
75			return false;
76		}
77	});
78
79	if (!anyDialogIsOpen) {
80		$('.ui-widget-overlay').removeClass('blurred-bg').removeClass('blurred-bg-low');
81		$('html').removeClass('lock-scrolling').removeClass('hidden-scroll');
82	}
83}
84
85function _commonAjaxJsonErrorHandler(jqXHR, textStatus, errorThrown) {
86	try {
87		const errRes = jqXHR.responseJSON;
88		if (errRes && errRes.error) {
89			console.error('Ошибка:', errRes.error);
90			alert(`Ошибка: ${errRes.error}`);
91		}
92	} catch (e) {
93		console.error('AJAX Error:', textStatus, errorThrown);
94	}
95}
96
97// Запрет перехода по ссылке (открывается модалка)
98// TODO
99// Удалить после избавления
100$(document).on('click', '.lot.lnk', function (e) {
101	e.preventDefault();
102});
103
104// 
105$(document).on('click', '.jte-tag-create-new-lot', function () {
106	var modalData = _openModalWithContent('template#new-lot-creation-window', {}, { width: 441 });
107	var body = modalData.content_box;
108
109	modalData.modal.on('modal:close', function () {
110		body.off('.lotCreateWindow');
111		$(this).off('modal:close');
112	});
113
114	body.on('click.lotCreateWindow', '.jte-tag-ch-create-lot', function () {
115		const el = $(this);
116		const type = parseInt(el.data('type'));
117
118		body.find('.jte-tag-ch-create-lot').prop('disabled', true);
119
120		$.ajax({
121			url: '/lot/ajaxCreate',
122			type: 'POST',
123			dataType: 'json',
124			data: { type: type },
125			success: function (response) {
126				// костыль для публикаций
127				if (type == 7) {
128					var btngen = $(`<button data-id="${response.id}" data-lti="${type}" class="btn_lot_edit_frame"></button>`);
129					$('body').append(btngen);
130					btngen.trigger('click');
131					btngen.remove();
132				} else {
133					_openLotEditorModal({ lot_id: response.id, type: type });
134				}
135
136				modalData.modal.dialog('close');
137			},
138			error: _commonAjaxJsonErrorHandler
139		});
140	});
141});
142
143// закрытие модалки, в котором находится эта кнопка
144$(document).on('click', '.jte-tag-modal-frame-close', function () {
145	const el = $(this);
146	const parent = el.closest('.ui-dialog-content');
147	parent.dialog('close');
148});
149
150var __profileEditAvatarUploaderHandler = null;
151
152function _initProfileEditPage() {
153	if (__profileEditAvatarUploaderHandler !== null || __profileEditAvatarUploaderHandler != undefined) {
154		__profileEditAvatarUploaderHandler = null;
155	}
156
157	__profileEditAvatarUploaderHandler = new Dropzone('.jte-tag-profile-edit-avatar-uploader', {
158		previewsContainer: '.jte-tag-profile-edit-avatar-uploader .hidden-preview-container',
159		previewTemplate: '<div></div>',
160		clickable: '.jte-tag-profile-edit-avatar-uploader .jte-tag-ch-select-file',
161		resizeWidth: 1080,
162		resizeHeight: 1080,
163		thumbnailWidth: 130,
164		thumbnailHeight: 130,
165		url: '/cloud/uploads_avatar',
166		resizeQuality: 1,
167		parallelUploads: 1,
168		resizeMethod: 'contain',
169		paramName: 'file',
170		maxFiles: 1,
171		maxFilesize: 20000,
172		maxThumbnailFilesize: 20000,
173		acceptedFiles: 'image/jpg,image/jpeg,image/png',
174		success: function (file, response) {
175			var prev = $(file.previewElement);
176			prev.remove();
177
178			var el = $(this.element);
179			el.removeClass('--busy');
180
181			el.find('.generic-uploading-progress-bar').remove();
182
183			this.removeFile(this);
184			this.removeAllFiles(true);
185
186			try {
187				var response = JSON.parse(response);
188			} catch (error) {
189				console.error('Ошибка парсинга JSON: ', error.message);
190				return;
191			}
192
193			if (response.result && response.result == 1) {
194				var img = el.find('img');
195
196				img.attr('src', response.end_url);
197
198			} else {
199				if (response.error) {
200					alert(response.error);
201				}
202			}
203		},
204		init: function () {
205			const el = $(this.element);
206
207			this.on('addedfile', function (file) {
208				el.addClass('--busy');
209
210				var progressBar = $($('template#generic-uploading-progress-bar').html());
211
212				el.find('.this-avatar > .this-wrap').append(progressBar);
213
214				let span = progressBar.find('span');
215				let bar = progressBar.find('.this-progress');
216
217				progressBar.data('progress-delta', 0);
218				progressBar.data('progress', 0);
219
220				const intervalId = setInterval(() => {
221					var delta = progressBar.data('progress-delta');
222					var progress = progressBar.data('progress');
223
224					if (progress > delta) {
225						var nextDelta = Math.min(31.4 * 0.1 + delta, progress);
226						var nextDeltaTxt = '';
227						if (nextDelta < 10) {
228							nextDeltaTxt = nextDelta.toFixed(1);
229						} else {
230							nextDeltaTxt = Math.ceil(nextDelta);
231						}
232
233						progressBar.data('progress-delta', nextDelta);
234
235						span.text(`${nextDeltaTxt}%`);
236						bar.css('width', `${nextDelta}%`);
237					}
238
239					if (progress === undefined || delta >= 100) {
240						clearInterval(intervalId);
241					}
242				}, IS_MOBILE ? 100 : 25);
243			});
244
245			this.on('uploadprogress', function (file, progress, bytesSent) {
246				if (file.previewElement) {
247					var progressBar = el.find('.generic-uploading-progress-bar');
248					progressBar.data('progress', parseInt(progress));
249				}
250			});
251
252			this.on('error', function (file, errorMsg, xhr) {
253				alert(`Ошибка загрузки: ${errorMsg}`);
254				el.removeClass('--busy');
255				this.removeFile(file);
256				this.removeAllFiles();
257			});
258		}
259	});
260}
261
262$(document).ready(function () {
263	// TODO
264	console.log('Выставление отступа сверху страницы.');
265
266	var container = $('#container .lots');
267	if (container.length == 0) {
268		container = $('main');
269	}
270	container.css('padding-top', $('.header').innerHeight());
271
272	/**
273	 * Конфигурация главное модального окна
274	 */
275	$('#modal-main-frame-card-advanced').dialog(_mainAdvancedModalConfig);
276
277	//
278	const urlParts = new URL(window.location.href).pathname.split('/').filter(part => part !== '');
279
280	//
281	function __autoHighlightSectionTabBtn(index, v) {
282		const el = $(v);
283		var ps = el.attr('href').split('/').filter(p => p !== '');
284		console.log(ps[1]);
285		if (ps[1] == urlParts[1]) {
286			el.addClass('--current');
287			return false;
288		}
289	}
290
291	const navBlock = $('.jte-tag-primary-nav');
292
293	var __highlightMenuItem = function (menuTag) {
294		navBlock.find(`[data-menu-tag="${menuTag}"]`).addClass('--active');
295	};
296
297	switch (urlParts[0]) {
298		case 'main':
299			$('.lot-management-bar.main > .this-controls-panel .section-tab-btn').each(__autoHighlightSectionTabBtn);
300
301			if (!urlParts.hasOwnProperty[1] && URL_PARAMS.get('sort_money') == null && URL_PARAMS.get('srh') == null) {
302				// addClass('nav_active');
303				__highlightMenuItem('my-lots');
304			}
305
306			break;
307
308		case 'cabinet':
309			$('.lot-management-bar.cabinet > .this-controls-panel .section-tab-btn').each(__autoHighlightSectionTabBtn);
310
311			break;
312
313		case 'multiupload':
314			__highlightMenuItem('my-lots');
315
316		default:
317			break;
318	}
319
320	// навигационная панель в шапке
321});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.