This commit is contained in:
2025-12-21 15:12:09 +03:00
parent e149d7380d
commit 865224ba5a
10 changed files with 145 additions and 156 deletions
+39 -1
View File
@@ -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('Ошибка обработки ссылки');
}
}