Skip to content

Instantly share code, notes, and snippets.

@midokhorshed
Forked from baslie/index.html
Created November 3, 2025 01:49
Show Gist options
  • Save midokhorshed/33fd6736ea5cc576956e9ccafab1ffd3 to your computer and use it in GitHub Desktop.
Save midokhorshed/33fd6736ea5cc576956e9ccafab1ffd3 to your computer and use it in GitHub Desktop.
Меняем год в копирайте в блоке с классом "uc-copyright" (Тильда)
<!-- ********************************************************************** -->
<!-- Меняем год в копирайте в блоке с классом "uc-copyright" (Тильда) -->
<!-- ********************************************************************** -->
<script>
document.addEventListener('DOMContentLoaded', () => {
const startYear = '2014';
const className = 'uc-copyright';
const currentYear = new Date().getFullYear(); // Получаем текущий год
// Находим элемент <strong> внутри заданного класса
const copyrightElement = document.querySelector(`.${className} strong`);
// Если элемент найден, обновляем его содержимое и стиль
if (copyrightElement) {
copyrightElement.innerHTML = ${startYear}&ndash;${currentYear}`;
copyrightElement.style.fontWeight = '300';
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment