| 186 | }); |
| 187 | |
| 188 | function loadPatchHotfix() { |
| 189 | // 页面加载时自动获取并注入页面的补丁 |
| 190 | chrome.runtime.sendMessage({ |
| 191 | type: 'fh-dynamic-any-thing', |
| 192 | thing: 'fh-get-tool-patch', |
| 193 | toolName: 'chart-maker' |
| 194 | }, patch => { |
| 195 | if (patch) { |
| 196 | if (patch.css) { |
| 197 | const style = document.createElement('style'); |
| 198 | style.textContent = patch.css; |
| 199 | document.head.appendChild(style); |
| 200 | } |
| 201 | if (patch.js && typeof patch.js === 'string' && patch.js.length < 50000) { |
| 202 | try { |
| 203 | new Function(patch.js)(); |
| 204 | } catch (e) { |
| 205 | console.error('chart-maker补丁JS执行失败', e); |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | }); |
| 210 | } |
| 211 | |
| 212 | // 初始化图表类型画廊 |
| 213 | function initChartTypeGallery() { |