burguillos.info/public/js/bundle.js

129 lines
32 KiB
JavaScript
Raw Normal View History

2023-05-07 03:09:36 +02:00
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
2023-08-21 00:58:11 +02:00
/***/ "./js-src/index.js":
2023-05-07 03:09:36 +02:00
/*!*************************!*\
2023-08-21 00:58:11 +02:00
!*** ./js-src/index.js ***!
2023-05-07 03:09:36 +02:00
\*************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
2023-11-28 23:48:34 +01:00
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/* harmony import */ var _burguillosinfo_carousel_ad__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @burguillosinfo/carousel-ad */ \"./js-src/carousel-ad.ts\");\n\n\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\");\nlet fakeSearchInput;\nlet searchMobile;\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n const menu_expand = document.querySelector('a.menu-expand');\n const mobile_foldable = document.querySelector('nav.mobile-foldable');\n const transparentFullscreenHide = document.querySelector('div.transparent-fullscreen-hide');\n const contentsWithoutMenu = document.querySelector('div.contents-without-menu');\n const tables = document.querySelectorAll('table');\n fillFarmaciaGuardia();\n new _burguillosinfo_carousel_ad__WEBPACK_IMPORTED_MODULE_1__[\"default\"]().run();\n addEasterEggAnimation();\n if (menu_expand !== null && mobile_foldable !== null && transparentFullscreenHide !== null && contentsWithoutMenu !== null) {\n mobile_foldable.toggleAttribute('aria-hidden');\n if (mobile_foldable.getAttribute('aria-hidden') !== null) {\n mobile_foldable.setAttribute('aria-hidden', true);\n }\n transparentFullscreenHide.addEventListener('click', () => {\n mobile_foldable.classList.remove('show');\n transparentFullscreenHide.classList.remove('show');\n menu_expand.classList.remove('active');\n contentsWithoutMenu.removeAttribute('aria-hidden');\n mobile_foldable.setAttribute('aria-hidden', true);\n });\n menu_expand.addEventListener('click', () => {\n menu_expand.classList.toggle('active');\n mobile_foldable.classList.toggle('show');\n transparentFullscreenHide.classList.toggle('show');\n contentsWithoutMenu.toggleAttribute('aria-hidden');\n if (contentsWithoutMenu.getAttribute('aria-hidden') !== null) {\n contentsWithoutMenu.setAttribute('aria-hidden', true);\n }\n mobile_foldable.toggleAttribute('aria-hidden');\n if (mobile_foldable.getAttribute('aria-hidden') !== null) {\n mobile_foldable.setAttribute('aria-hidden', true);\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 if (window !== undefined && window.Android !== undefined) {\n executeAndroidExclusiveCode(Android);\n }\n searchMobile = document.querySelector('nav.mobile-shortcuts div.search');\n if (searchMobile !== null) {\n fakeSearchInput = searchMobile.querySelector('input');\n addListenersSearch();\n }\n}, false);\nfunction fillFarmaciaGuardia() {\n const farmaciaName = document.querySelector('#farmacia-name');\n const farmaciaAddress = document.querySelector('#farmacia-address');\n if (farmaciaName !== null || farmaciaAddress !== null) {\n const port = _port();\n const url = new URL(window.location.protocol + \"//\" + window.location.hostname + port + '/farmacia-guardia.json');\n fetch(url).then(async res => {\n const farmacia = await res.json();\n if (farmaciaName !== null) {\n farmaciaName.innerText = farmacia.name;\n farmaciaAddress.innerText = farmacia.address;\n }\n });\n }\n}\nfunction addListenersSearch() {\n const searchInPage = d
2023-05-07 03:29:47 +02:00
/***/ }),
/***/ "./node_modules/tablesort/src/sorts/tablesort.number.js":
/*!**************************************************************!*\
!*** ./node_modules/tablesort/src/sorts/tablesort.number.js ***!
\**************************************************************/
/***/ (() => {
eval("(function(){\n var cleanNumber = function(i) {\n return i.replace(/[^\\-?0-9.]/g, '');\n },\n\n compareNumber = function(a, b) {\n a = parseFloat(a);\n b = parseFloat(b);\n\n a = isNaN(a) ? 0 : a;\n b = isNaN(b) ? 0 : b;\n\n return a - b;\n };\n\n Tablesort.extend('number', function(item) {\n return item.match(/^[-+]?[£\\x24Û¢´€]?\\d+\\s*([,\\.]\\d{0,2})/) || // Prefixed currency\n item.match(/^[-+]?\\d+\\s*([,\\.]\\d{0,2})?[£\\x24Û¢´€]/) || // Suffixed currency\n item.match(/^[-+]?(\\d)*-?([,\\.]){0,1}-?(\\d)+([E,e][\\-+][\\d]+)?%?$/); // Number\n }, function(a, b) {\n a = cleanNumber(a);\n b = cleanNumber(b);\n\n return compareNumber(b, a);\n });\n}());\n\n\n//# sourceURL=webpack://BurguillosInfo/./node_modules/tablesort/src/sorts/tablesort.number.js?");
2023-05-07 03:09:36 +02:00
/***/ }),
/***/ "./node_modules/tablesort/src/tablesort.js":
/*!*************************************************!*\
!*** ./node_modules/tablesort/src/tablesort.js ***!
\*************************************************/
/***/ ((module) => {
eval(";(function() {\n function Tablesort(el, options) {\n if (!(this instanceof Tablesort)) return new Tablesort(el, options);\n\n if (!el || el.tagName !== 'TABLE') {\n throw new Error('Element must be a table');\n }\n this.init(el, options || {});\n }\n\n var sortOptions = [];\n\n var createEvent = function(name) {\n var evt;\n\n if (!window.CustomEvent || typeof window.CustomEvent !== 'function') {\n evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(name, false, false, undefined);\n } else {\n evt = new CustomEvent(name);\n }\n\n return evt;\n };\n\n var getInnerText = function(el,options) {\n return el.getAttribute(options.sortAttribute || 'data-sort') || el.textContent || el.innerText || '';\n };\n\n // Default sort method if no better sort method is found\n var caseInsensitiveSort = function(a, b) {\n a = a.trim().toLowerCase();\n b = b.trim().toLowerCase();\n\n if (a === b) return 0;\n if (a < b) return 1;\n\n return -1;\n };\n\n var getCellByKey = function(cells, key) {\n return [].slice.call(cells).find(function(cell) {\n return cell.getAttribute('data-sort-column-key') === key;\n });\n };\n\n // Stable sort function\n // If two elements are equal under the original sort function,\n // then there relative order is reversed\n var stabilize = function(sort, antiStabilize) {\n return function(a, b) {\n var unstableResult = sort(a.td, b.td);\n\n if (unstableResult === 0) {\n if (antiStabilize) return b.index - a.index;\n return a.index - b.index;\n }\n\n return unstableResult;\n };\n };\n\n Tablesort.extend = function(name, pattern, sort) {\n if (typeof pattern !== 'function' || typeof sort !== 'function') {\n throw new Error('Pattern and sort must be a function');\n }\n\n sortOptions.push({\n name: name,\n pattern: pattern,\n sort: sort\n });\n };\n\n Tablesort.prototype = {\n\n init: function(el, options) {\n var that = this,\n firstRow,\n defaultSort,\n i,\n cell;\n\n that.table = el;\n that.thead = false;\n that.options = options;\n\n if (el.rows && el.rows.length > 0) {\n if (el.tHead && el.tHead.rows.length > 0) {\n for (i = 0; i < el.tHead.rows.length; i++) {\n if (el.tHead.rows[i].getAttribute('data-sort-method') === 'thead') {\n firstRow = el.tHead.rows[i];\n break;\n }\n }\n if (!firstRow) {\n firstRow = el.tHead.rows[el.tHead.rows.length - 1];\n }\n that.thead = true;\n } else {\n firstRow = el.rows[0];\n }\n }\n\n if (!firstRow) return;\n\n var onClick = function() {\n if (that.current && that.current !== this) {\n that.current.removeAttribute('aria-sort');\n }\n\n that.current = this;\n that.sortTable(this);\n };\n\n // Assume first row is the header and attach a click handler to each.\n for (i = 0; i < firstRow.cells.length; i++) {\n cell = firstRow.cells[i];\n cell.setAttribute('role','columnheader');\n if (cell.getAttribute('data-sort-method') !== 'none') {\n cell.tabindex = 0;\n cell.addEventListener('click', onClick, false);\n\n if (cell.getAttribute('data-sort-default') !== null) {\n defaultSort = cell;\n }\n }\n }\n\n if (defaultSort) {\n that.current = defaultSort;\n that.sortTable(defaultSort);\n }\n },\n\n sortTable: function(header, update) {\n var that = this,\n columnKey = header.getAttribute('data-sort-column-key'),\n column = header.cellIndex,\n sortFunction = caseInsensitiveSort,\n item = '',\n items = [],\n i = that.thead ? 0 : 1,\n sortMethod = header.getAttribute('data-sort-method'),\n sortOrder = header.getAttribute('aria-sort');\n\n that.table.dispatchE
2023-11-28 23:48:34 +01:00
/***/ }),
/***/ "./js-src/carousel-ad.ts":
/*!*******************************!*\
!*** ./js-src/carousel-ad.ts ***!
\*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
2023-11-29 17:01:45 +01:00
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ CarouselAd)\n/* harmony export */ });\nclass CarouselAd {\n constructor() {\n this.currentAdNumber = null;\n this.ad = null;\n this.timeoutNumber = null;\n this.firstAd = true;\n this.isLockedSwipe = false;\n }\n getCarousel() {\n const carousel = document.querySelector('.carousel');\n if (carousel === null || !(carousel instanceof HTMLElement)) {\n this.noMoreAds();\n CarouselAd.fail('No carousel.');\n }\n return carousel;\n }\n static fail(error) {\n throw new Error(error);\n }\n async run() {\n this.loadOneAd();\n try {\n let start = 0;\n let end = 0;\n this.getCarousel().addEventListener('pointerdown', (event) => {\n start = event.pageX;\n console.log(start);\n });\n this.getCarousel().addEventListener('pointerup', (event) => {\n end = event.pageX;\n console.log(end);\n if (start - end > 100) {\n if (this.isLockedSwipe) {\n return;\n }\n if (this.timeoutNumber !== null) {\n window.clearTimeout(this.timeoutNumber);\n }\n this.loadOneAd();\n }\n else {\n const a = this.retrieveLinkCarousel();\n if (a !== null) {\n window.location.href = a.href;\n }\n }\n });\n }\n catch (e) {\n console.log(e);\n return;\n }\n }\n noMoreAds() {\n const carousel = this.getCarousel();\n if (carousel !== null) {\n carousel.remove();\n }\n this.expandPageContents();\n if (this.timeoutNumber === null) {\n return;\n }\n window.clearTimeout(this.timeoutNumber);\n }\n expandPageContents() {\n const pageContents = document.querySelector('div.page-contents');\n if (pageContents === null) {\n return;\n }\n pageContents.classList.add('no-carousel');\n }\n retrieveLinkCarousel() {\n const carousel = this.getCarousel();\n const a = carousel.querySelector('a');\n if (a === null) {\n return null;\n }\n return a;\n }\n async loadOneAd() {\n try {\n const params = new URLSearchParams();\n if (this.currentAdNumber !== null) {\n params.append('n', \"\" + this.currentAdNumber);\n }\n const response = await fetch('/next-ad.json?' + params);\n const responseJson = await response.json();\n this.currentAdNumber = responseJson.current_ad_number;\n this.ad = responseJson.ad;\n if (this.ad === null) {\n this.noMoreAds();\n return;\n }\n const must_continue = responseJson.continue;\n const carousel = this.getCarousel();\n if (must_continue === 0\n || carousel.offsetWidth === 0) {\n this.noMoreAds();\n return;\n }\n const aPrev = this.retrieveLinkCarousel();\n const allAnchors = carousel.querySelectorAll('a');\n const a = document.createElement('a');\n a.addEventListener('click', (event) => {\n event.preventDefault();\n });\n a.addEventListener('pointerdown', (event) => {\n event.preventDefault();\n });\n a.addEventListener('pointerup', (event) => {\n event.preventDefault();\n });\n const image = document.createElement('img');\n const text_container = d
2023-11-28 23:48:34 +01:00
2023-05-07 03:09:36 +02:00
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
2023-08-21 00:58:11 +02:00
/******/ var __webpack_exports__ = __webpack_require__("./js-src/index.js");
2023-05-07 03:09:36 +02:00
/******/
/******/ })()
;