Bruce Lee Quotes (1940-1973)

Actor, Artist, King

About Bruce Lee

Lee Jun-fan (27 November 1940 – 20 July 1973), commonly known as Bruce Lee, was a Hong Kong American martial artist and actor who is widely regarded as the most influential martial artist of the 20th century.

[CONTENT_MAIN]

About Bruce Lee

Lee Jun-fan (27 November 1940 – 20 July 1973), commonly known as Bruce Lee, was a Hong Kong American martial artist and actor who is widely regarded as the most influential martial artist of the 20th century.
// SORTING LOGIC // Global State for Sort let currentSort = 'shortest'; // shortest | earliest function toggleSortQuotes() { const container = document.getElementById('gen-quotes-container'); if(!container) return; // Toggle State currentSort = (currentSort === 'shortest') ? 'earliest' : 'shortest'; // Update UI const pill = document.getElementById('sort-pill-bg'); const lblShort = document.getElementById('label-shortest'); const lblEarly = document.getElementById('label-earliest'); if(currentSort === 'earliest') { pill.style.left = '50%'; lblShort.classList.replace('text-brand', 'text-muted'); lblEarly.classList.replace('text-muted', 'text-brand'); } else { pill.style.left = '4px'; lblShort.classList.replace('text-muted', 'text-brand'); lblEarly.classList.replace('text-brand', 'text-muted'); } // Perform Sort const items = Array.from(container.children); items.sort((a, b) => { if (currentSort === 'shortest') { return parseInt(a.dataset.length) - parseInt(b.dataset.length); } else { // Earliest = Sort by ID (ASC) ideally, or however 'original order' is defined. // Requirement says: "sort by their original order which is available by sorting in the quotes table on the id field" return parseInt(a.dataset.id) - parseInt(b.dataset.id); } }); // Re-append and Reset Visibility // Show first 5, hide rest. // Also reset Load More button if hidden. container.innerHTML = ''; const visibleLimit = 5; items.forEach((item, index) => { container.appendChild(item); if(index < visibleLimit) { item.classList.remove('hidden'); } else { item.classList.add('hidden'); } }); // Reset Load More Button const btnContainer = document.getElementById('gen-load-more-container'); if(btnContainer) { if(items.length > visibleLimit) { btnContainer.style.display = 'block'; } else { btnContainer.style.display = 'none'; } } } function loadMoreSection(btn, step) { // Strict Scoping: Find the container immediately preceding the "load-more-container" referencing "gen-quotes-container" logic // But here we are generic. const btnContainer = btn.parentElement; const container = btnContainer.previousElementSibling; if (!container) return; // Scope querySelectorAll to THIS container only // Find immediate children with .hidden // Note: querySelectorAll('.hidden') will find deeply nested hidden items (like source-info). // We only want the DIRECT children (quote items). // Best way: Iterating children or using :scope > .hidden if supported, or filtering. const hiddenDirect = Array.from(container.children).filter(el => el.classList.contains('hidden')); let revealed = 0; for(let i=0; i= step) break; hiddenDirect[i].classList.remove('hidden'); revealed++; } // Re-check count of hidden items const remaining = Array.from(container.children).filter(el => el.classList.contains('hidden')).length; if(remaining === 0) { btnContainer.style.display = 'none'; } } // Toggle Source Info function toggleSource(btn) { const card = btn.closest('.quote-card'); if(!card) return; const info = card.querySelector('.source-info'); const svg = btn.querySelector('svg'); if(info) { if(info.classList.contains('hidden')) { info.classList.remove('hidden'); // Rotate Arrow Up if(svg) svg.classList.add('rotate-180'); } else { info.classList.add('hidden'); // Rotate Arrow Down if(svg) svg.classList.remove('rotate-180'); } } } // Copy Quote function copyQuote(btn) { const card = btn.closest('.quote-card'); // Round 12: selector fix - target .quote-text or just textContent of block/div const qEl = card.querySelector('.quote-text'); const text = qEl ? qEl.innerText.replace(/[“”]/g, '').trim() : ''; // clean quotes if(text) { navigator.clipboard.writeText(text).then(() => { const sb = document.getElementById('snackbar'); if(sb) { sb.innerText = "Quote Copied!"; sb.classList.remove('opacity-0'); setTimeout(() => { sb.classList.add('opacity-0'); }, 1500); } else { alert("Quote Copied!"); } }); } } // Share Quote function openQuoteShare(btn) { // Find Data from closest card const card = btn.closest('.quote-card'); // Use data-share-url if available (Individual Page) let shareUrl = card.dataset.shareUrl || window.location.href; // Ensure absolute URL if(shareUrl.startsWith('/')) { shareUrl = 'https://quotescosmos.com' + shareUrl; } const qEl = card.querySelector('.quote-text'); const text = qEl ? encodeURIComponent(qEl.innerText) : ''; const url = encodeURIComponent(shareUrl); let menu = card.querySelector('.quote-share-menu'); if(!menu) { // Create menu const menuHtml = `
Facebook X (Twitter) Email LinkedIn WhatsApp
`; // Positioning wrapper const wrapper = document.createElement('div'); wrapper.className = 'relative inline-block'; // Should match parent // Actually, we are appending TO the button parent. // The button parent is "relative inline-block" in the new HTML. const btnContainer = btn.parentElement; // Insert HTML btnContainer.insertAdjacentHTML('beforeend', menuHtml); menu = btnContainer.querySelector('.quote-share-menu'); // Close logic document.addEventListener('click', function closeMenu(e) { // If click is OUTSIDE menu and OUTSIDE button if(!menu.contains(e.target) && !btn.contains(e.target)) { menu.remove(); document.removeEventListener('click', closeMenu); } }); } else { menu.remove(); } } // Smart Anchors: Auto-expand hidden sections document.addEventListener('DOMContentLoaded', () => { if(window.location.hash) { const target = document.querySelector(window.location.hash); if(target) { if(target.classList.contains('hidden')) { target.classList.remove('hidden'); } target.scrollIntoView({behavior: 'smooth', block: 'center'}); } } });