-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug.html
109 lines (99 loc) · 3.59 KB
/
debug.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Yamli Debug</title>
<script>
// Intercept and log all network requests
const originalFetch = window.fetch;
window.fetch = function() {
console.log('Fetch request:', arguments);
return originalFetch.apply(this, arguments);
};
const originalXHR = window.XMLHttpRequest;
window.XMLHttpRequest = function() {
const xhr = new originalXHR();
const originalOpen = xhr.open;
xhr.open = function() {
console.log('XHR request:', arguments);
return originalOpen.apply(this, arguments);
};
return xhr;
};
</script>
<script type="text/javascript" src="https://api.yamli.com/js/yamli_api.js"></script>
<script>
// Log all script loads
document.addEventListener('DOMContentLoaded', () => {
console.log('All loaded scripts:');
document.querySelectorAll('script').forEach(script => {
console.log('Script:', script.src || 'inline');
});
});
// Log Yamli object structure
function dumpObject(obj, path = '', seen = new Set()) {
if (obj === null || typeof obj !== 'object') {
console.log(path + ':', obj);
return;
}
if (seen.has(obj)) {
console.log(path + ': [Circular]');
return;
}
seen.add(obj);
for (let key in obj) {
try {
const newPath = path ? path + '.' + key : key;
const value = obj[key];
if (typeof value === 'function') {
console.log(newPath + ': [Function]');
console.log('Function source:', value.toString());
} else {
dumpObject(value, newPath, seen);
}
} catch (e) {
console.log(path + '.' + key + ': [Error accessing]', e);
}
}
}
// Monitor DOM changes
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
console.log('DOM Mutation:', {
type: mutation.type,
target: mutation.target,
addedNodes: mutation.addedNodes,
removedNodes: mutation.removedNodes,
attributes: mutation.attributeName
});
});
});
window.addEventListener('load', () => {
observer.observe(document.body, {
childList: true,
subtree: true,
attributes: true,
characterData: true
});
// Wait for Yamli to load
const checkYamli = setInterval(() => {
if (typeof Yamli === 'object') {
clearInterval(checkYamli);
console.log('Yamli loaded, dumping structure:');
dumpObject(Yamli);
// Initialize Yamli
console.log('Initializing Yamli...');
Yamli.init({
uiLanguage: 'ar',
startMode: 'on'
});
Yamli.yamlify('editor');
}
}, 100);
});
</script>
</head>
<body>
<textarea id="editor" style="width: 500px; height: 300px;"></textarea>
</body>
</html>