diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..b490000 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,8 @@ +# Hugo template files +layouts/**/*.json +layouts/**/*.xml +layouts/**/*.rss + +# Hugo output +public/ +resources/ diff --git a/assets/css/style.css b/assets/css/style.css index 0df97ea..8b706b6 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -921,6 +921,38 @@ footer { color: var(--color-text); } +/* Discord tooltip */ +.discord-tooltip { + position: absolute; + background: #333; + color: white; + padding: 6px 10px; + border-radius: 4px; + font-size: 12px; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; + white-space: nowrap; + z-index: 1000; + opacity: 0; + visibility: hidden; + transform: translateY(-4px); + transition: + opacity 0.15s ease, + transform 0.15s ease; + pointer-events: none; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); +} + +.discord-tooltip.show { + opacity: 1; + visibility: visible; + transform: translateY(0); +} + +.discord-tooltip.copied { + background: #333; + color: white; +} + /* Scrollbar */ ::-webkit-scrollbar { width: 8px; diff --git a/assets/js/discord-tooltip.js b/assets/js/discord-tooltip.js new file mode 100644 index 0000000..e4a67e4 --- /dev/null +++ b/assets/js/discord-tooltip.js @@ -0,0 +1,100 @@ +document.addEventListener('DOMContentLoaded', function () { + const discordElement = document.querySelector('a[title*="Discord"]'); + + if (discordElement) { + discordElement.removeAttribute('title'); + + const tooltip = document.createElement('div'); + tooltip.className = 'discord-tooltip'; + tooltip.textContent = 'Discord: Extroonie'; + document.body.appendChild(tooltip); + + let isTooltipVisible = false; + + function showTooltip(e) { + const rect = discordElement.getBoundingClientRect(); + tooltip.style.left = rect.left + rect.width / 2 - tooltip.offsetWidth / 2 + 'px'; + tooltip.style.top = rect.top - tooltip.offsetHeight - 8 + 'px'; + + tooltip.classList.add('show'); + isTooltipVisible = true; + } + + function hideTooltip() { + tooltip.classList.remove('show'); + isTooltipVisible = false; + } + + function showCopiedMessage() { + tooltip.textContent = 'Copied Discord username: Extroonie'; + tooltip.classList.add('copied'); + + setTimeout(() => { + tooltip.textContent = 'Discord: Extroonie'; + tooltip.classList.remove('copied'); + }, 2000); + } + + function copyUsername() { + const textArea = document.createElement('textarea'); + textArea.value = 'Extroonie'; + textArea.style.position = 'fixed'; + textArea.style.left = '-999999px'; + textArea.style.top = '-999999px'; + document.body.appendChild(textArea); + textArea.focus(); + textArea.select(); + + try { + const successful = document.execCommand('copy'); + document.body.removeChild(textArea); + return successful; + } catch (err) { + document.body.removeChild(textArea); + return false; + } + } + + const isMobile = 'ontouchstart' in window || navigator.maxTouchPoints > 0; + + if (isMobile) { + discordElement.addEventListener('click', function (e) { + e.preventDefault(); + showTooltip(e); + + if (copyUsername()) { + tooltip.textContent = 'Discord username: Extroonie (copied)'; + } else { + tooltip.textContent = 'Copy failed - try manually'; + } + }); + } else { + discordElement.addEventListener('mouseenter', showTooltip); + discordElement.addEventListener('mouseleave', hideTooltip); + + discordElement.addEventListener('click', function (e) { + e.preventDefault(); + + if (isTooltipVisible) { + if (copyUsername()) { + showCopiedMessage(); + } else { + tooltip.textContent = 'Copy failed - try manually'; + setTimeout(() => { + tooltip.textContent = 'Discord: Extroonie'; + }, 2000); + } + } + }); + } + + document.addEventListener('click', function (e) { + if (!discordElement.contains(e.target) && !tooltip.contains(e.target)) { + hideTooltip(); + } + }); + + window.addEventListener('scroll', hideTooltip); + window.addEventListener('resize', hideTooltip); + } +}); diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 1be1b33..c31fcda 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -38,10 +38,13 @@ {{ $style := resources.Get "css/style.css" | resources.Minify | resources.Fingerprint }} - + - - + {{ $js := resources.Get "js/discord-tooltip.js" | resources.Minify | resources.Fingerprint }} + + + + {{ with .OutputFormats.Get "rss" -}} {{ printf ` diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html new file mode 100644 index 0000000..9985466 --- /dev/null +++ b/layouts/_default/taxonomy.html @@ -0,0 +1,19 @@ +{{ define "main" }} +