/** * Example FurryPlace Plugin - Custom Button * * This demonstrates how to use the FurryPlace SDK to add custom buttons * to the UI. This plugin adds a "Help" button that opens a dialog. * * To use this plugin, add it to your HTML: * */ (function() { 'use strict'; // Set this to true to disable this example plugin (for reference only) const EXAMPLE_DISABLED = true; // Wait for SDK to be available function waitForSDK(callback) { if (window.FurryPlaceSDK) { callback(); } else { setTimeout(() => waitForSDK(callback), 100); } } // Example 1: Simple button with SVG icon function registerHelpButton() { window.FurryPlaceSDK.registerButton({ id: 'example-help', title: 'Help & Documentation', position: 'after-leaderboard', icon: ` `, onClick: (context, event) => { alert('Help button clicked!\n\nSDK Version: ' + context.sdk.version); console.log('Context:', context); } }); } // Example 2: Button with custom styling function registerDebugButton() { window.FurryPlaceSDK.registerButton({ id: 'example-debug', title: 'Debug Info', position: 'bottom', className: 'btn btn-square btn-accent shadow-md', // Custom styling icon: ` `, onClick: () => { const info = { buttons: window.FurryPlaceSDK.getButtons(), userAgent: navigator.userAgent, viewport: { width: window.innerWidth, height: window.innerHeight }, timestamp: new Date().toISOString() }; console.log('Debug Info:', info); alert('Debug info logged to console'); } }); } // Example 3: Conditional button (only shows when user is logged in) function registerConditionalButton() { window.FurryPlaceSDK.registerButton({ id: 'example-conditional', title: 'Premium Feature', position: 'before-leaderboard', icon: ` `, onClick: () => { alert('This is a premium feature!'); }, // This condition is just an example - in a real plugin you'd check actual user state condition: (context) => { // For now, always show it (change this to check real user state) return true; } }); } // Example 4: Button that opens an external link function registerDiscordButton() { window.FurryPlaceSDK.registerButton({ id: 'example-discord', title: 'Join our Discord', position: 'top', icon: ` `, onClick: () => { window.open('https://discord.gg/ZRC4DnP9Z2', '_blank'); } }); } // Initialize plugin waitForSDK(() => { if (EXAMPLE_DISABLED) { console.log('[Example Plugin] Disabled - set EXAMPLE_DISABLED to false to enable'); return; } console.log('[Example Plugin] Initializing...'); // Register all example buttons registerHelpButton(); registerDebugButton(); registerConditionalButton(); registerDiscordButton(); console.log('[Example Plugin] Loaded successfully!'); console.log('[Example Plugin] Registered buttons:', window.FurryPlaceSDK.getButtons()); }); })();