Projekt

Obecné

Profil

« Předchozí | Další » 

Revize bb2d43b5

Přidáno uživatelem Martin Sebela před více než 3 roky(ů)

Re #8159 - frontend bugfixes and refactoring

Zobrazit rozdíly:

website/public/js/zcu-heatmap.js
71 71
  className: className
72 72
}).setLatLng([lat / num, lng / num])
73 73

  
74
const genPopUp = (datasetName, place, number, sum, currentPos, maxPos) => {
75
  const header = `<strong>${datasetName}</strong><div id="place-info">${place}</div>`
76
  const currentNum = `<span id="digit-info">${number}</span>`
77
  // eslint-disable-next-line eqeqeq
78
  const sumNum = `<span id="total-info" style="font-size: large">${(sum && (sum != number)) ? '/' + sum : ''}</span>`
79
  const digitInfo = `<div id="number-info">${currentNum}${sumNum}</div>`
74
const genPopUp = (datasetName, place, count, sum, currentPos, maxPos) => {
75
  const popupHeader = `
76
    <strong>${datasetName}</strong>
77
    <div id="place-info">${place}</div>`
78
  const popupData = `
79
    <div id="number-info">
80
      <span id="digit-info">${count}</span>
81
      <span id="total-info">${(sum && (sum != count)) ? '/' + sum : ''}</span>
82
    </div>`
80 83
  const { previousButton, nextButton, posInfo } = genPopUpControlButtons(currentPos, maxPos)
84

  
81 85
  return `
82
  ${header}
83
  ${digitInfo}
86
  ${popupHeader}
87
  ${popupData}
84 88
  ${genPopUpControls(maxPos > 1 ? [previousButton, posInfo, nextButton] : null)}
85 89
  `
86 90
}
......
110 114
    inDebounce = setTimeout(() => func.apply(context, args), delay)
111 115
  }
112 116
}
117

  
113 118
const onValueChangeRegister = () => {
114 119
  $('#date').change(function () {
115 120
    data = []
116 121
    loadCurrentTimeHeatmap(dataSourceRoute, positionsSourceRoute)
117
    console.log('VAL:', $(this).val())
118 122
    const date = new Date($(this).val())
119 123
    $('#player-date').html(`${date.getDate()}. ${date.getMonth() + 1}. ${date.getFullYear()}`)
124
    changeUrl()
120 125
  })
126

  
121 127
  $('#dataset-dropdown-time input[type="radio"]').each(function () {
122 128
    $(this).change(function () {
123 129
      currentTime = $(this).val()
124 130
      updateHeaderControls()
125 131
      setTimeline()
126 132
      drawHeatmap(data[currentTime])
133
      changeUrl()
127 134
    })
128 135
  })
136

  
129 137
  $('input[type=checkbox]').each(function () {
130 138
    $(this).change(
131 139
      debounce(() => onCheckboxClicked(this), 1000)
132 140
    )
133 141
  })
134 142
}
143

  
135 144
/**
136 145
 * Initialize leaflet map on start position which can be default or set based on user action
137 146
 */
......
330 339

  
331 340
function updateHeaderControls () {
332 341
  $(`#time_${currentTime}`).prop('checked', true)
333
  $('#dropdownMenuButton-time').html(currentTime >= 10 ? `${currentTime}:00` : `0${currentTime}:00`)
342
  $('#dropdownMenuButtonTime').html((currentTime < 10 ? '0' : '') + `${currentTime}:00`)
334 343
}
335 344

  
336 345
function setTimeline () {

Také k dispozici: Unified diff