release
This commit is contained in:
+39
-1
@@ -151,4 +151,42 @@ document.getElementById('base_photo_url').addEventListener('focus', function ()
|
||||
if (!this.value) {
|
||||
showAlert('info', 'Формат ID фото: photo_id (например: 7236456789)');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function handleLink() {
|
||||
const link = prompt('Введите ссылку на фотографию:');
|
||||
if (!link) return;
|
||||
|
||||
try {
|
||||
const url = new URL(link);
|
||||
const zParam = url.searchParams.get('z');
|
||||
|
||||
if (!zParam || !zParam.startsWith('photo')) {
|
||||
alert('Некорректная ссылка на фото ВК');
|
||||
return;
|
||||
}
|
||||
|
||||
const decoded = decodeURIComponent(zParam);
|
||||
const match = decoded.match(/photo(-?\d+)_(\d+)/);
|
||||
|
||||
if (!match) {
|
||||
alert('Не удалось разобрать ссылку');
|
||||
return;
|
||||
}
|
||||
|
||||
const groupId = Math.abs(Number(match[1]));
|
||||
const photoId = Number(match[2]);
|
||||
|
||||
const isConfirmed = window.confirm(
|
||||
`Применить новые данные?\nГруппа: ${groupId}\nID фото: ${photoId}`
|
||||
);
|
||||
|
||||
if (isConfirmed) {
|
||||
document.getElementById('group_id').value = groupId;
|
||||
document.getElementById('base_photo_url').value = photoId;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
alert('Ошибка обработки ссылки');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user