84 lines
3.9 KiB
HTML
84 lines
3.9 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="ru">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>🔧 Отладка JavaScript</title>
|
||
<style>
|
||
body { font-family: Arial, sans-serif; padding: 20px; }
|
||
.test-button { background: #28a745; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; margin: 10px; }
|
||
.log { background: #f8f9fa; padding: 15px; border-radius: 5px; font-family: monospace; margin: 10px 0; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<h1>🔧 Отладка JavaScript функций</h1>
|
||
|
||
<h3>Тест 1: Простая кнопка</h3>
|
||
<button class="test-button" onclick="alert('Простая кнопка работает!')">
|
||
Простой тест
|
||
</button>
|
||
|
||
<h3>Тест 2: Кнопка с функцией</h3>
|
||
<button class="test-button" onclick="testFunction('123', 'test.docx')">
|
||
Тест функции
|
||
</button>
|
||
|
||
<h3>Тест 3: Копия кнопки из CRM</h3>
|
||
<button type="button" class="btn btn-success btn-small" onclick="testEditButton('12345', 'document.docx')" style="margin-right: 5px;" title="Редактировать в Nextcloud">
|
||
<i class="fa fa-edit"></i> Редактировать (копия из CRM)
|
||
</button>
|
||
|
||
<div class="log" id="log"></div>
|
||
|
||
<script>
|
||
function addLog(message) {
|
||
const log = document.getElementById('log');
|
||
const timestamp = new Date().toLocaleTimeString();
|
||
log.innerHTML += `[${timestamp}] ${message}<br>`;
|
||
}
|
||
|
||
function testFunction(id, name) {
|
||
addLog('testFunction вызвана с параметрами: ' + id + ', ' + name);
|
||
alert('testFunction работает!\nID: ' + id + '\nName: ' + name);
|
||
}
|
||
|
||
// Проверяем есть ли глобальная функция testEditButton
|
||
function checkGlobalFunction() {
|
||
if (typeof window.testEditButton === 'function') {
|
||
addLog('✅ Глобальная функция testEditButton найдена');
|
||
} else {
|
||
addLog('❌ Глобальная функция testEditButton НЕ найдена');
|
||
|
||
// Создаём локальную версию
|
||
window.testEditButton = function(recordId, fileName) {
|
||
addLog('testEditButton (локальная) вызвана: ' + recordId + ', ' + fileName);
|
||
alert('testEditButton (локальная версия) работает!\nRecord ID: ' + recordId + '\nFile Name: ' + fileName);
|
||
};
|
||
|
||
addLog('✅ Создана локальная версия testEditButton');
|
||
}
|
||
}
|
||
|
||
document.addEventListener('DOMContentLoaded', function() {
|
||
addLog('Страница загружена');
|
||
checkGlobalFunction();
|
||
|
||
// Проверяем через 2 секунды (может функция загружается позже)
|
||
setTimeout(function() {
|
||
addLog('=== Повторная проверка через 2 секунды ===');
|
||
checkGlobalFunction();
|
||
}, 2000);
|
||
});
|
||
|
||
// Перехватываем ошибки
|
||
window.onerror = function(msg, url, line, col, error) {
|
||
addLog('❌ JavaScript ошибка: ' + msg + ' (строка ' + line + ')');
|
||
};
|
||
</script>
|
||
|
||
<!-- Подключаем Bootstrap и FontAwesome для стилей -->
|
||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
|
||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
|
||
</body>
|
||
</html>
|