๐งผ 3D ๅๅฐๆฉ็ถญ่ญทๆๅ:็ฑ็ซฏ、ๅดๅด、็ฎๅธถ、่ปธๆฟ、ๆป่ป็ไฟ้ค้ฑๆ่ๆๅทง
ไธ็ฎกๆฏ Bambu、ELEGOO、Creality ้ๆฏไปปไฝ CoreXY/FDM ๅฐ่กจๆฉ,ๅช่ฆ็ถญ่ญทๅพๅฅฝ,้ฝ่ฝไฟๆ้ซ้ๅ็ฉฉๅฎ。 ๆฌ็ฏๆด็ ๅฎๆด็ถญ่ญทๆธ ๅฎ,ๅ ๅซๅดๅด、็ฑ็ซฏ、ๆ ๅบๆฉ、็ฎๅธถ、ๆป่ป、่ปธๆฟ、้ขจๆ、้ปๆบ็ญๆๆๅฟ ้ ไฟ้ค็้จไปถ。 ้้้็ฏ,ไฝ ๅฏไปฅ็ดๆฅๅปบ็ซๅฑฌๆผ่ชๅทฑ็「ๅๅฐๆฉไฟ้ค้ฑๆๅถๅบฆ」。
๐ ไธ、ๅดๅด็ถญ่ญท(Nozzle Maintenance)
✓ ๅปบ่ญฐ้ฑๆ:ๆฏ 1~2 kg ่ๆ
- ๆธ ้ค็ขณๅๅกๆ
- ไฝฟ็จ 0.4 ๆธ ๆฝ้็้ๆฎๆ
- ๅฟ ่ฆๆๅท่ก Cold Pull(ๅทๆ)
# Cold Pull ๆญฅ้ฉๆ่ฆ
1. ๅ ็ฑๅฐๆๆๅๅฐๆบซๅบฆ
2. ๆพ็ฝฎ 5 ็งๅพ้ๆบซ่ณ 90°C(PLA)
3. ไธๆฌกๆๅบๆดๆขๆๆ
่ฅไฝฟ็จ็ขณ็บ(CF)ๆๆ:ๅปบ่ญฐๆน็จ Hardened Steel ๅดๅด。
๐ ไบ、็ฑ็ซฏ็ถญ่ญท(Hotend)
✓ ๅปบ่ญฐ้ฑๆ:ๆฏ 3~6 kg ่ๆ
- ๆชขๆฅ็ฑๆท(Heatbreak)ๆฏๅฆ็ฉ็ขณ
- ๆธ ็ๅฐ็ฑ่(้ฉ็จๆผๅ จ้ๅฑฌ็ฑ็ซฏ)
- ๆชขๆฅๆบซๅบฆๅตๆธฌๅจๆฏๅฆ้ฌ่ซ
- ๆชขๆฅๅ ็ฑๆฃๆฏๅฆๅบๅฎ่ฏๅฅฝ
๐ ไธ、็ฎๅธถๅผตๅ(Belt Tension)
✓ ๅปบ่ญฐ้ฑๆ:ๆฏ 1 ๅๆๆชขๆฅไธๆฌก
็ฎๅธถๅคช้ฌ → ๅฑค็งป、้็ทฃๆฏๅ ็ฎๅธถๅคช็ท → ้ฆฌ้่ฒ ่ผๅขๅ 、ๅช้ณ่ฎๅคง
- CoreXY ้่ฆไฟๆๅทฆๅณ็ฎๅธถๅผตๅไธ่ด
- Ender ้กๅบ็งปๅๆฉ้ๆชขๆฅ Y ่ปธๅผตๅ
็พไปฃๆฉ(ๅฆ Bambu、Centauri Carbon)ๅฏไฝฟ็จ่ชๅๅผตๅๆชขๆธฌ。
๐ ๅ、ๆป่ป、็ท่ป(Linear Rail)่่ปธๆฟไฟ้ค
✓ ๅปบ่ญฐ้ฑๆ:ๆฏ 2~3 ๅๆ
- ๆธ ๆฝ็ฐๅกต(้ฟๅ ๅฐ่ดๅกๆปฏ)
- ่ฃๅ ๆฉๆขฐ็จๆฝคๆปๆฒน(ๅฆ Super Lube)
- ๆชขๆฅๆฏๅฆๆ「ๅก้ป」、「้ปๅ็ชๅข」
็ท่ปๆฏ V-Slot ๆบ็ขบ,ไฝ้่ฆๅฎๆ็ถญ่ญทๆๆๆป้ 。
๐ ไบ、ๆ ๅบๆฉ(Extruder)ไฟ้ค
✓ ๅปบ่ญฐ้ฑๆ:ๆฏ 3~5 kg ่ๆ
- ๆชขๆฅ้ฝ่ผชๆฏๅฆ็ฃจๆ
- ๆธ ้ค้ฝ่ผชไธๅกไฝ็ๅกๆ็ฒๅกต
- ็ขบไฟๅฝ็ฐงๅฃๅๆญฃๅธธ(็ด้ฉ ็นๅฅ้่ฆ)
๐ ๅ ญ、้ขจๆ(Fans)ๆธ ๆฝ
✓ ๅปบ่ญฐ้ฑๆ:ๆฏ 1~3 ๅๆ
- ๅทๅป้ขจๆ(Part Cooling Fan)
- ็ฑ็ซฏ้ขจๆ(Hotend Fan)
- ไธปๆฉๆฟ้ขจๆ(Electronics Fan)
่ฅ้ขจๆ่ฝ้่ฎไฝ → ๅฐ็ดๆฅๅฐ่ดๅดๅด้็ฑๆๅทๅปไธ่ถณ。
๐ ไธ、็ฑๅบๆธ ๆฝ(Print Bed Maintenance)
✓ ๅปบ่ญฐ้ฑๆ:ๆฏๆฌก้ทๅๅฐๅๅพ
- PLA:้ ็ฒพๆธ ๆฝ
- PETG:้ฟๅ ็ดๆฅ้ ็ฒพๆธ ๆฝ(ๆ่ฎ้ป),ๆน็จ่ฅ็ๆฐด
- ABS/ASA:ๅฏไฝฟ็จ่ ๆฐดๅฑค้ฟๅ ๅคชๅผทๅธ้
๐ ๅ ซ、้ปๅญ่ๆฉๆงๆชขๆฅ(ๆฏ 6 ๅๆ)
- ๆชขๆฅ้ปๆบๆฅ้ ญๆฏๅฆ้ฌๅ
- ๆชขๆฅไธปๆฉๆฟๆฃ็ฑ
- ๆชขๆฅ้ขจๆๆฏๅฆๅก็ฐๅกต
- ็ขบ่ชๆๆ่ฝ่ปธๆฏๅฆๆญฃๅธธ้ไฝ
๐ ไน、ๅปบ่ญฐไฟ้ค้ฑๆ่กจ(ๅฏๆถ่)
| ้จไปถ | ๅปบ่ญฐ้ฑๆ |
|---|---|
| ๅดๅด | 1–2 kg ่ๆ |
| ็ฑ็ซฏ | 3–6 kg ่ๆ |
| ็ฎๅธถๅผตๅ | 1 ๅๆ |
| ็ท่ป/่ปธๆฟ | 2–3 ๅๆ |
| ้ขจๆ | 1–3 ๅๆ |
| ็ฑๅบๆธ ๆฝ | ๆฏๆฌกๅๅฐๅๅพ |
| ้ปๅญๆชขๆฅ | 6 ๅๆ |
๐ ็ต่ช
็ถญ่ญทๆฏ่ฎ 3D ๅๅฐๆฉ「่ถ็จ่ถ้ 」็้้ต。 ๅช่ฆๅปบ็ซไธๅฅๅบๅฎไฟ้ค้ฑๆ,ไฝ ็ๅๅฐๆฉ่ฝ้ทๆไฟๆ้ซ้、็ฉฉๅฎ、ไฝๅช้ณ่้ซๅ่ณช่ผธๅบ。 ๆฌ็ฏไน้ฉๅๅๅฐๅบไพ่ฒผๅจไฝ ็ๅทฅไฝๅ,็ถไฝๅบๅฎๅทกๆชข่กจ!
๐ 3D ๅๅฐ็ณปๅๆ็ซ
- ๐งฑ 3D ๅๅฐๅฎๆดๅ ฅ้ๆๅ:้ไฝๅ็、ๆ็จๆ ๅข่่จญๅ้ธ่ณผไธๆฌกๆๆ
- ๐จ️ ๆถ่ฒป็ด 3D ๅๅฐๆฉ้ธ่ณผๆๅ:FDM / SLA ๆฏ่ผ、ๆ ธๅฟ่ฆๆ ผ่งฃๆ
- ๐ฆ 3D ๅๅฐๆจกๅไพๆบๅคงๅ จ:Printables、Thingiverse、MakerWorld、Cults ๅนณๅฐๆฏ่ผ่ไธ่ผๆๅทง
- ⚙️ ELEGOO ่ Bambu Lab ๆฏ่ผ:้ๅบฆ、็ฒพๅบฆ、AMS、ๅคๆๆๅ จ้ข่งฃๆ
- ๐ท️ ๅธธ่ฆๆถ่ฒป็ดๅ็ๆฏ่ผ:ELEGOO、Creality、Anycubic、Bambu Lab ็ๅฎไฝ่้ธๆ็ญ็ฅ
- ⚡ ่ถ ้ซ้ 3D ๅๅฐๆฉๆฏ่ผ:Centauri Carbon、Bambu P1/P2、K1 Max ๅฎๆดๅๆ
- ๐งต 3D ๅๅฐๆๆ็พ็ง:PLA、ABS、PETG、TPU、Nylon、CF ็ณปๅๅฎๆด่งฃๆ
- ๐ฅ ๅๅฐๆบซๅบฆ、้ๅบฆ่ๅทๅป่จญๅฎๆๅ:ๆๅๆๅ็่่กจ้ขๅ่ณช็ๅฎๆดๆ่ก็ญ่จ
- ๐ 3D ๅๅฐๆ กๆญฃๅคงๅ จ:Flow、EM、Z-Offset、Retraction、ๆบซๅบฆๅกๅฎๆดๆๅญธ
- ๐ง = 1100) { var hoverZone = document.getElementById('sidebar-hover-zone'); var hoverDelay = null; function startHoverOpen() { clearTimeout(hoverDelay); if (!isSidebarOpen()) openSidebar(); } function scheduleHoverClose(){ clearTimeout(hoverDelay); hoverDelay = setTimeout(function(){ if (isSidebarOpen()) closeSidebar(); }, 450); } [fab, hoverZone, sidebar].forEach(function(el) { if (!el) return; el.addEventListener('mouseenter', startHoverOpen); el.addEventListener('mouseleave', scheduleHoverClose); }); } // Restore saved state try { if (localStorage.getItem('wwf_sb2') === '1') { openSidebar(); } else { syncFab(); } } catch(e) { syncFab(); } // Close on outside click (mobile) document.addEventListener('click', function(e) { if (window.innerWidth >= 1100) return; if (!isSidebarOpen()) return; if (sidebar && !sidebar.contains(e.target) && fab && !fab.contains(e.target)) closeSidebar(); }); /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 3. READING PROGRESS BAR โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ var progressBar = document.getElementById('reading-progress'); var tocFloatBar = document.getElementById('toc-float-bar'); if (progressBar) { function updateProgress() { var article = document.querySelector('.full-post-body') || document.getElementById('content'); if (!article) return; var rect = article.getBoundingClientRect(); var total = rect.height - window.innerHeight; var scrolled = Math.max(0, -rect.top); var pct = total > 0 ? Math.min(100, (scrolled / total) * 100) : 0; progressBar.style.width = pct + '%'; if (tocFloatBar) tocFloatBar.style.height = pct + '%'; } if (document.body.classList.contains('item') || document.body.classList.contains('item-page')) { window.addEventListener('scroll', updateProgress, { passive: true }); updateProgress(); } } /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 4. BACK TO TOP BUTTON โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ var bttBtn = document.getElementById('back-to-top'); if (bttBtn) { window.addEventListener('scroll', function() { bttBtn.classList.toggle('visible', window.scrollY > 400); }, { passive: true }); bttBtn.addEventListener('click', function(e) { e.preventDefault(); window.scrollTo({ top: 0, behavior: 'smooth' }); var m = document.getElementById('content'); if (m) { m.setAttribute('tabindex', '-1'); m.focus({ preventScroll: true }); } }); } /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 5. SEARCH OVERLAY โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ var searchOverlay = document.getElementById('search-overlay'); var searchToggle = document.getElementById('search-toggle'); var searchInput = document.getElementById('search-input'); var lastFocusBeforeSearch = null; function openSearch() { if (!searchOverlay) return; lastFocusBeforeSearch = document.activeElement; searchOverlay.classList.add('open'); if (searchInput) setTimeout(function(){ searchInput.focus(); }, 50); } function closeSearch() { if (!searchOverlay) return; searchOverlay.classList.remove('open'); if (lastFocusBeforeSearch) lastFocusBeforeSearch.focus({ preventScroll: true }); } if (searchToggle) searchToggle.addEventListener('click', function(e){ e.preventDefault(); openSearch(); }); if (searchOverlay) searchOverlay.addEventListener('click', function(e){ if (e.target === searchOverlay) closeSearch(); }); // Search focus trap if (searchOverlay) { searchOverlay.addEventListener('keydown', function(e) { if (!searchOverlay.classList.contains('open')) return; var focs = Array.from(searchOverlay.querySelectorAll(FOCUSABLE)); if (!focs.length) return; var first = focs[0], last = focs[focs.length - 1]; if (e.key === 'Tab') { if (e.shiftKey) { if (document.activeElement === first) { e.preventDefault(); last.focus(); } } else { if (document.activeElement === last) { e.preventDefault(); first.focus(); } } } }); } if (searchInput) { searchInput.addEventListener('keydown', function(e) { if (e.key === 'Enter' && this.value.trim()) { var q = encodeURIComponent(this.value.trim()); window.location.href = window.location.protocol + '//' + window.location.hostname + '/search?q=' + q; } }); } // Global keyboard shortcuts document.addEventListener('keydown', function(e) { if (e.key === 'Escape') { closeSearch(); closeLightbox(); } if ((e.ctrlKey || e.metaKey) && e.key === 'k') { e.preventDefault(); openSearch(); } }); /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 6. POPULAR STRIP TICKER โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ (function loadTicker() { var tickerEl = document.getElementById('ticker-inner'); if (!tickerEl) return; var origin = window.location.protocol + '//' + window.location.hostname; var feedUrl = origin + '/feeds/posts/summary?alt=json&max-results=20&orderby=published'; window._wwfTicker = function(data) { try { var entries = (data && data.feed && data.feed.entry) ? data.feed.entry : []; if (entries.length === 0) { tickerEl.textContent = ''; return; } var html = ''; var sep = ' โฆ '; entries.forEach(function(entry) { var title = entry.title ? entry.title.$t : ''; var url = ''; if (entry.link) { for (var j = 0; j < entry.link.length; j++) { if (entry.link[j].rel === 'alternate') { url = entry.link[j].href; break; } } } if (title && url) html += '' + title + '' + sep; }); if (!html) { tickerEl.textContent = ''; return; } tickerEl.innerHTML = html + html; tickerEl.style.opacity = '1'; tickerEl.style.fontStyle = 'normal'; var charLen = entries.length * 20; tickerEl.style.animationDuration = Math.max(22, Math.round(charLen * 0.14)) + 's'; } catch(err) {} delete window._wwfTicker; }; var s = document.createElement('script'); s.async = true; s.src = feedUrl + '&callback=_wwfTicker'; s.onerror = function() { if (tickerEl) tickerEl.textContent = ''; }; document.head.appendChild(s); })(); /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 7. LABEL TOOLBAR (Top 10 labels) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ (function buildLabelToolbar() { var pillsEl = document.getElementById('ltb-pills'); if (!pillsEl) return; var activeLabelRaw = ''; var labelMatch = window.location.pathname.match(/\/search\/label\/(.+)/); if (labelMatch) { try { activeLabelRaw = decodeURIComponent(labelMatch[1]); } catch(e) { activeLabelRaw = labelMatch[1]; } } var CACHE_KEY = 'wwf_top_labels_v3'; /* bumped: force cache refresh */ var CACHE_TTL = 6 * 60 * 60 * 1000; /* 6 hours */ function renderPills(labels) { if (!labels || labels.length === 0) { pillsEl.innerHTML = ''; return; } var origin = window.location.protocol + '//' + window.location.hostname; var medals = ['โ ','โก','โข','โฃ','โค','โฅ','โฆ','โง','โจ','โฉ']; var html = ''; labels.forEach(function(item, idx) { var labelUrl = origin + '/search/label/' + encodeURIComponent(item.name); var isActive = activeLabelRaw && (activeLabelRaw.toLowerCase() === item.name.toLowerCase()); var rankStr = medals[idx] || (idx + 1) + '.'; html += '' + '' + rankStr + '' + item.name + '' + item.count + '' + ''; }); pillsEl.innerHTML = html; pillsEl.querySelectorAll('.ltb-pill').forEach(function(el, i) { el.style.opacity = '0'; el.style.transform = 'translateY(6px)'; setTimeout(function() { el.style.transition = 'opacity .35s ease, transform .35s ease, background var(--t) var(--ease-smooth), color var(--t) var(--ease-smooth), border-color var(--t) var(--ease-smooth), box-shadow var(--t) var(--ease-smooth), transform .22s var(--ease)'; el.style.opacity = '1'; el.style.transform = 'translateY(0)'; }, i * 60 + 20); }); } try { var cached = JSON.parse(localStorage.getItem(CACHE_KEY) || 'null'); if (cached && cached.ts && (Date.now() - cached.ts < CACHE_TTL) && cached.labels) { renderPills(cached.labels); return; } } catch(e) {} /* Blogger JSON feed: fetch up to 1000 posts in 2 calls to get accurate label counts */ var origin = window.location.protocol + '//' + window.location.hostname; var allCounts = {}; var fetched = 0; var batchSize = 500; function processBatch(data) { try { var entries = (data && data.feed && data.feed.entry) ? data.feed.entry : []; entries.forEach(function(entry) { if (!entry.category) return; entry.category.forEach(function(cat) { var term = cat.term; if (!term) return; allCounts[term] = (allCounts[term] || 0) + 1; }); }); fetched += entries.length; /* If we got a full batch, try fetching next page */ if (entries.length === batchSize && fetched < 1500) { fetchBatch(fetched + 1); } else { finalize(); } } catch(err) { finalize(); } } function finalize() { var sorted = Object.keys(allCounts) .map(function(k) { return { name: k, count: allCounts[k] }; }) .sort(function(a, b) { return b.count - a.count; }) .slice(0, 10); renderPills(sorted); try { localStorage.setItem(CACHE_KEY, JSON.stringify({ ts: Date.now(), labels: sorted })); } catch(e) {} } function fetchBatch(startIdx) { var callbackName = '_wwfLabels' + startIdx; var feedUrl = origin + '/feeds/posts/summary?alt=json&max-results=' + batchSize + '&start-index=' + startIdx + '&fields=entry(category)&callback=' + callbackName; window[callbackName] = function(data) { delete window[callbackName]; processBatch(data); }; var s = document.createElement('script'); s.async = true; s.src = feedUrl; s.onerror = function() { finalize(); }; document.head.appendChild(s); } window._wwfLabels = function(data) { delete window._wwfLabels; processBatch(data); }; var feedUrl = origin + '/feeds/posts/summary?alt=json&max-results=' + batchSize + '&start-index=1&fields=entry(category)'; var s = document.createElement('script'); s.async = true; s.src = feedUrl + '&callback=_wwfLabels'; s.onerror = function() { if (pillsEl) finalize(); }; document.head.appendChild(s); })(); /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 8. ESTIMATED READING TIME โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ var readTimeEl = document.getElementById('post-read-time'); var postBody = document.querySelector('.full-post-body'); if (readTimeEl && postBody) { var chars = (postBody.innerText || postBody.textContent || '').replace(/\s/g, '').length; var mins = Math.max(1, Math.round(chars / 500)); readTimeEl.innerHTML = ' ็ด ' + mins + ' ๅ้'; } /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 9. TABLE OF CONTENTS (inline + floating) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ (function buildTOC() { var tocList = document.getElementById('toc-list'); var tocToggle = document.getElementById('toc-toggle'); var tocFloat = document.getElementById('toc-float'); var tocFloatList = document.getElementById('toc-float-list'); var body = document.querySelector('.full-post-body'); if (!body) return; var headings = body.querySelectorAll('h2, h3'); if (headings.length < 2) { var tc = document.getElementById('toc-container'); if (tc) tc.style.display = 'none'; if (tocFloat) tocFloat.style.display = 'none'; return; } var inlineHtml = '', floatHtml = ''; headings.forEach(function(h, idx) { var id = 'toc-heading-' + idx; h.id = id; var lvl = h.tagName.toLowerCase(); var txt = h.textContent.trim(); inlineHtml += '
- ' + txt + ' '; floatHtml += '
- ' + txt + ' '; }); if (tocList) tocList.innerHTML = inlineHtml; if (tocFloatList) tocFloatList.innerHTML = floatHtml; // Inline collapse toggle if (tocToggle && tocList) { tocToggle.addEventListener('click', function() { var collapsed = tocList.classList.toggle('collapsed'); tocToggle.classList.toggle('collapsed', collapsed); tocToggle.setAttribute('aria-expanded', collapsed ? 'false' : 'true'); }); } // Show floating TOC on scroll if (tocFloat) { var titleEl = document.querySelector('.full-post-title'); var lastEl = document.querySelector('.full-post-share'); var floatObs = new IntersectionObserver(function(entries) { entries.forEach(function(entry) { if (!entry.isIntersecting) { tocFloat.classList.add('visible'); } }); }, { threshold: 0 }); if (titleEl) floatObs.observe(titleEl); var hideObs = new IntersectionObserver(function(entries) { entries.forEach(function(entry) { if (entry.isIntersecting) tocFloat.classList.remove('visible'); }); }, { threshold: 0 }); if (lastEl) hideObs.observe(lastEl); } // Active heading observer (both TOCs) function makeActiveObserver(listEl) { if (!listEl) return; var links = listEl.querySelectorAll('a'); var obs = new IntersectionObserver(function(entries) { entries.forEach(function(entry) { if (entry.isIntersecting) { links.forEach(function(a) { a.classList.remove('active'); }); var active = listEl.querySelector('a[href="#' + entry.target.id + '"]'); if (active) active.classList.add('active'); } }); }, { rootMargin: '-20% 0px -75% 0px' }); headings.forEach(function(h) { obs.observe(h); }); // Smooth scroll links.forEach(function(a) { a.addEventListener('click', function(e) { e.preventDefault(); var target = document.getElementById(this.getAttribute('href').slice(1)); if (target) { target.scrollIntoView({ behavior: 'smooth', block: 'start' }); target.focus({ preventScroll: true }); } }); }); } makeActiveObserver(tocList); makeActiveObserver(tocFloatList); })(); /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 10. LIGHTBOX with gallery nav โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ var lightbox = document.getElementById('lightbox'); var lightboxImg = document.getElementById('lightbox-img'); var lightboxClose = document.getElementById('lightbox-close'); var lightboxCap = document.getElementById('lightbox-caption'); var lightboxPrev = document.getElementById('lightbox-prev'); var lightboxNext = document.getElementById('lightbox-next'); var lastFocusBeforeLightbox = null; var galleryImgs = []; var galleryIdx = 0; // Collect all post body images if (postBody) { galleryImgs = Array.from(postBody.querySelectorAll('img')); } function openLightbox(src, alt, idx) { if (!lightbox || !lightboxImg) return; lastFocusBeforeLightbox = document.activeElement; lightboxImg.src = src; lightboxImg.alt = alt || ''; if (lightboxCap) lightboxCap.textContent = alt || ''; galleryIdx = (typeof idx === 'number') ? idx : 0; if (lightboxPrev) lightboxPrev.style.display = galleryImgs.length > 1 ? '' : 'none'; if (lightboxNext) lightboxNext.style.display = galleryImgs.length > 1 ? '' : 'none'; lightbox.classList.add('open'); document.body.style.overflow = 'hidden'; if (lightboxClose) lightboxClose.focus(); } function closeLightbox() { if (!lightbox) return; lightbox.classList.remove('open'); document.body.style.overflow = ''; if (lastFocusBeforeLightbox) lastFocusBeforeLightbox.focus({ preventScroll: true }); } window.navLightbox = function navLightbox(dir) { if (!galleryImgs.length) return; galleryIdx = (galleryIdx + dir + galleryImgs.length) % galleryImgs.length; var img = galleryImgs[galleryIdx]; if (lightboxImg) { lightboxImg.style.opacity = '0'; setTimeout(function(){ lightboxImg.src = img.src; lightboxImg.alt = img.alt || ''; lightboxImg.style.opacity = '1'; if (lightboxCap) lightboxCap.textContent = img.alt || ''; }, 150); } }; if (lightboxClose) lightboxClose.addEventListener('click', closeLightbox); if (lightbox) lightbox.addEventListener('click', function(e){ if (e.target === lightbox) closeLightbox(); }); if (lightboxPrev) lightboxPrev.addEventListener('click', function(e){ e.stopPropagation(); navLightbox(-1); }); if (lightboxNext) lightboxNext.addEventListener('click', function(e){ e.stopPropagation(); navLightbox(1); }); // Keyboard inside lightbox if (lightbox) { lightbox.addEventListener('keydown', function(e) { if (!lightbox.classList.contains('open')) return; if (e.key === 'ArrowLeft') { e.preventDefault(); navLightbox(-1); } if (e.key === 'ArrowRight') { e.preventDefault(); navLightbox(1); } if (e.key === 'Escape') closeLightbox(); // Focus trap var focs = Array.from(lightbox.querySelectorAll(FOCUSABLE)); if (!focs.length) return; var first = focs[0], last = focs[focs.length-1]; if (e.key === 'Tab') { if (e.shiftKey) { if (document.activeElement===first){e.preventDefault();last.focus();} } else { if (document.activeElement===last) {e.preventDefault();first.focus();} } } }); } // Attach to images if (postBody) { galleryImgs.forEach(function(img, idx) { img.style.cursor = 'zoom-in'; img.setAttribute('tabindex', '0'); img.setAttribute('role', 'button'); img.setAttribute('aria-label', (img.alt || 'ๅ็') + '๏ผ้ปๆๆพๅคง'); img.addEventListener('click', function() { openLightbox(this.src, this.alt || this.getAttribute('title') || '', idx); }); img.addEventListener('keydown', function(e){ if (e.key === 'Enter' || e.key === ' '){ e.preventDefault(); openLightbox(this.src, this.alt || '', idx); } }); }); } /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 11. SCROLL-REVEAL for cards (CSS animation handles initial entrance) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ /* Card entrance animation is now CSS-only via @keyframes cardEnter */ /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 12. HERO IMAGE PARALLAX โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ var heroImg = document.getElementById('hero-img'); if (heroImg) { window.addEventListener('scroll', function() { var scrollY = window.scrollY; heroImg.style.transform = 'translateY(' + (scrollY * 0.25) + 'px)'; }, { passive: true }); } /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 13. CODE BLOCK ENHANCEMENTS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ if (postBody) { postBody.querySelectorAll('pre').forEach(function(pre) { var code = pre.querySelector('code'); var cls = ((code ? code.className : pre.className) || '').match(/language-(\w+)/); if (cls) { var langLabel = document.createElement('span'); langLabel.className = 'code-lang-label'; langLabel.setAttribute('aria-hidden', 'true'); langLabel.textContent = cls[1]; pre.appendChild(langLabel); } var copyBtn = document.createElement('button'); copyBtn.className = 'code-copy-btn'; copyBtn.type = 'button'; copyBtn.textContent = '่ค่ฃฝ'; copyBtn.setAttribute('aria-label', '่ค่ฃฝ็จๅผ็ขผ'); copyBtn.addEventListener('click', function() { var textToCopy = code ? code.innerText : pre.innerText; navigator.clipboard.writeText(textToCopy || '').then(function() { copyBtn.textContent = 'โ ๅทฒ่ค่ฃฝ'; copyBtn.classList.add('copied'); setTimeout(function() { copyBtn.textContent = '่ค่ฃฝ'; copyBtn.classList.remove('copied'); }, 2200); }).catch(function() { copyBtn.textContent = 'ๅคฑๆ'; setTimeout(function(){ copyBtn.textContent = '่ค่ฃฝ'; }, 2000); }); }); pre.appendChild(copyBtn); }); } /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 14. HEADING ANCHORS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ if (postBody) { postBody.querySelectorAll('h2, h3, h4').forEach(function(h) { var id = h.id; if (!id) { id = h.textContent.trim() .toLowerCase() .replace(/\s+/g, '-') .replace(/[^\w\u4e00-\u9fff\-]/g, '') .replace(/^-+|-+$/g, ''); if (id) h.id = id; } if (id) { var a = document.createElement('a'); a.href = '#' + id; a.className = 'heading-anchor'; a.setAttribute('aria-label', '้ฃ็ต่ณๆญคๆฎต่ฝ'); a.innerHTML = ''; h.appendChild(a); } }); } /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 15. EXTERNAL LINKS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ if (postBody) { postBody.querySelectorAll('a[href]').forEach(function(a) { var href = a.getAttribute('href') || ''; if (href.startsWith('http') && !href.includes(window.location.hostname)) { var rel = (a.getAttribute('rel') || ''); if (!rel.includes('noopener')) a.setAttribute('rel', (rel + ' noopener noreferrer').trim()); a.setAttribute('target', '_blank'); if (!a.getAttribute('aria-label')) { var t = a.textContent.trim(); if (t) a.setAttribute('aria-label', t + '๏ผๅจๆฐ่ฆ็ช้ๅ๏ผ'); } } }); } /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 16. LAZY LOADING for non-first images + fade-in โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ if (postBody) { var imgs = postBody.querySelectorAll('img'); var isFirst = true; imgs.forEach(function(img) { if (isFirst) { isFirst = false; img.classList.add('loaded'); return; } if (!img.getAttribute('loading')) img.setAttribute('loading', 'lazy'); if (img.complete) { img.classList.add('loaded'); } else { img.addEventListener('load', function() { this.classList.add('loaded'); }); } }); } /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 17. FONT SIZE CONTROLLER โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ (function initFontSizeCtrl() { var SIZES = [14, 15, 15.5, 16, 16.5, 17, 18, 19, 20]; var LS_KEY = 'wwf_font_size_v1'; var DEFAULT_IDX = 4; var curIdx = DEFAULT_IDX; var fscUp = document.getElementById('fsc-up'); var fscDown = document.getElementById('fsc-down'); var fscReset = document.getElementById('fsc-reset'); function applySize(idx) { curIdx = Math.max(0, Math.min(SIZES.length - 1, idx)); var pb = document.querySelector('.full-post-body'); if (pb) pb.style.fontSize = SIZES[curIdx] + 'px'; try { localStorage.setItem(LS_KEY, curIdx); } catch(e) {} if (fscDown) fscDown.disabled = curIdx <= 0; if (fscUp) fscUp.disabled = curIdx >= SIZES.length - 1; } try { var saved = parseInt(localStorage.getItem(LS_KEY), 10); if (!isNaN(saved)) curIdx = saved; } catch(e) {} applySize(curIdx); if (fscUp) fscUp.addEventListener('click', function(){ applySize(curIdx + 1); }); if (fscDown) fscDown.addEventListener('click', function(){ applySize(curIdx - 1); }); if (fscReset) fscReset.addEventListener('click', function(){ applySize(DEFAULT_IDX); }); })(); /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 18. COPY URL BUTTON (share row) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ var copyUrlBtn = document.getElementById('copy-url-btn'); if (copyUrlBtn) { copyUrlBtn.addEventListener('click', function() { navigator.clipboard.writeText(window.location.href).then(function() { copyUrlBtn.classList.add('copied'); copyUrlBtn.innerHTML = 'ๅทฒ่ค่ฃฝ๏ผ'; setTimeout(function() { copyUrlBtn.classList.remove('copied'); copyUrlBtn.innerHTML = '่ค่ฃฝ้ฃ็ต'; }, 2400); }); }); } /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 19. STAGGER CARD ANIMATIONS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ document.querySelectorAll('.tl-card').forEach(function(el, i) { el.style.setProperty('--i', i); }); /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 20. ACTIVE NAV ITEM โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ var curPath = window.location.pathname; document.querySelectorAll('#main-nav a.nav-item').forEach(function(a) { var href = a.getAttribute('href') || ''; try { if (href && curPath === new URL(href, window.location.href).pathname) { a.classList.add('active'); } } catch(e) {} }); if (!document.querySelector('#main-nav a.nav-item.active')) { var first = document.querySelector('#main-nav a.nav-item'); if (first) first.classList.add('active'); } /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 21. READING PROGRESS PERCENTAGE โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ var readPctEl = document.getElementById('reading-pct'); if (readPctEl && progressBar) { var scrollTimer = null; window.addEventListener('scroll', function() { document.body.classList.add('is-scrolling'); clearTimeout(scrollTimer); scrollTimer = setTimeout(function() { document.body.classList.remove('is-scrolling'); }, 1200); var w = parseFloat(progressBar.style.width) || 0; readPctEl.textContent = Math.round(w) + '%'; }, { passive: true }); } /* โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 22. LIVE SEARCH PREVIEW โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ */ (function initLiveSearch() { var input = document.getElementById('search-input'); var container = document.getElementById('search-live-results'); if (!input || !container) return; var cache = null; var debounce = null; var origin = window.location.protocol + '//' + window.location.hostname; function fetchFeed(cb) { if (cache) { cb(cache); return; } var url = origin + '/feeds/posts/summary?alt=json&max-results=500'; var s = document.createElement('script'); var cbName = '_wwfLiveSearch'; window[cbName] = function(data) { delete window[cbName]; var entries = (data && data.feed && data.feed.entry) || []; cache = entries.map(function(e) { var title = e.title ? e.title.$t : ''; var url = ''; if (e.link) { for (var i = 0; i < e.link.length; i++) { if (e.link[i].rel === 'alternate') { url = e.link[i].href; break; } } } var thumb = ''; if (e.media$thumbnail) thumb = e.media$thumbnail.url.replace(/\/s72-c\//, '/s120-c/'); var pub = e.published ? e.published.$t.substring(0, 10) : ''; return { title: title, url: url, thumb: thumb, date: pub }; }); cb(cache); }; s.src = url + '&callback=' + cbName; s.onerror = function() { delete window[cbName]; }; document.head.appendChild(s); } function highlight(text, q) { if (!q) return text; var re = new RegExp('(' + q.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + ')', 'gi'); return text.replace(re, '$1'); } input.addEventListener('input', function() { clearTimeout(debounce); var q = this.value.trim(); if (q.length < 2) { container.innerHTML = ''; container.classList.remove('has-results'); return; } debounce = setTimeout(function() { fetchFeed(function(items) { var ql = q.toLowerCase(); var matches = items.filter(function(it) { return it.title.toLowerCase().indexOf(ql) !== -1; }).slice(0, 6); if (matches.length === 0) { container.innerHTML = '