PageSourceSearch

http://casamerica.es/themes/casamerica/js/components/fechas.js?v=10.6.16

js casamerica.es collected 2026-10-02 05:18:52 UTC 2,768 bytes, 56 lines download raw bytes

1(function ($) {
2  'use strict'
3  $('.addtocalendar').appendTo($('#share'))
4  $('.addtocalendar a').prepend('<i class="far fa-calendar-alt"></i> ').addClass('btn btn-outline-info btn-sm')
5  $('.addtocalendar').bind('DOMSubtreeModified', function () {
6    $('ul', this).addClass('list-group')
7    $('ul li', this).addClass('list-group-item')
8  })
9
10  $('.bola li.fecha, #articulo-casamerica header .fecha-evento').each(function () {
11    var fechaDesde = new Date($('.desde time:first-child', this).html())
12    var fechaHasta = new Date($('.hasta time:first-child', this).html())
13    var ahora = new Date();
14
15    if ($('.hasta time:first-child', this).length === 0) {
16      //console.log('día único')
17      fechaHasta = fechaDesde
18    }
19    var tomorrow = new Date(ahora)
20    tomorrow.setDate(ahora.getDate() + 1)
21    if (tomorrow.getYear() === fechaDesde.getYear() && tomorrow.getMonth() === fechaDesde.getMonth() && tomorrow.getDate() === fechaDesde.getDate()) {
22      //console.log('mañana: ' + tomorrow)
23      $('.desde', this).html(' ')
24	  if(ahora < fechaHasta){
25		  $('.hasta', this).html('Hasta el ' + fechaHasta.getDate() + '/' + (parseInt(fechaHasta.getMonth()) + 1))
26	  }
27    } else if (ahora.getYear() === fechaDesde.getYear() && ahora.getMonth() === fechaDesde.getMonth() && ahora.getDate() === fechaDesde.getDate() && ahora.getYear() === fechaHasta.getYear() && ahora.getMonth() === fechaHasta.getMonth() && ahora.getDate() === fechaHasta.getDate()) {
28      $('.desde', this).html('Hoy')
29    } else if ((ahora.getDate()) === fechaDesde && ahora.getDate() <= fechaHasta) {
30      $('.desde', this).html('Hoy fecha ' + fechaDesde)
31      $('.hasta', this).html('Hasta el ' + fechaHasta.getDate() + '/' + parseInt(fechaHasta.getMonth()) + 1)
32    } else if (ahora < fechaDesde) {
33      var diaDesde = fechaDesde.getDate()
34      var mesDesde = fechaDesde.getMonth() + 1
35      //console.log('Desde el ' + diaDesde + '/' + mesDesde)
36
37
38      if(fechaHasta.getYear() === fechaDesde.getYear() && fechaHasta.getMonth() === fechaDesde.getMonth() && fechaHasta.getDate() === fechaDesde.getDate()){
39         $('.desde', this).html('El ' + diaDesde + '/' + mesDesde)
40      }else{
41         $('.desde', this).html('Desde el ' + diaDesde + '/' + mesDesde)
42      }
43
44      $('.hasta', this).remove()
45    } else if (ahora > fechaHasta) {
46      //console.log('evento paso el dia:' + fechaHasta)
47      $(this).remove()
48    } else if (ahora >= fechaDesde && ahora <= fechaHasta) {
49      //console.log('dentro')
50      var diaHasta = fechaHasta.getDate()
51      var mesHasta = fechaHasta.getMonth() + 1
52      $('.desde', this).html('Hasta el ' + diaHasta + '/' + mesHasta)
53      $('.hasta', this).remove()
54    }
55  })
56})(jQuery)

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.