|
10 | 10 | (function () { |
11 | 11 | 'use strict'; |
12 | 12 |
|
13 | | - // ── Debug overlay (remove once iOS click issue is diagnosed) ────────────── |
14 | | - var _dbg = []; |
15 | | - function dbg(msg) { |
16 | | - _dbg.push(msg); |
17 | | - var el = document.getElementById('cs-dbg'); |
18 | | - if (el) el.textContent = _dbg.slice(-6).join(' | '); |
19 | | - } |
20 | | - // Runs immediately (before DOMContentLoaded) to confirm script loaded |
21 | | - dbg('SCRIPT_LOADED'); |
22 | | - |
23 | 13 | var LS_OPEN = 'cs_perf_open'; |
24 | 14 | var LS_HEIGHT = 'cs_perf_height'; |
25 | 15 | var LS_TAB = 'cs_perf_tab'; |
|
96 | 86 | hooksCount = document.getElementById('cs-ptc-hooks'); |
97 | 87 | hookSearch = document.getElementById('cs-hkf-search'); |
98 | 88 |
|
99 | | - dbg('DCL'); |
100 | | - if (!panel) { dbg('NO_PANEL'); return; } |
101 | | - dbg('PANEL_OK'); |
| 89 | + if (!panel) return; |
102 | 90 |
|
103 | 91 | // Move the help panel to document.body so it's outside the fixed panel |
104 | 92 | // hierarchy — avoids iOS Safari touch-blocking and overflow:hidden clipping. |
105 | 93 | var helpPanel = document.getElementById('cs-perf-help'); |
106 | 94 | if (helpPanel) document.body.appendChild(helpPanel); |
107 | 95 |
|
108 | | - try { |
109 | | - dbg('N1'); computeN1Patterns(); |
110 | | - dbg('PLG'); populatePluginFilter(); |
111 | | - dbg('ASP'); populateAssetPluginFilter(); |
112 | | - dbg('BAD'); updateBadges(); |
113 | | - dbg('TTL'); updateTotalTime(); |
114 | | - dbg('CTX'); renderPageContext(); |
115 | | - dbg('FLT'); applyFilters(); |
116 | | - dbg('LOG'); renderLogs(); |
117 | | - dbg('AST'); renderAssets(); |
118 | | - dbg('HKS'); renderHooks(); |
119 | | - dbg('SUM'); renderSummary(); |
120 | | - dbg('RST'); restoreState(); |
121 | | - dbg('BIND_START'); |
122 | | - bindEvents(); |
123 | | - dbg('BIND_DONE'); |
124 | | - } catch (e) { |
125 | | - dbg('ERR:' + (e && e.message ? e.message.slice(0, 60) : String(e))); |
126 | | - } |
| 96 | + computeN1Patterns(); |
| 97 | + populatePluginFilter(); |
| 98 | + populateAssetPluginFilter(); |
| 99 | + updateBadges(); |
| 100 | + updateTotalTime(); |
| 101 | + renderPageContext(); |
| 102 | + applyFilters(); |
| 103 | + renderLogs(); |
| 104 | + renderAssets(); |
| 105 | + renderHooks(); |
| 106 | + renderSummary(); |
| 107 | + restoreState(); |
| 108 | + bindEvents(); |
127 | 109 | }); |
128 | 110 |
|
129 | 111 | // ── Page context strip ──────────────────────────────────────────────────── |
|
192 | 174 | } |
193 | 175 |
|
194 | 176 | function togglePanel() { |
195 | | - dbg('TOGGLE'); |
196 | | - if (panel.classList.contains('cs-perf-open')) { dbg('CLOSE'); closePanel(); } |
197 | | - else { dbg('OPEN'); openPanel(parseInt(localStorage.getItem(LS_HEIGHT), 10) || DEFAULT_H, true); } |
| 177 | + if (panel.classList.contains('cs-perf-open')) closePanel(); |
| 178 | + else openPanel(parseInt(localStorage.getItem(LS_HEIGHT), 10) || DEFAULT_H, true); |
198 | 179 | } |
199 | 180 |
|
200 | 181 | // ── Tab switching ───────────────────────────────────────────────────────── |
|
978 | 959 | if (helpBtn && helpBtn.contains(e.target)) return; |
979 | 960 | togglePanel(); |
980 | 961 | }); |
981 | | - toggleBtn.addEventListener('click', function (e) { dbg('BTN_CLK'); e.stopPropagation(); togglePanel(); }); |
| 962 | + toggleBtn.addEventListener('click', function (e) { e.stopPropagation(); togglePanel(); }); |
982 | 963 | // iOS Safari fallback: touchend fires reliably even when parent has |
983 | 964 | // overflow/fixed positioning quirks that can swallow click events. |
984 | 965 | toggleBtn.addEventListener('touchend', function (e) { |
985 | | - dbg('BTN_TCH'); |
986 | 966 | e.preventDefault(); // prevent the follow-up click from double-toggling |
987 | 967 | e.stopPropagation(); |
988 | 968 | togglePanel(); |
|
0 commit comments