Skip to content

Commit

Permalink
MAN-183 fix timepicker code issues wip
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-mills committed Dec 18, 2024
1 parent ba03318 commit 1d7da33
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions assets/js/jquery.timepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@
self.trigger('blur')
}

const list = tp.list // check if input is readonly
let list = tp.list // check if input is readonly

if (self.prop('readonly')) {
return
Expand Down Expand Up @@ -1478,7 +1478,7 @@

list.offset(listOffset) // position scrolling

const selected = list.find('.ui-timepicker-selected')
let selected = list.find('.ui-timepicker-selected')

if (!selected.length) {
const timeInt = tp.anytime2int(tp._getTimeValue())
Expand Down Expand Up @@ -1538,7 +1538,7 @@
return this.each(function () {
const self = $(this)
const tp = self[0].timepickerObj
const settings = tp.settings
let settings = tp.settings
const list = tp.list

if (_typeof(key) == 'object') {
Expand Down Expand Up @@ -1610,12 +1610,7 @@
const timeRangeErrorEvent = new CustomEvent('timeRangeError', EVENT_DEFAULTS)
tp.targetEl.dispatchEvent(timeRangeErrorEvent)
}

if (settings.forceRoundTime) {
const prettyTime = tp._roundAndFormatTime(seconds)
} else {
const prettyTime = tp._int2time(seconds)
}
const prettyTime = settings.forceRoundTime ? tp._roundAndFormatTime(seconds) : tp._int2time(seconds)

if (value && prettyTime === null && settings.noneOption) {
prettyTime = value
Expand Down Expand Up @@ -1665,7 +1660,7 @@

function _render(self) {
const tp = self[0].timepickerObj
const list = tp.list
let list = tp.list
const settings = tp.settings

if (list && list.length) {
Expand Down Expand Up @@ -1703,7 +1698,7 @@

self.hide().after(list)
} else {
const appendTo = settings.appendTo
let appendTo = settings.appendTo

if (typeof appendTo === 'string') {
appendTo = $(appendTo)
Expand Down Expand Up @@ -1767,7 +1762,7 @@
function _keydownhandler(e) {
const self = $(this)
const tp = self[0].timepickerObj
const list = tp.list
let list = tp.list

if (!list || !Timepicker.isVisible(list)) {
if (e.keyCode == 40) {
Expand All @@ -1782,6 +1777,7 @@
return true
}
}
let selected = list.find('.ui-timepicker-selected')

switch (e.keyCode) {
case 13:
Expand All @@ -1799,7 +1795,6 @@

case 38:
// up
const selected = list.find('.ui-timepicker-selected')

if (!selected.length) {
list.find('li').each(function (i, obj) {
Expand Down

0 comments on commit 1d7da33

Please sign in to comment.