From be286a3260587c21efde470ee439363db0df0063 Mon Sep 17 00:00:00 2001 From: Sergiotarxz Date: Fri, 25 Aug 2023 01:29:03 +0200 Subject: [PATCH] Adding easter egg explaining the logo for mobile users. --- content/categories/index.xml | 3 +++ js-src/index.js | 11 +++++++++++ public/css/styles.css | 8 ++++++++ public/css/styles.scss | 12 ++++++++++++ public/js/bundle.js | 2 +- 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/content/categories/index.xml b/content/categories/index.xml index 6e54b28..b3acec1 100644 --- a/content/categories/index.xml +++ b/content/categories/index.xml @@ -1,6 +1,9 @@ Información de Burguillos. +
+ The logo of Burguillos.info +

Burguillos.info no está afiliado con el Ayuntamiento de Burguillos.

Esta página está destinada a informar de los sucesos y negocios de nuestro pueblo, cualquiera puede redactar una noticia para que aparezca en este medio mientras pase un proceso de revisión por parte del staff de Burguillos.info.

diff --git a/js-src/index.js b/js-src/index.js index 787f4bd..008a61b 100644 --- a/js-src/index.js +++ b/js-src/index.js @@ -9,6 +9,7 @@ window.onload = () => { const tables = document.querySelectorAll('table') loadAd() + addEasterEggAnimation() if (menu_expand !== null && mobile_foldable !== null) { menu_expand.addEventListener('click', () => { @@ -30,6 +31,16 @@ window.onload = () => { } }; +function addEasterEggAnimation() { + const logoContainer = document.querySelector('div.burguillos-logo-container') + if (logoContainer === null) { + return; + } + logoContainer.addEventListener('click', () => { + logoContainer.classList.toggle('active') + }) +} + let current_ad_number = null function expand_page_contents() { diff --git a/public/css/styles.css b/public/css/styles.css index 96f250c..e6de2c5 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -174,6 +174,14 @@ body { vertical-align: middle; width: 40px; height: 40px; } + body div.page-contents nav > a > img.index-image-menu, body div.page-contents div.burguillos-logo-container > img { + transition-property: transform; + transition-duration: 2s; + transition-delay: 2s; } + body div.page-contents nav > a.selected > img.index-image-menu, + body div.page-contents nav > a:hover > img.index-image-menu, + body div.page-contents div.burguillos-logo-container.active > img { + transform: rotate(-1.5rad); } body div.page-contents nav.desktop { display: none; } body div.page-contents nav.desktop a { diff --git a/public/css/styles.scss b/public/css/styles.scss index 756247c..6e59375 100644 --- a/public/css/styles.scss +++ b/public/css/styles.scss @@ -257,6 +257,18 @@ body { height: 40px; } + nav > a > img.index-image-menu, div.burguillos-logo-container > img { + transition-property: transform; + transition-duration: 2s; + transition-delay: 2s; + } + + nav > a.selected > img.index-image-menu, + nav > a:hover > img.index-image-menu, + div.burguillos-logo-container.active > img { + transform: rotate(-1.5rad); + } + nav.desktop { display: none; diff --git a/public/js/bundle.js b/public/js/bundle.js index 241bf3d..007a0d8 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -16,7 +16,7 @@ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var tablesort__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tablesort */ \"./node_modules/tablesort/src/tablesort.js\");\n/* harmony import */ var tablesort__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(tablesort__WEBPACK_IMPORTED_MODULE_0__);\n\n\nwindow.Tablesort = __webpack_require__(/*! tablesort */ \"./node_modules/tablesort/src/tablesort.js\");\n__webpack_require__(/*! tablesort/src/sorts/tablesort.number */ \"./node_modules/tablesort/src/sorts/tablesort.number.js\");\n\nwindow.onload = () => {\n const menu_expand = document.querySelector('a.menu-expand');\n const mobile_foldable = document.querySelector('nav.mobile-foldable');\n const tables = document.querySelectorAll('table')\n\n loadAd()\n\n if (menu_expand !== null && mobile_foldable !== null) {\n menu_expand.addEventListener('click', () => {\n mobile_foldable.classList.toggle('show');\n });\n }\n\n for (const table of tables) {\n const header = table.querySelector('tr');\n if (header !== null) {\n header.setAttribute('data-sort-method', 'none')\n for (const th of header.querySelectorAll('th')) {\n if (th.getAttribute('data-sort-method') == null) {\n th.setAttribute('data-sort-method', 'thead')\n }\n }\n }\n new (tablesort__WEBPACK_IMPORTED_MODULE_0___default())(table)\n }\n};\n\nlet current_ad_number = null\n\nfunction expand_page_contents() {\n const page_contents = document.querySelector('div.page-contents'); \n if (page_contents === null) {\n return;\n }\n page_contents.classList.add('no-carousel');\n}\n\nfunction no_more_ads() {\n const carousel = document.querySelector('.carousel');\n if (carousel !== null) {\n carousel.remove();\n }\n expand_page_contents();\n}\n\nfunction loadAd() {\n const params = new URLSearchParams();\n if (current_ad_number !== null) {\n params.append('n', \"\"+current_ad_number);\n }\n fetch('/next-ad.json?' + params).then((res) => {\n return res.json()\n }).then((res) => {\n current_ad_number = res.current_ad_number\n const ad = res.ad\n const must_continue = res.continue\n const carousel = document.querySelector('.carousel');\n if (must_continue === 0\n || carousel === null\n || carousel.offsetWidth === 0) {\n no_more_ads();\n return;\n }\n carousel.innerHTML = \"\"\n const a = document.createElement('a')\n const image = document.createElement('img')\n const text_container = document.createElement('div')\n const text = document.createElement('h4')\n const promoted = document.createElement('p')\n\n promoted.classList.add('promoted-tag')\n promoted.innerText = \"Promocionado\"\n image.src = ad.img\n text.innerText = ad.text\n a.href = ad.href\n\n a.append(image)\n text_container.append(promoted)\n text_container.append(text)\n a.append(text_container)\n carousel.append(a);\n\n window.setTimeout(() => {\n loadAd()\n }, ad.seconds * 1000)\n }).catch(() => {\n window.setTimeout(() => {\n loadAd()\n }, 1000)\n });\n}\n\n\n//# sourceURL=webpack://BurguillosInfo/./js-src/index.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var tablesort__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tablesort */ \"./node_modules/tablesort/src/tablesort.js\");\n/* harmony import */ var tablesort__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(tablesort__WEBPACK_IMPORTED_MODULE_0__);\n\n\nwindow.Tablesort = __webpack_require__(/*! tablesort */ \"./node_modules/tablesort/src/tablesort.js\");\n__webpack_require__(/*! tablesort/src/sorts/tablesort.number */ \"./node_modules/tablesort/src/sorts/tablesort.number.js\");\n\nwindow.onload = () => {\n const menu_expand = document.querySelector('a.menu-expand');\n const mobile_foldable = document.querySelector('nav.mobile-foldable');\n const tables = document.querySelectorAll('table')\n\n loadAd()\n addEasterEggAnimation()\n\n if (menu_expand !== null && mobile_foldable !== null) {\n menu_expand.addEventListener('click', () => {\n mobile_foldable.classList.toggle('show');\n });\n }\n\n for (const table of tables) {\n const header = table.querySelector('tr');\n if (header !== null) {\n header.setAttribute('data-sort-method', 'none')\n for (const th of header.querySelectorAll('th')) {\n if (th.getAttribute('data-sort-method') == null) {\n th.setAttribute('data-sort-method', 'thead')\n }\n }\n }\n new (tablesort__WEBPACK_IMPORTED_MODULE_0___default())(table)\n }\n};\n\nfunction addEasterEggAnimation() {\n const logoContainer = document.querySelector('div.burguillos-logo-container')\n if (logoContainer === null) {\n return;\n }\n logoContainer.addEventListener('click', () => {\n logoContainer.classList.toggle('active')\n })\n}\n\nlet current_ad_number = null\n\nfunction expand_page_contents() {\n const page_contents = document.querySelector('div.page-contents'); \n if (page_contents === null) {\n return;\n }\n page_contents.classList.add('no-carousel');\n}\n\nfunction no_more_ads() {\n const carousel = document.querySelector('.carousel');\n if (carousel !== null) {\n carousel.remove();\n }\n expand_page_contents();\n}\n\nfunction loadAd() {\n const params = new URLSearchParams();\n if (current_ad_number !== null) {\n params.append('n', \"\"+current_ad_number);\n }\n fetch('/next-ad.json?' + params).then((res) => {\n return res.json()\n }).then((res) => {\n current_ad_number = res.current_ad_number\n const ad = res.ad\n const must_continue = res.continue\n const carousel = document.querySelector('.carousel');\n if (must_continue === 0\n || carousel === null\n || carousel.offsetWidth === 0) {\n no_more_ads();\n return;\n }\n carousel.innerHTML = \"\"\n const a = document.createElement('a')\n const image = document.createElement('img')\n const text_container = document.createElement('div')\n const text = document.createElement('h4')\n const promoted = document.createElement('p')\n\n promoted.classList.add('promoted-tag')\n promoted.innerText = \"Promocionado\"\n image.src = ad.img\n text.innerText = ad.text\n a.href = ad.href\n\n a.append(image)\n text_container.append(promoted)\n text_container.append(text)\n a.append(text_container)\n carousel.append(a);\n\n window.setTimeout(() => {\n loadAd()\n }, ad.seconds * 1000)\n }).catch(() => {\n window.setTimeout(() => {\n loadAd()\n }, 1000)\n });\n}\n\n\n//# sourceURL=webpack://BurguillosInfo/./js-src/index.js?"); /***/ }),