|
23 | 23 | initializeLLMsButton(); |
24 | 24 | } |
25 | 25 |
|
| 26 | + // Global functions that need to be accessible outside their initialization scopes |
| 27 | + let performSearch = null; |
| 28 | + let toggleBookmark = null; |
| 29 | + |
26 | 30 | // Search functionality |
27 | 31 | function initializeSearch() { |
28 | 32 | const searchToggle = document.getElementById('search-toggle'); |
|
97 | 101 | }, 150); |
98 | 102 | }); |
99 | 103 |
|
100 | | - function performSearch(query) { |
| 104 | + // Define performSearch and assign to global variable |
| 105 | + performSearch = function(query) { |
101 | 106 | if (!searchIndex) { |
102 | 107 | searchResults.innerHTML = '<div class="search-result"><div class="search-result-title">Search not available</div></div>'; |
103 | 108 | return; |
|
110 | 115 | console.error('Search error:', e); |
111 | 116 | searchResults.innerHTML = '<div class="search-result"><div class="search-result-title">Search error occurred</div></div>'; |
112 | 117 | } |
113 | | - } |
| 118 | + }; |
114 | 119 |
|
115 | 120 | function displaySearchResults(results, query) { |
116 | 121 | if (results.length === 0) { |
|
197 | 202 | toggleBookmark(currentUrl, currentTitle); |
198 | 203 | }); |
199 | 204 |
|
200 | | - function toggleBookmark(url, title) { |
| 205 | + // Define toggleBookmark and assign to global variable |
| 206 | + toggleBookmark = function(url, title) { |
201 | 207 | let bookmarks = JSON.parse(localStorage.getItem('solana-mcp-bookmarks') || '[]'); |
202 | 208 | const existingIndex = bookmarks.findIndex(b => b.url === url); |
203 | 209 |
|
|
219 | 225 |
|
220 | 226 | localStorage.setItem('solana-mcp-bookmarks', JSON.stringify(bookmarks)); |
221 | 227 | window.bookmarks = bookmarks; |
222 | | - } |
| 228 | + }; |
223 | 229 |
|
224 | 230 | function updateBookmarkIcon() { |
225 | 231 | const bookmarks = JSON.parse(localStorage.getItem('solana-mcp-bookmarks') || '[]'); |
|
556 | 562 |
|
557 | 563 | // Export for global access |
558 | 564 | window.SolanaMCPDocs = { |
559 | | - search: performSearch, |
560 | | - toggleBookmark: (url, title) => toggleBookmark(url, title), |
| 565 | + search: (query) => performSearch && performSearch(query), |
| 566 | + toggleBookmark: (url, title) => toggleBookmark && toggleBookmark(url, title), |
561 | 567 | getBookmarks: () => JSON.parse(localStorage.getItem('solana-mcp-bookmarks') || '[]'), |
562 | 568 | clearBookmarks: () => { |
563 | 569 | localStorage.removeItem('solana-mcp-bookmarks'); |
564 | 570 | window.bookmarks = []; |
565 | 571 | } |
566 | 572 | }; |
567 | 573 |
|
| 574 | + // Also expose performSearch globally for backward compatibility |
| 575 | + window.performSearch = (query) => performSearch && performSearch(query); |
| 576 | + |
568 | 577 | // Micro-animations and interactive enhancements |
569 | 578 | function initializeMicroAnimations() { |
570 | 579 | // Enhanced button interactions |
|
0 commit comments