diff options
Diffstat (limited to '')
-rw-r--r-- | index.html | 115 |
1 files changed, 91 insertions, 24 deletions
@@ -95,6 +95,11 @@ <div class="title-bar"> <span>ABOUT.rtf — /home/lain</span> <div class="controls"> + <label> + <button id="copyUrl" data-radio="home" title="Copy url to this window"> + <img src="./copy.svg" width="18" height="18" style="padding-left: 1px;" alt="copy"> + </button> + </label> <label for="close"> <img src="./close.svg" width="18" height="18" alt="close"> </label> @@ -143,8 +148,11 @@ <div class="title-bar"> <span>PROJECTS.rtf — /home/lain</span> <div class="controls"> + <button id="copyUrl" data-radio="projects" title="Copy url to this window"> + <img src="./copy.svg" width="18" height="18" alt="copy"> + </button> <label for="close"> - <img src="./close.svg" width="18" height="18" alt="close"> + <img src="./close.svg" width="18" height="18" alt="close"> </label> </div> </div> @@ -239,9 +247,6 @@ <a href="https://mchal.lol" target="_blank" rel="noopener noreferer" title="michal"> <img src="michal.gif" alt="michal"> </a> - <a href="https://astral.im" target="_blank" rel="noopener noreferer" title="astral"> - <img src="https://astral.im/astral.gif" alt="astral"> - </a> <a href="https://arimelody.me" target="_blank" rel="noopener noreferer" title="ari melody"> <img src="https://arimelody.me/img/buttons/ari%20melody.gif" alt="ari melody web button"> </a> @@ -301,30 +306,92 @@ }); </script> - <script> - let colonVisible = true; + <script> + let colonVisible = true; + + function updateClockAndCalendar() { + const now = new Date(); + const hours = now.getHours(); + const minutes = now.getMinutes(); + + const displayHours = hours < 10 ? `0${hours}` : hours; + const displayMinutes = minutes < 10 ? `0${minutes}` : minutes; - function updateClockAndCalendar() { - const now = new Date(); - const hours = now.getHours(); - const minutes = now.getMinutes(); + const colon = colonVisible ? ':' : ' '; + document.getElementById('time').textContent = `${displayHours}${colon}${displayMinutes}`; + colonVisible = !colonVisible; - const displayHours = hours < 10 ? `0${hours}` : hours; - const displayMinutes = minutes < 10 ? `0${minutes}` : minutes; + const days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']; + const months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC']; + document.getElementById('day').textContent = days[now.getDay()]; + document.getElementById('date').textContent = now.getDate(); + document.getElementById('month').textContent = months[now.getMonth()]; + } + + updateClockAndCalendar(); + setInterval(updateClockAndCalendar, 1000); + </script> + + <script> + window.addEventListener('DOMContentLoaded', () => { + const params = new URLSearchParams(window.location.search); + const appId = params.get('app'); + const contentId = params.get('content'); + if (appId) { + const radio = document.getElementById(appId); + if (radio) { + radio.checked = true; - const colon = colonVisible ? ':' : ' '; - document.getElementById('time').textContent = `${displayHours}${colon}${displayMinutes}`; - colonVisible = !colonVisible; + if (contentId) { + const contentRadio = document.getElementById(appId+"-"+contentId); + if (contentRadio) { + contentRadio.checked = true; + } + } + } + } + }); + </script> + + <script> + document.addEventListener('DOMContentLoaded', () => { + document.querySelectorAll('#copyUrl').forEach(button => { + console.log("found button"); + button.addEventListener('click', () => { + const radioId = button.dataset.radio; + const radio = document.getElementById(radioId); + console.log(`Button clicked for: ${radioId}`); + console.log(`Radio element:`, radio); + + if (radio && radio.checked) { + let url = `${location.origin}${location.pathname}?app=${radioId}`; + const contentRadios = document.querySelectorAll('input[name="'+radioId+'_menu"]'); + for (const contentRadio of contentRadios) { + if (contentRadio.checked) { + const contentRadioId = contentRadio.id.replace(radioId+"-", ""); + url = url+`&content=${contentRadioId}` + } + } + navigator.clipboard.writeText(url) + .then(() => { + const originalText = button.innerHTML; + button.innerHTML = '<img src="./confirm.svg" width="18" height="18" style="padding-left: 1px;" alt="copy">'; + button.disabled = true; + + setTimeout(() => { + button.innerHTML = originalText; + button.disabled = false; + }, 500); + }) + .catch(err => console.log('Failed to copy URL: ' + err)); + } else { + alert('This window is not currently active.'); + } + }); + }); + }); + </script> - const days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']; - const months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC']; - document.getElementById('day').textContent = days[now.getDay()]; - document.getElementById('date').textContent = now.getDate(); - document.getElementById('month').textContent = months[now.getMonth()]; - } - updateClockAndCalendar(); - setInterval(updateClockAndCalendar, 1000); - </script> </body> </html> |