MCPcopy Index your code
hub / github.com/github/awesome-copilot / setupResourceListHandlers

Function setupResourceListHandlers

website/src/scripts/pages/plugins.ts:186–217  ·  view source on GitHub ↗
(list: HTMLElement | null)

Source from the content-addressed store, hash-verified

184}
185
186function setupResourceListHandlers(list: HTMLElement | null): void {
187 if (!list || resourceListHandlersReady) return;
188
189 list.addEventListener('click', (event) => {
190 const target = event.target as HTMLElement;
191 if (target.closest('.resource-actions')) {
192 return;
193 }
194
195 const item = target.closest('.resource-item') as HTMLElement | null;
196 const button = item?.querySelector('.resource-preview') as HTMLElement | undefined;
197 const path = item?.dataset.path;
198 if (path) {
199 openPluginDetailsModal(path, button);
200 }
201 });
202
203 document.addEventListener('click', async (event) => {
204 const target = event.target as HTMLElement;
205 const installButton = target.closest(
206 '#plugin-details-install'
207 ) as HTMLButtonElement | null;
208 if (!installButton) return;
209 const pluginName = installButton.dataset.pluginName || '';
210 if (!pluginName) return;
211 const command = `copilot plugin install ${pluginName}@awesome-copilot`;
212 const success = await copyToClipboard(command);
213 showToast(success ? 'Install command copied!' : 'Failed to copy', success ? 'success' : 'error');
214 });
215
216 resourceListHandlersReady = true;
217}
218
219function syncUrlState(): void {
220 updateQueryParams({

Callers 1

initPluginsPageFunction · 0.70

Calls 4

copyToClipboardFunction · 0.90
showToastFunction · 0.90
openPluginDetailsModalFunction · 0.85
addEventListenerMethod · 0.80

Tested by

no test coverage detected