Maintenance: Upgrade jQuery to version 3.6.

This commit is contained in:
Bola Ahmed Buari 2022-02-02 10:51:08 +01:00 committed by Dominik Klein
parent 04ad3348b7
commit 296d402ba0
116 changed files with 3685 additions and 2604 deletions

View file

@ -77,8 +77,7 @@ class App.Controller extends Spine.Controller
# release bindings
if @el
@el.undelegate()
@el.unbind()
@el.off()
@el.empty()
# release spine bindings (see release() of spine.coffee)
@ -220,7 +219,7 @@ class App.Controller extends Spine.Controller
userInfo: (data) ->
el = data.el || $('[data-id="customer_info"]')
el.unbind()
el.off()
# start customer info controller
new App.WidgetUser(

View file

@ -181,7 +181,7 @@ class App.ControllerModal extends App.Controller
form = @el
# focus first input, select or textarea
form.find('input:not([disabled]):not([type="hidden"]):not(".btn"), select:not([disabled]), textarea:not([disabled])').first().focus()
form.find('input:not([disabled]):not([type="hidden"]):not(".btn"), select:not([disabled]), textarea:not([disabled])').first().trigger('focus')
@initalFormParams = @formParams()

View file

@ -18,7 +18,7 @@ class App.GenericHistory extends App.ControllerModal
content = $ App.view('generic/history')(
items: localItem
)
content.find('a[data-type="sortorder"]').bind('click', (e) =>
content.find('a[data-type="sortorder"]').on('click', (e) =>
e.preventDefault()
@sortorder()
)

View file

@ -34,11 +34,8 @@ class App.ControllerForm extends App.Controller
@form.prepend('<div class="alert alert--danger js-danger js-alert hide" role="alert"></div>')
@form.prepend('<div class="alert alert--success js-success hide" role="alert"></div>')
# Fix for Issue #2510 - Zammad Customers shown as Agents in IE
# Previously the handlers are called directly, before the DOM elements are ready, thereby causing a race condition under IE11.
# Now we only dispatch the handlers after the DOM is ready.
if @handlers.length
$(@dispatchHandlers)
@dispatchHandlers()
# if element is given, prepend form to it
if @el
@ -160,7 +157,7 @@ class App.ControllerForm extends App.Controller
for eventSelector, callback of @events
do (eventSelector, callback) ->
evs = eventSelector.split(' ')
fieldset.find(evs[1]).bind(evs[0], (e) -> callback(e))
fieldset.find(evs[1]).on(evs[0], (e) -> callback(e))
# bind tool tips
fieldset.find('.js-helpMessage').tooltip()
@ -316,7 +313,7 @@ class App.ControllerForm extends App.Controller
item_bind = item.find('.richtext-content')
item_event = 'blur'
item_bind.bind(item_event, (e) =>
item_bind.on(item_event, (e) =>
@lastChangedAttribute = attribute.name
params = App.ControllerForm.params(@form)
for handler in @handlers
@ -787,7 +784,7 @@ class App.ControllerForm extends App.Controller
# set autofocus by delay to make validation testable
App.Delay.set(
->
lookupForm.find('.has-error').find('input, textarea, select').first().focus()
lookupForm.find('.has-error').find('input, textarea, select').first().trigger('focus')
200
'validate'
)

View file

@ -21,7 +21,7 @@ class App.ControllerReorderModal extends App.ControllerModal
onShown: ->
super
@$('.js-submit').focus()
@$('.js-submit').trigger('focus')
save: ->
ids = @$('tr.item').toArray().map (el) -> parseInt(el.dataset.id)

View file

@ -406,7 +406,7 @@ class App.ControllerTable extends App.Controller
if @bindCheckbox.events
for event, callback of @bindCheckbox.events
do (table, event, callback) ->
table.delegate('input[name="bulk"]', event, (e) ->
table.on(event, 'input[name="bulk"]', (e) ->
e.stopPropagation()
id = $(e.currentTarget).parents('tr').data('id')
checked = $(e.currentTarget).prop('checked')
@ -424,12 +424,12 @@ class App.ControllerTable extends App.Controller
if @checkbox
# click first tr>td, catch click
table.delegate('tr > td:nth-child(1)', 'click', (e) ->
table.on('click', 'tr > td:nth-child(1)', (e) ->
e.stopPropagation()
)
# bind on full bulk click
table.delegate('input[name="bulk_all"]', 'change', (e) =>
table.on('change', 'input[name="bulk_all"]', (e) =>
e.stopPropagation()
clicks = []
if $(e.currentTarget).prop('checked')

View file

@ -20,7 +20,7 @@ class App.ControllerWizardModal extends App.ControllerFullPage
@hideAlert(name)
@$('.setup.wizard').addClass('hide')
@$(".setup.wizard.#{name}").removeClass('hide')
@$(".setup.wizard.#{name} input, .setup.wizard.#{name} select").first().focus()
@$(".setup.wizard.#{name} input, .setup.wizard.#{name} select").first().trigger('focus')
showAlert: (screen, message) =>
@$(".#{screen}").find('.alert').first().removeClass('hide').text(App.i18n.translatePlain(message))

View file

@ -204,7 +204,7 @@ class ChannelChat extends App.ControllerSubContent
onUrlSubmit: (event) ->
event.preventDefault() if event
@urlInput.focus()
@urlInput.trigger('focus')
@changeDemoWebsite()
changeDemoWebsite: ->

View file

@ -610,11 +610,11 @@ class ChannelEmailAccountWizard extends App.ControllerWizardModal
if !verify
@$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-inbound')
@$('.js-inbound-acknowledge .js-next').unbind('click.verify')
@$('.js-inbound-acknowledge .js-next').off('click.verify')
else
@$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-intro')
@$('.js-inbound-acknowledge .js-next').attr('data-slide', '')
@$('.js-inbound-acknowledge .js-next').unbind('click.verify').bind('click.verify', (e) =>
@$('.js-inbound-acknowledge .js-next').off('click.verify').on('click.verify', (e) =>
e.preventDefault()
@verify(@account)
)

View file

@ -170,7 +170,7 @@ class ChannelSmsAccount extends App.ControllerModal
params: @channel
)
@renderAdapterOptions(@channel.options?.adapter, el)
el.find('[name="options::adapter"]').bind('change', (e) =>
el.find('[name="options::adapter"]').on('change', (e) =>
@renderAdapterOptions(e.target.value, el)
)
el
@ -309,7 +309,7 @@ class ChannelSmsNotification extends App.ControllerModal
params: @channel
)
@renderAdapterOptions(@channel.options?.adapter, el)
el.find('[name="options::adapter"]').bind('change', (e) =>
el.find('[name="options::adapter"]').on('change', (e) =>
@renderAdapterOptions(e.target.value, el)
)
el

View file

@ -219,7 +219,7 @@ class AccountEdit extends App.ControllerModal
term: ''
group_id: ''
renderSearchTerms()
content.find('.js-searchTermList [name="search::term"]').last().focus()
content.find('.js-searchTermList [name="search::term"]').last().trigger('focus')
removeSearchTerm = (event) =>
index = $(event.currentTarget).attr('data-index')
@ -248,7 +248,7 @@ class AccountEdit extends App.ControllerModal
renderSearchTerms()
content.find('.js-searchTermAdd').click(addSearchTerm)
content.find('.js-searchTermAdd').on('click', addSearchTerm)
content.find('.js-searchTermList').on('click', '.js-searchTermRemove', removeSearchTerm)
content.find('.js-mentionsGroup').replaceWith createGroupSelection(@channel.options.sync.mentions.group_id, 'mentions')

View file

@ -27,7 +27,7 @@ class App.GlobalSearchWidget extends App.Controller
$('#global-search').val(currentValue)
delay = ->
$('#global-search').focus()
$('#global-search').trigger('focus')
App.Delay.set(delay, 20, 'global-search-delay')
)

View file

@ -33,13 +33,13 @@ class App.KeyboardShortcutWidget extends App.Controller
@observerKeys()
@lastKey = undefined
$(document).keyup((e) =>
$(document).on('keyup', (e) =>
return if e.keyCode isnt 27
@lastKey = undefined
)
observerKeys: =>
$(document).unbind('keydown.shortcuts')
$(document).off('keydown.shortcuts')
navigationHotkeys = App.Browser.hotkeys()
areas = App.Config.get('keyboard_shortcuts')
@ -56,7 +56,7 @@ class App.KeyboardShortcutWidget extends App.Controller
modifier += shortcut.key
if shortcut.callback
@log 'debug', 'bind for', modifier
$(document).bind('keydown.shortcuts', modifier, (e) =>
$(document).on('keydown.shortcuts', {keys: modifier}, (e) =>
e.preventDefault()
if @lastKey && @lastKey.modifier is modifier && @lastKey.time + 5500 > new Date().getTime()
@lastKey.count += 1
@ -94,7 +94,7 @@ App.Config.set(
description: __('Dashboard')
globalEvent: 'dashboard'
callback: ->
$('#global-search').blur()
$('#global-search').trigger('blur')
App.Event.trigger('keyboard_shortcuts_close')
window.location.hash = '#dashboard'
}
@ -104,7 +104,7 @@ App.Config.set(
description: __('Overviews')
globalEvent: 'overview'
callback: ->
$('#global-search').blur()
$('#global-search').trigger('blur')
App.Event.trigger('keyboard_shortcuts_close')
window.location.hash = '#ticket/view'
}
@ -115,7 +115,7 @@ App.Config.set(
globalEvent: 'search'
callback: ->
App.Event.trigger('keyboard_shortcuts_close')
$('#global-search').focus()
$('#global-search').trigger('focus')
}
{
key: 'a'
@ -123,9 +123,9 @@ App.Config.set(
description: __('Notifications')
globalEvent: 'notification'
callback: ->
$('#global-search').blur()
$('#global-search').trigger('blur')
App.Event.trigger('keyboard_shortcuts_close')
$('#navigation .js-toggleNotifications').click()
$('#navigation .js-toggleNotifications').trigger('click')
}
{
key: 'n'
@ -133,7 +133,7 @@ App.Config.set(
description: __('New Ticket')
globalEvent: 'new-ticket'
callback: ->
$('#global-search').blur()
$('#global-search').trigger('blur')
App.Event.trigger('keyboard_shortcuts_close')
window.location.hash = '#ticket/create'
}
@ -168,7 +168,7 @@ App.Config.set(
globalEvent: 'close-current-tab'
callback: ->
App.Event.trigger('keyboard_shortcuts_close')
$('#navigation .tasks .is-active .js-close').click()
$('#navigation .tasks .is-active .js-close').trigger('click')
}
{
key: 'tab'
@ -185,12 +185,12 @@ App.Config.set(
if current.get(0)
next = current.next()
if next.get(0)
next.find('div').first().click()
next.find('div').first().trigger('click')
scollIfNeeded(next)
return
prev = $('#navigation .tasks .task').first()
if prev.get(0)
prev.find('div').first().click()
prev.find('div').first().trigger('click')
scollIfNeeded(prev)
}
{
@ -208,12 +208,12 @@ App.Config.set(
if current.get(0)
prev = current.prev()
if prev.get(0)
prev.find('div').first().click()
prev.find('div').first().trigger('click')
scollIfNeeded(prev)
return
last = $('#navigation .tasks .task').last()
if last.get(0)
last.find('div').first().click()
last.find('div').first().trigger('click')
scollIfNeeded(last)
}
{
@ -227,24 +227,24 @@ App.Config.set(
# check of primary modal exists
dialog = $('body > div.modal')
if dialog.get(0)
dialog.find('.js-submit').click()
dialog.find('.js-submit').trigger('click')
return
# check of local modal exists
dialog = $('.active.content > div.modal')
if dialog.get(0)
dialog.find('.js-submit').click()
dialog.find('.js-submit').trigger('click')
return
# check ticket edit
dialog = $('.active.content .js-attributeBar .js-submit')
if dialog.get(0)
dialog.first().click()
dialog.first().trigger('click')
return
dialog = $('.active.content .js-submit')
if dialog.get(0)
dialog.first().click()
dialog.first().trigger('click')
return
}
]
@ -342,8 +342,8 @@ App.Config.set(
globalEvent: 'article-note-open'
callback: ->
App.Event.trigger('keyboard_shortcuts_close')
$('.active.content .editControls .js-articleTypes [data-value="note"]').click()
$('.active.content .article-new .articleNewEdit-body').first().focus()
$('.active.content .editControls .js-articleTypes [data-value="note"]').trigger('click')
$('.active.content .article-new .articleNewEdit-body').first().trigger('focus')
}
{
key: 'g'
@ -355,9 +355,9 @@ App.Config.set(
lastArticleWithReply = $('.active.content .ticket-article .icon-reply').last()
lastArticleWithReplyAll = lastArticleWithReply.parent().find('.icon-reply-all')
if lastArticleWithReplyAll.get(0)
lastArticleWithReplyAll.click()
lastArticleWithReplyAll.trigger('click')
return
lastArticleWithReply.click()
lastArticleWithReply.trigger('click')
}
{
key: 'j'
@ -366,7 +366,7 @@ App.Config.set(
globalEvent: 'article-internal-public'
callback: ->
App.Event.trigger('keyboard_shortcuts_close')
$('.active.content .editControls .js-selectInternalPublic').click()
$('.active.content .editControls .js-selectInternalPublic').trigger('click')
}
#{
# key: 'm'
@ -385,7 +385,7 @@ App.Config.set(
App.Event.trigger('keyboard_shortcuts_close')
return if !$('.active.content .edit').get(0)
$('.active.content .edit [name="state_id"]').val(4)
$('.active.content .js-attributeBar .js-submit').first().click()
$('.active.content .js-attributeBar .js-submit').first().trigger('click')
}
{
key: ['', '']

View file

@ -256,7 +256,7 @@ class Navigation extends App.Controller
@nudge(e, 1)
return
else if e.keyCode is 13 # enter
@searchInput.blur()
@searchInput.trigger('blur')
href = @$('.global-search-result .nav-tab.is-hover').attr('href')
if href
@navigate(href)

View file

@ -54,7 +54,8 @@ class App.Notify extends App.Controller
if App.Session.get() isnt undefined && window.Notification
window.Notification.requestPermission()
$(window).focus(
$(window).on(
'focus',
=>
for counter, notification of @desktopNotify
notification.close()

View file

@ -162,7 +162,7 @@ class App.UiElement.ApplicationSelector
item = $( App.view('generic/application_selector')(attribute: attribute) )
# add filter
item.delegate('.js-add', 'click', (e) =>
item.on('click', '.js-add', (e) =>
element = $(e.target).closest('.js-filterElement')
# add first available attribute
@ -191,7 +191,7 @@ class App.UiElement.ApplicationSelector
)
# remove filter
item.delegate('.js-remove', 'click', (e) =>
item.on('click', '.js-remove', (e) =>
return if $(e.currentTarget).hasClass('is-disabled')
if @hasEmptySelectorAtStart()
@ -229,7 +229,7 @@ class App.UiElement.ApplicationSelector
item.filter('.js-filter').append(row)
# change attribute selector
item.delegate('.js-attributeSelector select', 'change', (e) =>
item.on('change', '.js-attributeSelector select', (e) =>
elementRow = $(e.target).closest('.js-filterElement')
groupAndAttribute = elementRow.find('.js-attributeSelector option:selected').attr('value')
return if !groupAndAttribute
@ -238,7 +238,7 @@ class App.UiElement.ApplicationSelector
)
# change operator selector
item.delegate('.js-operator select', 'change', (e) =>
item.on('change', '.js-operator select', (e) =>
elementRow = $(e.target).closest('.js-filterElement')
groupAndAttribute = elementRow.find('.js-attributeSelector option:selected').attr('value')
return if !groupAndAttribute
@ -335,7 +335,7 @@ class App.UiElement.ApplicationSelector
if !@hasDuplicateSelector()
# enable all
elementFull.find('.js-attributeSelector select option').removeAttr('disabled')
elementFull.find('.js-attributeSelector select option').prop('disabled', false)
# disable all used attributes
elementFull.find('.js-attributeSelector select').each(->
@ -460,7 +460,7 @@ class App.UiElement.ApplicationSelector
elementRow.find('.js-preCondition').closest('.controls').removeClass('hide')
elementRow.find('.js-preCondition select').replaceWith(selection)
elementRow.find('.js-preCondition select').bind('change', (e) ->
elementRow.find('.js-preCondition select').on('change', (e) ->
toggleValue()
)

View file

@ -47,14 +47,14 @@ class App.UiElement.basedate
@bindEvents: (item, attribute) ->
item
.find('input')
.bind('focus', (e) ->
.on('focus', (e) ->
item.find('.js-datepicker').datepicker('rerender')
).bind('keyup blur change', (e) =>
).on('keyup blur change', (e) =>
@setNewTime(item, attribute, 0)
@validation(item, attribute, true)
)
item.bind('validate', (e) =>
item.on('validate', (e) =>
@validation(item, attribute)
)

View file

@ -24,7 +24,7 @@ class App.UiElement.holiday_selector
item.find('.js-datePicker').html(datePicker)
# set active/inactive of date
item.delegate('.js-active', 'click', (e) ->
item.on('click', '.js-active', (e) ->
active = $(e.target).prop('checked')
row = $(e.target).closest('tr')
input = $(e.target).closest('tr').find('.js-summary')
@ -39,19 +39,19 @@ class App.UiElement.holiday_selector
)
# remove date
item.delegate('.js-remove', 'click', (e) ->
item.on('click', '.js-remove', (e) ->
$(e.target).closest('tr').remove()
)
# catch enter / apply add
item.find('.js-summary').bind( 'keydown', (e) ->
item.find('.js-summary').on( 'keydown', (e) ->
return if e.which isnt 13
e.preventDefault()
item.find('.js-add').click()
item.find('.js-add').trigger('click')
)
# add date
item.find('.js-add').bind('click', (e) ->
item.find('.js-add').on('click', (e) ->
date = $(e.target).closest('tr').find('[name="{date}public_holidays_date"]').val()
return if !date
summary = $(e.target).closest('tr').find('.js-summary').val()

View file

@ -34,16 +34,16 @@ class App.UiElement.ical_feed extends App.UiElement.ApplicationUiElement
updateCheckManual()
item.find('.js-manual').val(attribute.value)
item.find('.js-check').bind('change', ->
item.find('.js-check').on('change', ->
updateShadow()
)
item.find('.js-list').bind('click change', ->
item.find('.js-list').on('click change', ->
updateCheckList()
updateShadow('list')
)
item.find('.js-manual').bind('keyup focus blur', ->
item.find('.js-manual').on('keyup focus blur', ->
updateCheckManual()
updateShadow('manual')
)

View file

@ -26,7 +26,7 @@ class App.UiElement.permission extends App.UiElement.ApplicationUiElement
) )
# show/hide trees
item.find('[name=permission_ids]').bind('change', (e) =>
item.find('[name=permission_ids]').on('change', (e) =>
@checkUncheck($(e.currentTarget), permissions, item)
)
item.find('[name=permission_ids]').trigger('change')

View file

@ -146,7 +146,7 @@ class App.UiElement.postmaster_match
item.find('.js-attributeSelector').prepend(selector)
# add filter
item.find('.js-add').bind('click', (e) ->
item.find('.js-add').on('click', (e) ->
element = $(e.target).closest('.js-filterElement')
elementClone = element.clone(true)
element.after(elementClone)
@ -154,14 +154,14 @@ class App.UiElement.postmaster_match
)
# remove filter
item.find('.js-remove').bind('click', (e) =>
item.find('.js-remove').on('click', (e) =>
return if $(e.currentTarget).hasClass('is-disabled')
$(e.target).closest('.js-filterElement').remove()
@rebuildAttributeSelectors(item)
)
# change attribute selector
item.find('.js-attributeSelector select').bind('change', (e) =>
item.find('.js-attributeSelector select').on('change', (e) =>
key = $(e.target).find('option:selected').attr('value')
elementRow = $(e.target).closest('.js-filterElement')
@rebuildAttributeSelectors(item, elementRow, key, attribute)
@ -170,7 +170,7 @@ class App.UiElement.postmaster_match
)
# change operator
item.find('.js-operator select').bind('change', (e) =>
item.find('.js-operator select').on('change', (e) =>
key = $(e.target).find('.js-attributeSelector option:selected').attr('value')
operator = $(e.target).find('option:selected').attr('value')
elementRow = $(e.target).closest('.js-filterElement')
@ -233,7 +233,7 @@ class App.UiElement.postmaster_match
@rebuildAttributeSelectors: (elementFull, elementRow, key, attribute) ->
# enable all
elementFull.find('.js-attributeSelector select option').removeAttr('disabled')
elementFull.find('.js-attributeSelector select option').prop('disabled', false)
# disable all used attributes
elementFull.find('.js-attributeSelector select').each(->

View file

@ -198,6 +198,9 @@ class App.UiElement.postmaster_set
config['tag'] = 'input'
config['type'] = 'text'
config['name'] = name
if !value && attribute.value && attribute.value[key]
config['value'] = attribute.value[key].value
else
config['value'] = value
item = App.UiElement[config.tag].render(config, {})
elementRow.find('.js-value').html(item)
@ -227,7 +230,7 @@ class App.UiElement.postmaster_set
@rebuildAttributeSelectors: (elementFull, elementRow, key, attribute) ->
# enable all
elementFull.find('.js-attributeSelector select option').removeAttr('disabled')
elementFull.find('.js-attributeSelector select option').prop('disabled', false)
# disable all used attributes
elementFull.find('.js-attributeSelector select').each(->

View file

@ -12,7 +12,7 @@ class App.UiElement.richtext
buttons: attribute.buttons
)
item.find('a.btn--action[data-action]').click (event) => @toolButtonClicked(event, form)
item.find('a.btn--action[data-action]').on 'click', (event) => @toolButtonClicked(event, form)
if attribute.plugins
for plugin in attribute.plugins

View file

@ -45,7 +45,7 @@ class App.UiElement.select extends App.UiElement.ApplicationUiElement
@bindEventListeners: (item, attribute, params) ->
if attribute.display_warn
item.bind('change', (e) =>
item.on('change', (e) =>
@bindWarnDisplayListener(e.target.value, attribute, params, item)
)

View file

@ -23,7 +23,7 @@ class App.UiElement.sla_times
)
# disable/enable rows
item.find('.js-activateRow').bind('change', (e) ->
item.find('.js-activateRow').on('change', (e) ->
element = $(e.target)
row = element.closest('tr')
if element.prop('checked')
@ -43,7 +43,7 @@ class App.UiElement.sla_times
)
# convert hours into minutes
item.find('.js-timeConvertFrom').bind('keyup focus blur', (e) =>
item.find('.js-timeConvertFrom').on('keyup focus blur', (e) =>
element = $(e.target)
inText = element.val()
@ -62,12 +62,12 @@ class App.UiElement.sla_times
)
# toggle row on clicking name cell
item.find('.js-forward-click').bind('click', (e) ->
$(e.currentTarget).closest('tr').find('.checkbox-replacement').click()
item.find('.js-forward-click').on('click', (e) ->
$(e.currentTarget).closest('tr').find('.checkbox-replacement').trigger('click')
)
# toggle update type on clicking around the element
item.find('.js-forward-radio').bind('click', (e) ->
item.find('.js-forward-radio').on('click', (e) ->
elem = $(e.currentTarget).closest('p').find('.js-updateTypeSelector')
elem.prop('checked', true)
@ -75,20 +75,20 @@ class App.UiElement.sla_times
)
# focus time input on clicking surrounding cell
item.find('.js-focus-input').bind('click', (e) ->
item.find('.js-focus-input').on('click', (e) ->
$(e.currentTarget)
.find('.form-control:visible')
.focus()
.trigger('focus')
)
# show placeholder instead of 00:00
item.find('.js-timeConvertFrom').bind('changeTime.timepicker', (e) ->
item.find('.js-timeConvertFrom').on('changeTime.timepicker', (e) ->
if $(e.currentTarget).val() == '00:00'
$(e.currentTarget).val('')
)
# switch update/response times when type is selected accordingly
item.find('.js-updateTypeSelector').bind('change', (e) ->
item.find('.js-updateTypeSelector').on('change', (e) ->
element = $(e.target)
row = element.closest('tr')
row.find('.js-activateRow').prop('checked', true)

View file

@ -12,7 +12,7 @@ class App.UiElement.textarea
$( item[0] ).on('focus', ->
visible = $( item[0] ).is(':visible')
if visible && !$( item[0] ).expanding('active')
$( item[0] ).expanding().focus()
$( item[0] ).expanding().trigger('focus')
)
App.Delay.set(a, 80)

View file

@ -163,7 +163,7 @@ class App.UiElement.ticket_perform_action
@updateAttributeSelectors: (elementFull) ->
# enable all
elementFull.find('.js-attributeSelector select option').removeAttr('disabled')
elementFull.find('.js-attributeSelector select option').prop('disabled', false)
# disable all used attributes
elementFull.find('.js-attributeSelector select').each(->
@ -292,7 +292,7 @@ class App.UiElement.ticket_perform_action
elementRow.find('.js-preCondition').closest('.controls').removeClass('hide')
elementRow.find('.js-preCondition select').replaceWith(selection)
elementRow.find('.js-preCondition select').bind('change', (e) ->
elementRow.find('.js-preCondition select').on('change', (e) ->
toggleValue()
)

View file

@ -81,7 +81,7 @@ class App.UiElement.timer
timer = $( App.view('generic/timer')( attribute: attribute, days: days, hours: hours, minutes: minutes ) )
timer.find('.js-boolean').data('field-type', 'boolean')
timer.find('.select-value').bind('click', (e) =>
timer.find('.select-value').on('click', (e) =>
@select(e)
)
@createOutputString(timer)
@ -93,7 +93,7 @@ class App.UiElement.timer
if target.hasClass('is-selected')
# prevent zero selections
if target.siblings('.is-selected').size() > 0
if target.siblings('.is-selected').length > 0
target.removeClass('is-selected')
target.next().val('false')
else

View file

@ -88,7 +88,7 @@ class App.UiElement.user_permission
item.on('click', '.checkbox-replacement', throttled)
# if customer, remove admin and agent
item.find('[name=role_ids]').bind('change', (e) =>
item.find('[name=role_ids]').on('change', (e) =>
@checkUncheck($(e.currentTarget), rolesWithGroupPlugin, item)
)
item.find('[name=role_ids]').trigger('change')

View file

@ -129,7 +129,7 @@ class App.TicketCreate extends App.Controller
@$('[name="group_id"]').trigger('change')
# add observer to change options
@$('[name="cc"], [name="group_id"], [name="customer_id"]').bind('change', =>
@$('[name="cc"], [name="group_id"], [name="customer_id"]').on('change', =>
@updateSecurityOptions()
)
@updateSecurityOptions()

View file

@ -49,11 +49,11 @@ class App.TicketMerge extends App.ControllerModal
radio: true
)
content.delegate('[name="target_ticket_number"]', 'focus', (e) ->
content.on('focus', '[name="target_ticket_number"]', (e) ->
$(e.target).parents().find('[name="radio"]').prop('checked', false)
)
content.delegate('[name="radio"]', 'click', (e) ->
content.on('click', '[name="radio"]', (e) ->
if $(e.target).prop('checked')
ticket_id = $(e.target).val()
ticket = App.Ticket.fullLocal(ticket_id)

View file

@ -508,7 +508,7 @@ class ChatWindow extends App.Controller
)
@el.one('transitionend', @onTransitionend)
@scrollHolder.scroll(@detectScrolledtoBottom)
@scrollHolder.on('scroll', @detectScrolledtoBottom)
# force repaint
@el.prop('offsetHeight')
@ -568,7 +568,7 @@ class ChatWindow extends App.Controller
)
focus: =>
@input.focus()
@input.trigger('focus')
onTransitionend: (event) =>
# chat window is done with animation - adjust scroll-bars
@ -628,7 +628,7 @@ class ChatWindow extends App.Controller
switch event.keyCode
when TABKEY
allChatInputs = @input.not('[disabled="disabled"]')
chatCount = allChatInputs.size()
chatCount = allChatInputs.length
index = allChatInputs.index(@input)
if chatCount > 1

View file

@ -43,10 +43,10 @@ class App.CTI extends App.Controller
item: @ringingCalls()
)
$('.js-phoneMenuItem').after(localHtml)
$('.call-widget').find('.js-newUser').bind('click', (e) =>
$('.call-widget').find('.js-newUser').on('click', (e) =>
@newUser(e)
)
$('.call-widget').find('.js-newTicket').bind('click', (e) =>
$('.call-widget').find('.js-newTicket').on('click', (e) =>
user = undefined
user_id = $(e.currentTarget).data('user-id')
if user_id

View file

@ -58,7 +58,7 @@ class GettingStartedBase extends App.ControllerWizardFullScreen
logoUrl: @logoUrl()
organization: organization
)
@$('input, select').first().focus()
@$('input, select').first().trigger('focus')
onLogoPick: (event) =>
reader = new FileReader()

View file

@ -243,11 +243,11 @@ class GettingStartedChannelEmail extends App.ControllerWizardFullScreen
if !verify
@$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-inbound')
@$('.js-inbound-acknowledge .js-next').unbind('click.verify')
@$('.js-inbound-acknowledge .js-next').off('click.verify')
else
@$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-intro')
@$('.js-inbound-acknowledge .js-next').attr('data-slide', '')
@$('.js-inbound-acknowledge .js-next').unbind('click.verify').bind('click.verify', (e) =>
@$('.js-inbound-acknowledge .js-next').off('click.verify').on('click.verify', (e) =>
e.preventDefault()
@verify(@account)
)

View file

@ -31,7 +31,7 @@ class App.IdoitObjectSelector extends App.ControllerModal
@search(params)
)
@render()
@$('.js-input').focus()
@$('.js-input').trigger('focus')
error: (xhr, status, error) =>

View file

@ -96,7 +96,7 @@ class App.KnowledgeBaseReaderController extends App.Controller
prepareLinks: (input) ->
input = $($.parseHTML(input))
for linkDom in input.find('a').andSelf('a').toArray()
for linkDom in input.find('a').addBack('a').toArray()
switch $(linkDom).attr('data-target-type')
when 'knowledge-base-answer'
if object = App.KnowledgeBaseAnswerTranslation.find $(linkDom).attr('data-target-id')

View file

@ -109,7 +109,7 @@ class App.KnowledgeBaseSearchFieldWidget extends App.Controller
@renderResults?(data, originalQuery)
focus: ->
@searchField.focus()
@searchField.trigger('focus')
startSearch: (query) ->
@searchField

View file

@ -652,7 +652,7 @@ class ReferenceSetupWizard extends App.ControllerWizard
}
@agentEmail.add(@agentFirstName).add(@agentLastName).val('')
@agentFirstName.focus()
@agentFirstName.trigger('focus')
App.Config.set( 'layout_ref/setup', ReferenceSetupWizard, 'Routes' )
@ -709,7 +709,7 @@ class RichText extends App.ControllerAppContent
App.Utils.htmlCleanup(textarea)
# remove marker for cursor
textarea.find('[data-cursor=1]').focus()
textarea.find('[data-cursor=1]').trigger('focus')
textarea.find('[data-cursor=1]').remove()
@delay( execute, 1)
@ -953,11 +953,11 @@ class TicketZoomRef extends App.ControllerAppContent
@closeDropdown()
else
@buttonDropdown.addClass 'is-open'
$(document).bind 'click.buttonDropdown', @closeDropdown
$(document).on 'click.buttonDropdown', @closeDropdown
closeDropdown: =>
@buttonDropdown.removeClass 'is-open'
$(document).unbind 'click.buttonDropdown'
$(document).off 'click.buttonDropdown'
performTicketMacro: (event) =>
console.log 'perform action', @$(event.currentTarget).text()
@ -1414,7 +1414,7 @@ class SchedulersRef extends App.ControllerAppContent
if target.hasClass('is-selected')
# prevent zero selections
if target.siblings('.is-selected').size() > 0
if target.siblings('.is-selected').length > 0
target.removeClass('is-selected')
else
target.addClass('is-selected')
@ -2053,7 +2053,7 @@ class ChatWindowRef extends Spine.Controller
switch event.keyCode
when TABKEY
allChatInputs = $('.js-customerChatInput').not('[disabled="disabled"]')
chatCount = allChatInputs.size()
chatCount = allChatInputs.length
index = allChatInputs.index(@input)
if chatCount > 1
@ -2333,7 +2333,7 @@ class KnowledgeBaseAgentReaderRef extends App.ControllerAppContent
if $(event.currentTarget).is('.btn--primary')
@el.find('.main[data-level]').addClass('hidden')
@el.find('[data-level~="search"]').removeClass('hidden')
@searchInput.focus()
@searchInput.trigger('focus')
else
@el.find("[data-level~=\"#{@currentLevel}\"]").removeClass('hidden')
@el.find('[data-level~="search"]').addClass('hidden')

View file

@ -58,9 +58,9 @@ class Login extends App.ControllerFullPage
# set focus to username or password
if !@$('[name="username"]').val()
@$('[name="username"]').focus()
@$('[name="username"]').trigger('focus')
else
@$('[name="password"]').focus()
@$('[name="password"]').trigger('focus')
# scroll to top
@scrollTo()

View file

@ -235,7 +235,7 @@ class Download extends App.Controller
constructor: (data) ->
# unbind existing click binds
data.el.unbind('click .js-dataDownloadBackendSelector')
data.el.off('click .js-dataDownloadBackendSelector')
super
@render()

View file

@ -245,7 +245,7 @@ class App.Search extends App.Controller
@bulkForm.show()
# show/hide bulk action
localElement.delegate('input[name="bulk"], input[name="bulk_all"]', 'change', (e) =>
localElement.on('change', 'input[name="bulk"], input[name="bulk_all"]', (e) =>
if @shouldShowBulkForm()
@bulkForm.show()
else
@ -254,7 +254,7 @@ class App.Search extends App.Controller
)
# deselect bulk_all if one item is uncheck observ
localElement.delegate('[name="bulk"]', 'change', (e) ->
localElement.on('change', '[name="bulk"]', (e) ->
bulkAll = localElement.find('[name="bulk_all"]')
checkedCount = localElement.find('input[name="bulk"]:checked').length
checkboxCount = localElement.find('input[name="bulk"]').length

View file

@ -45,11 +45,11 @@ class App.TicketLinkAdd extends App.ControllerModal
if @ticketIdsRecentViewed
@buildContentTable(content, @ticketIdsRecentViewed, 'ticket-merge-recent-tickets')
content.delegate('[name="ticket_number"]', 'focus', (e) ->
content.on('focus', '[name="ticket_number"]', (e) ->
$(e.target).parents().find('[name="radio"]').prop('checked', false)
)
content.delegate('[name="radio"]', 'click', (e) ->
content.on('click', '[name="radio"]', (e) ->
if $(e.target).prop('checked')
ticket_id = $(e.target).val()
ticket = App.Ticket.fullLocal( ticket_id )

View file

@ -706,7 +706,7 @@ class App.TicketOverview extends App.Controller
else if e.keyCode is 32 # space
e.preventDefault()
if @activeFocus is 'overview'
@$('.table-overview table tbody tr.is-hover td.js-checkbox-field label input').first().click()
@$('.table-overview table tbody tr.is-hover td.js-checkbox-field label input').first().trigger('click')
else if e.keyCode is 9 # tab
e.preventDefault()
if @activeFocus is 'nav'
@ -726,18 +726,18 @@ class App.TicketOverview extends App.Controller
items = @$('.table-overview table tbody')
current = items.find('tr.is-hover')
if !current.size()
if !current.length
items.find('tr').first().addClass('is-hover')
return
if position is 1
next = current.next('tr')
if next.size()
if next.length
current.removeClass('is-hover')
next.addClass('is-hover')
else
prev = current.prev('tr')
if prev.size()
if prev.length
current.removeClass('is-hover')
prev.addClass('is-hover')
@ -751,7 +751,7 @@ class App.TicketOverview extends App.Controller
items = @$('.sidebar')
current = items.find('li.active')
if !current.size()
if !current.length
location = items.find('li a').first().attr('href')
if location
@navigate location
@ -759,11 +759,11 @@ class App.TicketOverview extends App.Controller
if position is 1
next = current.next('li')
if next.size()
if next.length
@navigate next.find('a').attr('href')
else
prev = current.prev('li')
if prev.size()
if prev.length
@navigate prev.find('a').attr('href')
if next
@ -831,7 +831,7 @@ class Navbar extends App.Controller
# if all tabs are visible
# remove dropdown and dropdown button
if @dropdownItem.not('.hide').size() is 0
if @dropdownItem.not('.hide').length is 0
@dropdown.remove()
@dropdownToggle.remove()
@ -1031,7 +1031,7 @@ class Table extends App.Controller
checkbox: checkbox
)
table = $(table)
table.delegate('[name="bulk_all"]', 'change', (e) ->
table.on('change', '[name="bulk_all"]', (e) ->
if $(e.currentTarget).prop('checked')
$(e.currentTarget).closest('table').find('[name="bulk"]').prop('checked', true)
else
@ -1224,7 +1224,7 @@ class Table extends App.Controller
@bulkForm.show()
# show/hide bulk action
localElement.delegate('input[name="bulk"], input[name="bulk_all"]', 'change', (e) =>
localElement.on('change', 'input[name="bulk"], input[name="bulk_all"]', (e) =>
if @shouldShowBulkForm()
@bulkForm.show()
else
@ -1233,7 +1233,7 @@ class Table extends App.Controller
)
# deselect bulk_all if one item is uncheck observ
localElement.delegate('[name="bulk"]', 'change', (e) ->
localElement.on('change', '[name="bulk"]', (e) ->
bulkAll = localElement.find('[name="bulk_all"]')
checkedCount = localElement.find('input[name="bulk"]:checked').length
checkboxCount = localElement.find('input[name="bulk"]').length

View file

@ -359,16 +359,16 @@ class App.TicketZoom extends App.Controller
article_id: undefined
modifier = 'alt+ctrl+left'
$(document).bind("keydown.ticket_zoom#{@ticket_id}", modifier, (e) =>
$(document).on("keydown.ticket_zoom#{@ticket_id}", modifier, (e) =>
@articleNavigate('up')
)
modifier = 'alt+ctrl+right'
$(document).bind("keydown.ticket_zoom#{@ticket_id}", modifier, (e) =>
$(document).on("keydown.ticket_zoom#{@ticket_id}", modifier, (e) =>
@articleNavigate('down')
)
shortcutNavigationstop: =>
$(document).unbind("keydown.ticket_zoom#{@ticket_id}")
$(document).off("keydown.ticket_zoom#{@ticket_id}")
articleNavigate: (direction) =>
articleStates = []
@ -404,13 +404,13 @@ class App.TicketZoom extends App.Controller
@positionPageHeaderUpdate()
# scroll is also fired on window resize, if element scroll is changed
@main.bind(
@main.on(
'scroll'
@positionPageHeaderUpdate
)
positionPageHeaderStop: =>
@main.unbind('scroll', @positionPageHeaderUpdate)
@main.off('scroll', @positionPageHeaderUpdate)
@scrollHeaderPos: undefined

View file

@ -14,17 +14,17 @@ class App.TicketZoomArticleImageView extends App.ControllerModal
constructor: ->
super
@unbindAll()
$(document).bind('keydown.image_preview', 'right', (e) =>
$(document).on('keydown.image_preview', 'right', (e) =>
nextElement = @parentElement.closest('.attachment').next('.attachment.attachment--preview')
return if nextElement.length is 0
@close()
nextElement.find('img').click()
nextElement.find('img').trigger('click')
)
$(document).bind('keydown.image_preview', 'left', (e) =>
$(document).on('keydown.image_preview', 'left', (e) =>
prevElement = @parentElement.closest('.attachment').prev('.attachment.attachment--preview')
return if prevElement.length is 0
@close()
prevElement.find('img').click()
prevElement.find('img').trigger('click')
)
content: ->
@ -40,4 +40,4 @@ class App.TicketZoomArticleImageView extends App.ControllerModal
@unbindAll()
unbindAll: ->
$(document).unbind('keydown.image_preview')
$(document).off('keydown.image_preview')

View file

@ -64,7 +64,7 @@ class App.TicketZoomArticleNew extends App.Controller
# set focus into field
if data.focus
@$("[name=\"#{data.focus}\"], [data-name=\"#{data.focus}\"]").focus().parent().find('.token-input').focus()
@$("[name=\"#{data.focus}\"], [data-name=\"#{data.focus}\"]").trigger('focus').parent().find('.token-input').trigger('focus')
return
# set focus at end of field
@ -422,7 +422,7 @@ class App.TicketZoomArticleNew extends App.Controller
@securityOptionsShow()
# add observer to change options
@$('.js-to, .js-cc').bind('change', =>
@$('.js-to, .js-cc').on('change', =>
@updateSecurityOptions()
)
@updateSecurityOptions()
@ -459,7 +459,7 @@ class App.TicketZoomArticleNew extends App.Controller
propagateOpenTextarea: (event) ->
event.stopPropagation()
@textarea.focus()
@textarea.trigger('focus')
updateLetterCount: =>
return if !@maxTextLength
@ -505,7 +505,7 @@ class App.TicketZoomArticleNew extends App.Controller
easing: 'easeOutQuad'
complete: =>
$(window).on('click.ticket-zoom-textarea', @closeTextarea)
@textarea.focus() if focus
@textarea.trigger('focus') if focus
@textBubble.velocity
properties:

View file

@ -96,11 +96,11 @@ class App.TicketZoomAttributeBar extends App.Controller
openMacroMenu: =>
@buttonDropdown.addClass 'is-open'
$(document).bind 'click.buttonDropdown', @closeMacroMenu
$(document).on 'click.buttonDropdown', @closeMacroMenu
closeMacroMenu: =>
@buttonDropdown.removeClass 'is-open'
$(document).unbind 'click.buttonDropdown'
$(document).off 'click.buttonDropdown'
performTicketMacro: (e) =>
macroId = $(e.currentTarget).data('id')

View file

@ -56,7 +56,7 @@ class App.FormHandlerCoreWorkflow
if $(target).get(0).tagName == 'FORM'
target = $(target).find('button[type=submit]').first()
$(target).click()
$(target).trigger('click')
# checks if the controller has a running Core Workflow request
@requestsRunning: (controllerForm) ->
@ -170,7 +170,7 @@ class App.FormHandlerCoreWorkflow
eventToBind = event.type + '.' + event.namespace
target = newElement.find("[name='" + target_name + "']")
if target.length > 0
target.bind(eventToBind, event.data, event.handler)
target.on(eventToBind, event.data, event.handler)
)
)
)

View file

@ -24,7 +24,7 @@ class SidebarArticleAttachments extends App.Controller
if !_.isEmpty(attachments)
html += App.view('ticket_zoom/sidebar_article_attachment')(article: article, attachments: attachments)
@el.html(html)
@el.delegate('.js-attachments img', 'click', (e) =>
@el.on('click', '.js-attachments img', (e) =>
@imageView(e)
)

View file

@ -105,7 +105,7 @@ class App.SidebarGitIssue extends App.Controller
list = $(App.view('ticket_zoom/sidebar_git_issue')(
issues: @issueLinkData
))
list.delegate('.js-delete', 'click', (e) =>
list.on('click', '.js-delete', (e) =>
e.preventDefault()
issueLink = $(e.currentTarget).attr 'data-issue-id'
@deleteIssue(issueLink)

View file

@ -82,7 +82,7 @@ class SidebarIdoit extends App.Controller
list = $(App.view('ticket_zoom/sidebar_idoit')(
objects: objects
))
list.delegate('.js-delete', 'click', (e) =>
list.on('click', '.js-delete', (e) =>
e.preventDefault()
objectId = $(e.currentTarget).attr 'data-object-id'
@delete(objectId)

View file

@ -43,7 +43,7 @@ class User extends App.ControllerSubContent
)
# start search
@searchInput.bind( 'keyup', (e) =>
@searchInput.on( 'keyup', (e) =>
query = @searchInput.val().trim()
return if query is @query
@query = query

View file

@ -28,4 +28,4 @@ class App.WidgetButtonWithDropdown extends App.Controller
@preventDefaultAndStopPropagation(e)
return
@accessoriesContainer.blur()
@accessoriesContainer.trigger('blur')

View file

@ -74,7 +74,7 @@ class App.WidgetLinkKbAnswer extends App.WidgetLink
@inputField.attr('disabled', false).val('')
@setInputVisible(true)
@inputField.focus()
@inputField.trigger('focus')
setInputVisible: (setInputVisible) ->
@searchableSelect.toggleClass('hidden', !setInputVisible)

View file

@ -81,25 +81,25 @@ class App.OnlineNotificationWidget extends App.Controller
@nudge(e, 1)
return
else if e.keyCode is 13 # enter
@$('.js-item').filter('.is-hover').find('.js-locationVerify').click()
@$('.js-item').filter('.is-hover').find('.js-locationVerify').trigger('click')
nudge: (e, position) ->
# get current
items = @$('.js-item')
current = items.filter('.is-hover')
if !current.size()
if !current.length
items.first().addClass('is-hover')
return
if position is 1
next = current.next('.js-item')
if next.size()
if next.length
current.removeClass('is-hover')
next.addClass('is-hover')
else
prev = current.prev('.js-item')
if prev.size()
if prev.length
current.removeClass('is-hover')
prev.addClass('is-hover')

View file

@ -68,7 +68,7 @@ class App.WidgetTag extends App.Controller
showInput: (e) =>
e.preventDefault()
@newTagLabel.addClass('hide')
@newTagInput.removeClass('hide').focus()
@newTagInput.removeClass('hide').trigger('focus')
@newTagInput.trigger(jQuery.Event('keydown'))
@editMode = true

View file

@ -107,7 +107,7 @@ class App.TicketBulkForm extends App.Controller
@makeSpaceForTableRows()
# need a delay because of the click event
setTimeout ( => @$('.textarea.form-group textarea').focus() ), 0
setTimeout ( => @$('.textarea.form-group textarea').trigger('focus') ), 0
reset: =>
@cancel()

View file

@ -46,7 +46,7 @@ class _trackSingleton
# log clicks
if @logClick
$(document).bind(
$(document).on(
'click'
(e) =>
w = window.screen.width
@ -70,7 +70,7 @@ class _trackSingleton
# log ajax calls
if @logAjax
$(document).bind( 'ajaxComplete', ( e, request, settings ) =>
$(document).on( 'ajaxComplete', ( e, request, settings ) =>
# do not log ui requests
if settings.url && settings.url.substr(settings.url.length-3,3) isnt '/ui'
@ -105,7 +105,7 @@ class _trackSingleton
)
)
$(window).bind(
$(window).on(
'beforeunload'
=>
@log('good bye', 'notice', {})

View file

@ -76,7 +76,7 @@ class App.ObjectOrganizationAutocompletion extends App.Controller
@open()
focusInput: =>
@objectSelect.focus() if not @formControl.hasClass('focus')
@objectSelect.trigger('focus') if not @formControl.hasClass('focus')
onBlur: =>
selectObject = @objectSelect.val()
@ -141,7 +141,7 @@ class App.ObjectOrganizationAutocompletion extends App.Controller
switch which
when 'last'
token = @$('.token').last()
return if not token.size()
return if not token.length
else
token = which

View file

@ -67,9 +67,9 @@ class _ajaxSingleton
@runNextInQueue()
# bindings
$(document).bind('ajaxSend', =>
$(document).on('ajaxSend', =>
@_show_spinner()
).bind('ajaxComplete', (request, xhr, settings) =>
).on('ajaxComplete', (request, xhr, settings) =>
@_hide_spinner()
# remeber XSRF-TOKEN for later
@ -81,7 +81,7 @@ class _ajaxSingleton
)
# show error messages
$(document).bind('ajaxError', (e, jqxhr, settings, exception) ->
$(document).on('ajaxError', (e, jqxhr, settings, exception) ->
if settings.failResponseNoTrigger
return

View file

@ -56,10 +56,10 @@ class _Singleton
bind: (el) ->
# check selection on mouse up
$(el).bind('mouseup', =>
$(el).on('mouseup', =>
@_updateSelection()
)
$(el).bind('keyup', (e) =>
$(el).on('keyup', (e) =>
# check selection on sonder key
if e.keyCode == 91
@ -90,7 +90,7 @@ class _Singleton
sel = document.selection.createRange()
text = sel.text
if type is 'text'
return $.trim(text.toString()) if text
return (text.toString()).trim() if text
return ''
if sel && sel.rangeCount

View file

@ -100,7 +100,7 @@ class App.ColumnSelect extends Spine.Controller
@placeholder.addClass('is-hidden')
if @search.val() and @poolOptions.not('.is-filtered').not('.is-hidden').size() is 0
if @search.val() and @poolOptions.not('.is-filtered').not('.is-hidden').length is 0
@clear()
onRemove: (event) ->

View file

@ -81,10 +81,10 @@ class App.IconPicker extends Spine.Controller
# propergate focus to our visible input
onShadowFocus: ->
@input.focus()
@input.trigger('focus')
onPickerOpen: ->
@filter.focus()
@filter.trigger('focus')
@isOpen = true
onPickerClose: ->

View file

@ -8,7 +8,7 @@ class App.SingleObjectPopoverProvider extends App.PopoverProvider
"div.#{@cssClass()}, span.#{@cssClass()}"
bind: ->
@params.parentController.$(@fullCssSelector()).bind('click', (e) =>
@params.parentController.$(@fullCssSelector()).on('click', (e) =>
id = @objectIdFor(e.target)
return if !id
object = @constructor.klass.find(id)

View file

@ -211,7 +211,7 @@ class App.SearchableSelect extends Spine.Controller
currentPosition += direction
return if currentPosition < 0
return if currentPosition > visibleOptions.size() - 1
return if currentPosition > visibleOptions.length - 1
@unhighlightCurrentItem()
@currentItem = visibleOptions.eq(currentPosition)
@ -419,7 +419,7 @@ class App.SearchableSelect extends Spine.Controller
# propergate focus to our visible input
onShadowFocus: ->
@input.focus()
@input.trigger('focus')
onShadowChange: ->
value = @shadowInput.val()
@ -446,7 +446,7 @@ class App.SearchableSelect extends Spine.Controller
switch which
when 'last'
token = @$('.token').last()
return if not token.size()
return if not token.length
else
token = which

View file

@ -176,7 +176,9 @@ class App.Utils
# textCleand = App.Utils.textCleanup(rawText)
@textCleanup: (ascii) ->
$.trim( ascii )
return '' if !ascii
ascii.trim()
.replace(/(\r\n|\n\r)/g, "\n") # cleanup
.replace(/\r/g, "\n") # cleanup
.replace(/[ ]\n/g, "\n") # remove tailing spaces
@ -274,7 +276,7 @@ class App.Utils
@quote: (ascii, max = 82) ->
ascii = @textCleanup(ascii)
ascii = @wrap(ascii, max)
$.trim(ascii)
ascii.trim()
.replace /^(.*)$/mg, (match) ->
if match
'> ' + match

View file

@ -104,7 +104,7 @@ class _webSocketSingleton extends App.Controller
@connect()
# send ping after visibilitychange to check if connection is open again after wakeup
$(document).bind('visibilitychange', =>
$(document).on('visibilitychange', =>
@log 'debug', 'visibilitychange'
return if document.hidden
return if !@connectionEstablished

View file

@ -194,7 +194,7 @@
, defaults = {
minLength: this.options.showAutocompleteOnFocus ? 0 : null
}
, args = $.isArray( typeaheadOptions ) ? typeaheadOptions : [typeaheadOptions, typeaheadOptions]
, args = Array.isArray( typeaheadOptions ) ? typeaheadOptions : [typeaheadOptions, typeaheadOptions]
args[0] = $.extend( {}, defaults, args[0] )
@ -222,8 +222,8 @@
}
// Normalize label and value
attrs.value = $.trim(attrs.value.toString());
attrs.label = attrs.label && attrs.label.length ? $.trim(attrs.label) : attrs.value
attrs.value = (attrs.value.toString()).trim();
attrs.label = attrs.label && attrs.label.length ? (attrs.label).trim() : attrs.value
// Bail out if has no value or label, or label is too short
if (!attrs.value.length || !attrs.label.length || attrs.label.length <= this.options.minLength) return

View file

@ -77,8 +77,13 @@
var ACTION_ZOOM = 'zoom';
var ACTION_NONE = 'none';
// Function check
function _isFunction(obj){
return ((typeof obj) === 'function')
}
// Supports
var SUPPORT_CANVAS = $.isFunction($('<canvas>')[0].getContext);
var SUPPORT_CANVAS = _isFunction($('<canvas>')[0].getContext);
// Maths
var sqrt = Math.sqrt;
@ -485,7 +490,7 @@
// Clear `cropBox` is necessary when replace
this.cropBox = null;
this.unbind();
this.off();
this.resetPreview();
this.$preview = null;
@ -977,23 +982,23 @@
var $this = this.$element;
var $cropper = this.$cropper;
if ($.isFunction(options.cropstart)) {
if (_isFunction(options.cropstart)) {
$this.on(EVENT_CROP_START, options.cropstart);
}
if ($.isFunction(options.cropmove)) {
if (_isFunction(options.cropmove)) {
$this.on(EVENT_CROP_MOVE, options.cropmove);
}
if ($.isFunction(options.cropend)) {
if (_isFunction(options.cropend)) {
$this.on(EVENT_CROP_END, options.cropend);
}
if ($.isFunction(options.crop)) {
if (_isFunction(options.crop)) {
$this.on(EVENT_CROP, options.crop);
}
if ($.isFunction(options.zoom)) {
if (_isFunction(options.zoom)) {
$this.on(EVENT_ZOOM, options.zoom);
}
@ -1021,23 +1026,23 @@
var $this = this.$element;
var $cropper = this.$cropper;
if ($.isFunction(options.cropstart)) {
if (_isFunction(options.cropstart)) {
$this.off(EVENT_CROP_START, options.cropstart);
}
if ($.isFunction(options.cropmove)) {
if (_isFunction(options.cropmove)) {
$this.off(EVENT_CROP_MOVE, options.cropmove);
}
if ($.isFunction(options.cropend)) {
if (_isFunction(options.cropend)) {
$this.off(EVENT_CROP_END, options.cropend);
}
if ($.isFunction(options.crop)) {
if (_isFunction(options.crop)) {
$this.off(EVENT_CROP, options.crop);
}
if ($.isFunction(options.zoom)) {
if (_isFunction(options.zoom)) {
$this.off(EVENT_ZOOM, options.zoom);
}
@ -1947,7 +1952,7 @@
var cropBoxData = {};
var ratio;
if ($.isFunction(data)) {
if (_isFunction(data)) {
data = data.call(this.$element);
}
@ -2030,7 +2035,7 @@
var canvas = this.canvas;
var aspectRatio = canvas.aspectRatio;
if ($.isFunction(data)) {
if (_isFunction(data)) {
data = data.call(this.$element);
}
@ -2087,7 +2092,7 @@
var widthChanged;
var heightChanged;
if ($.isFunction(data)) {
if (_isFunction(data)) {
data = data.call(this.$element);
}
@ -2443,7 +2448,7 @@
$this.data(NAMESPACE, (data = new Cropper(this, options)));
}
if (typeof options === 'string' && $.isFunction(fn = data[options])) {
if (typeof options === 'string' && _isFunction(fn = data[options])) {
result = fn.apply(data, args);
}
});

View file

@ -29,7 +29,7 @@
this.attach();
this.update();
if (opts.update) $textarea.bind("update.expanding", opts.update);
if (opts.update) $textarea.on("update.expanding", opts.update);
};
// Stores (active) `Expanding` instances
@ -74,7 +74,7 @@
var events = 'input.expanding change.expanding',
_this = this;
if(!inputSupported) events += ' keyup.expanding';
this.$textarea.bind(events, function() { _this.update(); });
this.$textarea.on(events, function() { _this.update(); });
},
// Updates the clone with the textarea value
@ -96,7 +96,7 @@
delete this._oldTextareaStyles;
var index = $.inArray(this, Expanding._registry);
if (index > -1) Expanding._registry.splice(index, 1);
this.$textarea.unbind(
this.$textarea.off(
'input.expanding change.expanding keyup.expanding update.expanding');
},

View file

@ -104,7 +104,7 @@
document.getSelection().addRange(range)
}
elem.focus()
elem.trigger('focus')
break
default:

View file

@ -2076,7 +2076,7 @@ qq.extend(qq.UploadHandlerXhr.prototype, {
xformed[prop] = {};
transformOptions(val, xformed[prop]);
}
else if ($.isArray(val)) {
else if (Array.isArray(val)) {
arrayVals = [];
$.each(val, function(idx, arrayVal) {
if (arrayVal instanceof $) {

View file

@ -86,7 +86,7 @@
.attr('title', button.title)
.appendTo(self.$bar.find('.noty_buttons'))
.on('click', function(event) {
if($.isFunction(button.onClick)) {
if((typeof button.onClick) === 'function') {
button.onClick.call($button, self, event);
}
});

View file

@ -102,10 +102,10 @@
var active = this.$widget.find('.dropdown-menu li.is-active')
active.removeClass('is-active')
if (e.keyCode == 38 && active.prev().size()) {
if (e.keyCode == 38 && active.prev().length) {
active = active.prev()
}
else if (e.keyCode == 40 && active.next().size()) {
else if (e.keyCode == 40 && active.next().length) {
active = active.next()
}

View file

@ -84,7 +84,7 @@
replace: function(new_array){
if (!new_array)
return;
if (!$.isArray(new_array))
if (!Array.isArray(new_array))
new_array = [new_array];
this.clear();
this.push.apply(this, new_array);
@ -266,21 +266,21 @@
}
o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
if (!$.isArray(o.daysOfWeekDisabled))
if (!Array.isArray(o.daysOfWeekDisabled))
o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){
return parseInt(d, 10);
});
o.daysOfWeekHighlighted = o.daysOfWeekHighlighted||[];
if (!$.isArray(o.daysOfWeekHighlighted))
if (!Array.isArray(o.daysOfWeekHighlighted))
o.daysOfWeekHighlighted = o.daysOfWeekHighlighted.split(/[,\s]*/);
o.daysOfWeekHighlighted = $.map(o.daysOfWeekHighlighted, function(d){
return parseInt(d, 10);
});
o.datesDisabled = o.datesDisabled||[];
if (!$.isArray(o.datesDisabled)) {
if (!Array.isArray(o.datesDisabled)) {
var datesDisabled = [];
datesDisabled.push(DPGlobal.parseDate(o.datesDisabled, format, o.language));
o.datesDisabled = datesDisabled;
@ -494,7 +494,7 @@
this._attachSecondaryEvents();
this._trigger('show');
if ((window.navigator.msMaxTouchPoints || 'ontouchstart' in document) && this.o.disableTouchKeyboard) {
$(this.element).blur();
$(this.element).trigger('blur');
}
return this;
},
@ -609,7 +609,7 @@
}
},
setDates: function(){
var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
var args = Array.isArray(arguments[0]) ? arguments[0] : arguments;
this.update.apply(this, args);
this._trigger('changeDate');
this.setValue();
@ -617,7 +617,7 @@
},
setUTCDates: function(){
var args = $.isArray(arguments[0]) ? arguments[0] : arguments;
var args = Array.isArray(arguments[0]) ? arguments[0] : arguments;
this.update.apply(this, $.map(args, this._utc_to_local));
this._trigger('changeDate');
this.setValue();
@ -785,7 +785,7 @@
_allow_update: true,
rerender: function(){
this.fill();
this.element.change();
this.element.trigger('change');
return this;
},
update: function(){
@ -848,7 +848,7 @@
this._trigger('clearDate');
this.fill();
this.element.change();
this.element.trigger('change');
return this;
},
@ -1017,7 +1017,7 @@
tooltip = before.tooltip;
}
clsName = $.unique(clsName);
clsName = $.uniqueSort(clsName);
html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>');
tooltip = null;
if (prevMonth.getUTCDay() === this.o.weekEnd){
@ -1295,7 +1295,7 @@
element = this.element.find('input');
}
if (element){
element.change();
element.trigger('change');
}
if (this.o.autoclose && (!which || which === 'date')){
this.hide();
@ -1487,7 +1487,7 @@
element = this.element.find('input');
}
if (element){
element.change();
element.trigger('change');
}
}
},

View file

@ -1008,7 +1008,7 @@
},
updateElement: function() {
this.$element.val(this.getTime()).change();
this.$element.val(this.getTime()).trigger('change');
},
updateFromElementVal: function(silent) {

View file

@ -113,13 +113,13 @@ function focusable( element, isTabIndexNotNaN ) {
}
function visible( element ) {
return $.expr.filters.visible( element ) &&
return $.expr.pseudos.visible( element ) &&
!$( element ).parents().addBack().filter(function() {
return $.css( this, "visibility" ) === "hidden";
}).length;
}
$.extend( $.expr[ ":" ], {
$.extend( $.expr.pseudos, {
data: $.expr.createPseudo ?
$.expr.createPseudo(function( dataName ) {
return function( elem ) {
@ -211,6 +211,11 @@ if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
})( $.fn.removeData );
}
// Function check
function _isFunction(obj){
return ((typeof obj) === 'function')
}
// deprecated
$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
@ -221,7 +226,7 @@ $.fn.extend({
this.each(function() {
var elem = this;
setTimeout(function() {
$( elem ).focus();
$( elem ).trigger('focus');
if ( fn ) {
fn.call( elem );
}
@ -237,14 +242,14 @@ $.fn.extend({
"mousedown";
return function() {
return this.bind( eventType + ".ui-disableSelection", function( event ) {
return this.on( eventType + ".ui-disableSelection", function( event ) {
event.preventDefault();
});
};
})(),
enableSelection: function() {
return this.unbind( ".ui-disableSelection" );
return this.off( ".ui-disableSelection" );
},
zIndex: function( zIndex ) {
@ -358,7 +363,7 @@ $.widget = function( name, base, prototype ) {
}
// create selector for plugin
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
$.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) {
return !!$.data( elem, fullName );
};
@ -393,7 +398,7 @@ $.widget = function( name, base, prototype ) {
// inheriting from
basePrototype.options = $.widget.extend( {}, basePrototype.options );
$.each( prototype, function( prop, value ) {
if ( !$.isFunction( value ) ) {
if ( !_isFunction( value ) ) {
proxiedPrototype[ prop ] = value;
return;
}
@ -502,7 +507,7 @@ $.widget.bridge = function( name, object ) {
return $.error( "cannot call methods on " + name + " prior to initialization; " +
"attempted to call method '" + options + "'" );
}
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
if ( !_isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
}
methodValue = instance[ options ].apply( instance, args );
@ -596,20 +601,20 @@ $.Widget.prototype = {
// we can probably remove the unbind calls in 2.0
// all event bindings should go through this._on()
this.element
.unbind( this.eventNamespace )
.off( this.eventNamespace )
.removeData( this.widgetFullName )
// support: jquery <1.6.3
// http://bugs.jquery.com/ticket/9413
.removeData( $.camelCase( this.widgetFullName ) );
this.widget()
.unbind( this.eventNamespace )
.off( this.eventNamespace )
.removeAttr( "aria-disabled" )
.removeClass(
this.widgetFullName + "-disabled " +
"ui-state-disabled" );
// clean up events and states
this.bindings.unbind( this.eventNamespace );
this.bindings.off( this.eventNamespace );
this.hoverable.removeClass( "ui-state-hover" );
this.focusable.removeClass( "ui-state-focus" );
},
@ -736,9 +741,9 @@ $.Widget.prototype = {
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if ( selector ) {
delegateElement.delegate( selector, eventName, handlerProxy );
delegateElement.on( eventName, selector, handlerProxy );
} else {
element.bind( eventName, handlerProxy );
element.on( eventName, handlerProxy );
}
});
},
@ -746,7 +751,7 @@ $.Widget.prototype = {
_off: function( element, eventName ) {
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
this.eventNamespace;
element.unbind( eventName ).undelegate( eventName );
element.off( eventName );
// Clear the stack to avoid memory leaks (#10056)
this.bindings = $( this.bindings.not( element ).get() );
@ -811,7 +816,7 @@ $.Widget.prototype = {
}
this.element.trigger( event, data );
return !( $.isFunction( callback ) &&
return !( _isFunction( callback ) &&
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
event.isDefaultPrevented() );
}
@ -869,7 +874,7 @@ var widget = $.widget;
var mouseHandled = false;
$( document ).mouseup( function() {
$( document ).on('mouseup', function() {
mouseHandled = false;
});
@ -884,10 +889,10 @@ var mouse = $.widget("ui.mouse", {
var that = this;
this.element
.bind("mousedown." + this.widgetName, function(event) {
.on("mousedown." + this.widgetName, function(event) {
return that._mouseDown(event);
})
.bind("click." + this.widgetName, function(event) {
.on("click." + this.widgetName, function(event) {
if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
$.removeData(event.target, that.widgetName + ".preventClickEvent");
event.stopImmediatePropagation();
@ -901,11 +906,11 @@ var mouse = $.widget("ui.mouse", {
// TODO: make sure destroying one instance of mouse doesn't mess with
// other instances of mouse
_mouseDestroy: function() {
this.element.unbind("." + this.widgetName);
this.element.off("." + this.widgetName);
if ( this._mouseMoveDelegate ) {
this.document
.unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
.unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
.off("mousemove." + this.widgetName, this._mouseMoveDelegate)
.off("mouseup." + this.widgetName, this._mouseUpDelegate);
}
},
@ -960,8 +965,8 @@ var mouse = $.widget("ui.mouse", {
};
this.document
.bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
.on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.on( "mouseup." + this.widgetName, this._mouseUpDelegate );
event.preventDefault();
@ -1005,8 +1010,8 @@ var mouse = $.widget("ui.mouse", {
_mouseUp: function(event) {
this.document
.unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
.off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.off( "mouseup." + this.widgetName, this._mouseUpDelegate );
if (this._mouseStarted) {
this._mouseStarted = false;
@ -1688,7 +1693,7 @@ $.widget("ui.draggable", $.ui.mouse, {
if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
// Blur any element that currently has focus, see #4261
$( document.activeElement ).blur();
$( document.activeElement ).trigger('blur');
}
} catch ( error ) {}
},
@ -1829,7 +1834,7 @@ $.widget("ui.draggable", $.ui.mouse, {
this.dropped = false;
}
if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || (_isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
if (that._trigger("stop", event) !== false) {
that._clear();
@ -1892,7 +1897,7 @@ $.widget("ui.draggable", $.ui.mouse, {
_createHelper: function(event) {
var o = this.options,
helperIsFunction = $.isFunction( o.helper ),
helperIsFunction = _isFunction( o.helper ),
helper = helperIsFunction ?
$( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
( o.helper === "clone" ?
@ -1928,7 +1933,7 @@ $.widget("ui.draggable", $.ui.mouse, {
if (typeof obj === "string") {
obj = obj.split(" ");
}
if ($.isArray(obj)) {
if (Array.isArray(obj)) {
obj = { left: +obj[0], top: +obj[1] || 0 };
}
if ("left" in obj) {
@ -2706,7 +2711,7 @@ $.widget( "ui.droppable", {
this.isover = false;
this.isout = true;
this.accept = $.isFunction( accept ) ? accept : function( d ) {
this.accept = _isFunction( accept ) ? accept : function( d ) {
return d.is( accept );
};
@ -2757,7 +2762,7 @@ $.widget( "ui.droppable", {
_setOption: function( key, value ) {
if ( key === "accept" ) {
this.accept = $.isFunction( value ) ? value : function( d ) {
this.accept = _isFunction( value ) ? value : function( d ) {
return d.is( value );
};
} else if ( key === "scope" ) {
@ -2991,7 +2996,7 @@ $.ui.ddmanager = {
},
dragStart: function( draggable, event ) {
// Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
draggable.element.parentsUntil( "body" ).on( "scroll.droppable", function() {
if ( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
@ -3052,7 +3057,7 @@ $.ui.ddmanager = {
},
dragStop: function( draggable, event ) {
draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
draggable.element.parentsUntil( "body" ).off( "scroll.droppable" );
// Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
if ( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
@ -3697,13 +3702,13 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
for ( j = cur.length - 1; j >= 0; j--){
inst = $.data(cur[j], this.widgetFullName);
if(inst && inst !== this && !inst.options.disabled) {
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
queries.push([_isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
}
}
}
}
queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
queries.push([_isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
function addItems() {
items.push( this );
@ -3738,7 +3743,7 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
var i, j, cur, inst, targetData, _queries, item, queriesLength,
items = this.items,
queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
queries = [[_isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
connectWith = this._connectWith();
if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
@ -3747,7 +3752,7 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
for (j = cur.length - 1; j >= 0; j--){
inst = $.data(cur[j], this.widgetFullName);
if(inst && inst !== this && !inst.options.disabled) {
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
queries.push([_isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
this.containers.push(inst);
}
}
@ -3997,7 +4002,7 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
_createHelper: function(event) {
var o = this.options,
helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
helper = _isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
//Add the helper to the DOM if that didn't happen already
if(!helper.parents("body").length) {
@ -4023,7 +4028,7 @@ var sortable = $.widget("ui.sortable", $.ui.mouse, {
if (typeof obj === "string") {
obj = obj.split(" ");
}
if ($.isArray(obj)) {
if (Array.isArray(obj)) {
obj = {left: +obj[0], top: +obj[1] || 0};
}
if ("left" in obj) {
@ -4573,7 +4578,7 @@ var accordion = $.widget( "ui.accordion", {
_panelKeyDown: function( event ) {
if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
$( event.currentTarget ).prev().focus();
$( event.currentTarget ).prev().trigger('focus');
}
},
@ -5564,7 +5569,7 @@ var menu = $.widget( "ui.menu", {
// Only match on items, not dividers or other content (#10571)
.filter( ".ui-menu-item" )
.filter(function() {
return regex.test( $.trim( $( this ).text() ) );
return regex.test( ( $( this ).text() ).trim() );
});
}
});
@ -5824,7 +5829,7 @@ $.widget( "ui.autocomplete", {
// Announce the value in the liveRegion
label = ui.item.attr( "aria-label" ) || item.value;
if ( label && $.trim( label ).length ) {
if ( label && ( label ).trim().length ) {
this.liveRegion.children().hide();
$( "<div>" ).text( label ).appendTo( this.liveRegion );
}
@ -5835,7 +5840,7 @@ $.widget( "ui.autocomplete", {
// only trigger when focus was lost (click on menu)
if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) {
this.element.focus();
this.element.trigger('focus');
this.previous = previous;
// #6109 - IE triggers two focus events and the second
// is asynchronous, so we need to reset the previous
@ -5921,7 +5926,7 @@ $.widget( "ui.autocomplete", {
_initSource: function() {
var array, url,
that = this;
if ( $.isArray( this.options.source ) ) {
if ( Array.isArray( this.options.source ) ) {
array = this.options.source;
this.source = function( request, response ) {
response( $.ui.autocomplete.filter( array, request.term ) );

View file

@ -121,7 +121,7 @@
return m(parseInt(res[1]+res[1], 16), parseInt(res[2]+res[2], 16), parseInt(res[3]+res[3], 16));
// Otherwise, we're most likely dealing with a named color
var name = $.trim(str).toLowerCase();
var name = (str).trim().toLowerCase();
if (name == "transparent")
return m(255, 255, 255, 0);
else {

View file

@ -119,8 +119,8 @@ The plugin also adds four public methods:
if (!plot.getOptions().crosshair.mode)
return;
eventHolder.mouseout(onMouseOut);
eventHolder.mousemove(onMouseMove);
eventHolder.on('mouseout', onMouseOut);
eventHolder.on('mousemove', onMouseMove);
});
plot.hooks.drawOverlay.push(function (plot, ctx) {
@ -153,8 +153,8 @@ The plugin also adds four public methods:
});
plot.hooks.shutdown.push(function (plot, eventHolder) {
eventHolder.unbind("mouseout", onMouseOut);
eventHolder.unbind("mousemove", onMouseMove);
eventHolder.off("mouseout", onMouseOut);
eventHolder.off("mousemove", onMouseMove);
});
}

View file

@ -38,6 +38,11 @@
// where series is either just the data as [ [x1, y1], [x2, y2], ... ]
// or { data: [ [x1, y1], [x2, y2], ... ], label: "some label", ... }
// Function check
function _isFunction(obj){
return ((typeof obj) === 'function')
}
var series = [],
options = {
// the color theme used for graphs
@ -778,7 +783,7 @@
octx.clearRect(0, 0, canvasWidth, canvasHeight);
// then whack any remaining obvious garbage left
eventHolder.unbind();
eventHolder.off();
placeholder.children().not([canvas, overlay]).remove();
}
@ -789,12 +794,12 @@
function bindEvents() {
// bind events
if (options.grid.hoverable) {
eventHolder.mousemove(onMouseMove);
eventHolder.mouseleave(onMouseLeave);
eventHolder.on('mousemove', onMouseMove);
eventHolder.on('mouseleave', onMouseLeave);
}
if (options.grid.clickable)
eventHolder.click(onClick);
eventHolder.on('click', onClick);
executeHooks(hooks.bindEvents, [eventHolder]);
}
@ -803,9 +808,9 @@
if (redrawTimeout)
clearTimeout(redrawTimeout);
eventHolder.unbind("mousemove", onMouseMove);
eventHolder.unbind("mouseleave", onMouseLeave);
eventHolder.unbind("click", onClick);
eventHolder.off("mousemove", onMouseMove);
eventHolder.off("mouseleave", onMouseLeave);
eventHolder.off("click", onClick);
executeHooks(hooks.shutdown, [eventHolder]);
}
@ -1362,7 +1367,7 @@
}
axis.tickGenerator = generator;
if ($.isFunction(opts.tickFormatter))
if (_isFunction(opts.tickFormatter))
axis.tickFormatter = function (v, axis) { return "" + opts.tickFormatter(v, axis); };
else
axis.tickFormatter = formatter;
@ -1373,7 +1378,7 @@
if (oticks == null || (typeof oticks == "number" && oticks > 0))
ticks = axis.tickGenerator(axis);
else if (oticks) {
if ($.isFunction(oticks))
if (_isFunction(oticks))
// generate the ticks
ticks = oticks({ min: axis.min, max: axis.max });
else
@ -1485,7 +1490,7 @@
// draw markings
var markings = options.grid.markings;
if (markings) {
if ($.isFunction(markings)) {
if (_isFunction(markings)) {
var axes = plot.getAxes();
// xmin etc. is backwards compatibility, to be
// removed in the future

View file

@ -88,7 +88,7 @@ range, so 1 is 100% (i.e. no change), 1.5 is 150% (zoom in), 0.7 is
jquery.event.drag.js ~ v1.5 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-LICENSE.txt
*/
(function(E){E.fn.drag=function(L,K,J){if(K){this.bind("dragstart",L)}if(J){this.bind("dragend",J)}return !L?this.trigger("drag"):this.bind("drag",K?K:L)};var A=E.event,B=A.special,F=B.drag={not:":input",distance:0,which:1,dragging:false,setup:function(J){J=E.extend({distance:F.distance,which:F.which,not:F.not},J||{});J.distance=I(J.distance);A.add(this,"mousedown",H,J);if(this.attachEvent){this.attachEvent("ondragstart",D)}},teardown:function(){A.remove(this,"mousedown",H);if(this===F.dragging){F.dragging=F.proxy=false}G(this,true);if(this.detachEvent){this.detachEvent("ondragstart",D)}}};B.dragstart=B.dragend={setup:function(){},teardown:function(){}};function H(L){var K=this,J,M=L.data||{};if(M.elem){K=L.dragTarget=M.elem;L.dragProxy=F.proxy||K;L.cursorOffsetX=M.pageX-M.left;L.cursorOffsetY=M.pageY-M.top;L.offsetX=L.pageX-L.cursorOffsetX;L.offsetY=L.pageY-L.cursorOffsetY}else{if(F.dragging||(M.which>0&&L.which!=M.which)||E(L.target).is(M.not)){return }}switch(L.type){case"mousedown":E.extend(M,E(K).offset(),{elem:K,target:L.target,pageX:L.pageX,pageY:L.pageY});A.add(document,"mousemove mouseup",H,M);G(K,false);F.dragging=null;return false;case !F.dragging&&"mousemove":if(I(L.pageX-M.pageX)+I(L.pageY-M.pageY)<M.distance){break}L.target=M.target;J=C(L,"dragstart",K);if(J!==false){F.dragging=K;F.proxy=L.dragProxy=E(J||K)[0]}case"mousemove":if(F.dragging){J=C(L,"drag",K);if(B.drop){B.drop.allowed=(J!==false);B.drop.handler(L)}if(J!==false){break}L.type="mouseup"}case"mouseup":A.remove(document,"mousemove mouseup",H);if(F.dragging){if(B.drop){B.drop.handler(L)}C(L,"dragend",K)}G(K,true);F.dragging=F.proxy=M.elem=false;break}return true}function C(M,K,L){M.type=K;var J=E.event.handle.call(L,M);return J===false?false:J||M.result}function I(J){return Math.pow(J,2)}function D(){return(F.dragging===false)}function G(K,J){if(!K){return }K.unselectable=J?"off":"on";K.onselectstart=function(){return J};if(K.style){K.style.MozUserSelect=J?"":"none"}}})(jQuery);
(function(E){E.fn.drag=function(L,K,J){if(K){this.on("dragstart",L)}if(J){this.on("dragend",J)}return !L?this.trigger("drag"):this.on("drag",K?K:L)};var A=E.event,B=A.special,F=B.drag={not:":input",distance:0,which:1,dragging:false,setup:function(J){J=E.extend({distance:F.distance,which:F.which,not:F.not},J||{});J.distance=I(J.distance);A.add(this,"mousedown",H,J);if(this.attachEvent){this.attachEvent("ondragstart",D)}},teardown:function(){A.remove(this,"mousedown",H);if(this===F.dragging){F.dragging=F.proxy=false}G(this,true);if(this.detachEvent){this.detachEvent("ondragstart",D)}}};B.dragstart=B.dragend={setup:function(){},teardown:function(){}};function H(L){var K=this,J,M=L.data||{};if(M.elem){K=L.dragTarget=M.elem;L.dragProxy=F.proxy||K;L.cursorOffsetX=M.pageX-M.left;L.cursorOffsetY=M.pageY-M.top;L.offsetX=L.pageX-L.cursorOffsetX;L.offsetY=L.pageY-L.cursorOffsetY}else{if(F.dragging||(M.which>0&&L.which!=M.which)||E(L.target).is(M.not)){return }}switch(L.type){case"mousedown":E.extend(M,E(K).offset(),{elem:K,target:L.target,pageX:L.pageX,pageY:L.pageY});A.add(document,"mousemove mouseup",H,M);G(K,false);F.dragging=null;return false;case !F.dragging&&"mousemove":if(I(L.pageX-M.pageX)+I(L.pageY-M.pageY)<M.distance){break}L.target=M.target;J=C(L,"dragstart",K);if(J!==false){F.dragging=K;F.proxy=L.dragProxy=E(J||K)[0]}case"mousemove":if(F.dragging){J=C(L,"drag",K);if(B.drop){B.drop.allowed=(J!==false);B.drop.handler(L)}if(J!==false){break}L.type="mouseup"}case"mouseup":A.remove(document,"mousemove mouseup",H);if(F.dragging){if(B.drop){B.drop.handler(L)}C(L,"dragend",K)}G(K,true);F.dragging=F.proxy=M.elem=false;break}return true}function C(M,K,L){M.type=K;var J=E.event.handle.call(L,M);return J===false?false:J||M.result}function I(J){return Math.pow(J,2)}function D(){return(F.dragging===false)}function G(K,J){if(!K){return }K.unselectable=J?"off":"on";K.onselectstart=function(){return J};if(K.style){K.style.MozUserSelect=J?"":"none"}}})(jQuery);
/* jquery.mousewheel.min.js
@ -102,7 +102,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
*
* Requires: 1.2.2+
*/
(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);
(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.on("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.off("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);
@ -189,9 +189,9 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
}
if (o.pan.interactive) {
eventHolder.bind("dragstart", { distance: 10 }, onDragStart);
eventHolder.bind("drag", onDrag);
eventHolder.bind("dragend", onDragEnd);
eventHolder.on("dragstart", { distance: 10 }, onDragStart);
eventHolder.on("drag", onDrag);
eventHolder.on("dragend", onDragEnd);
}
}
@ -314,11 +314,11 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
}
function shutdown(plot, eventHolder) {
eventHolder.unbind(plot.getOptions().zoom.trigger, onZoomClick);
eventHolder.unbind("mousewheel", onMouseWheel);
eventHolder.unbind("dragstart", onDragStart);
eventHolder.unbind("drag", onDrag);
eventHolder.unbind("dragend", onDragEnd);
eventHolder.off(plot.getOptions().zoom.trigger, onZoomClick);
eventHolder.off("mousewheel", onMouseWheel);
eventHolder.off("dragstart", onDragStart);
eventHolder.off("drag", onDrag);
eventHolder.off("dragend", onDragEnd);
if (panTimeout)
clearTimeout(panTimeout);
}

View file

@ -125,10 +125,10 @@ More detail and specific examples can be found in the included HTML file.
var options = plot.getOptions();
if (options.series.pie.show && options.grid.hoverable)
eventHolder.unbind('mousemove').mousemove(onMouseMove);
eventHolder.off('mousemove').on('mousemove', onMouseMove);
if (options.series.pie.show && options.grid.clickable)
eventHolder.unbind('click').click(onClick);
eventHolder.off('click').on('click', onClick);
}

View file

@ -19,7 +19,7 @@ plots, you can just fix the size of their placeholders.
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if(typeof l === 'function'){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
(function ($) {
@ -44,7 +44,7 @@ plots, you can just fix the size of their placeholders.
}
function shutdown(plot, eventHolder) {
plot.getPlaceholder().unbind("resize", onResize);
plot.getPlaceholder().off("resize", onResize);
}
plot.hooks.bindEvents.push(bindEvents);

View file

@ -286,8 +286,8 @@ The plugin allso adds the following methods to the plot object:
plot.hooks.bindEvents.push(function(plot, eventHolder) {
var o = plot.getOptions();
if (o.selection.mode != null) {
eventHolder.mousemove(onMouseMove);
eventHolder.mousedown(onMouseDown);
eventHolder.on('mousemove', onMouseMove);
eventHolder.on('mousedown', onMouseDown);
}
});
@ -321,11 +321,11 @@ The plugin allso adds the following methods to the plot object:
});
plot.hooks.shutdown.push(function (plot, eventHolder) {
eventHolder.unbind("mousemove", onMouseMove);
eventHolder.unbind("mousedown", onMouseDown);
eventHolder.off("mousemove", onMouseMove);
eventHolder.off("mousedown", onMouseDown);
if (mouseUpHandler)
$(document).unbind("mouseup", mouseUpHandler);
$(document).off("mouseup", mouseUpHandler);
});
}

View file

@ -21,5 +21,5 @@ App.RenderScreen =
App.TaskManager.touch(@taskKey) if @taskKey
(data.el || @).html App.view('generic/error/placeholder')(data)
if data.action && data.actionCallback
(data.el || @.el).find('.js-action').click(data.actionCallback)
(data.el || @.el).find('.js-action').on('click', data.actionCallback)

View file

@ -72,7 +72,7 @@ BindingsInstance =
@valueSetter.setValue @$(selector), model[@_getField(field)], field.setter
changeBindingSource: (model) ->
@getModel().unbind 'change'
@getModel().off 'change'
@walkBindings (selector) =>
selector = false if selector is 'self'
@el.off 'change', selector
@ -87,7 +87,7 @@ BindingsInstance =
model[self._getField(field)] = self.valueSetter.getValue $(this), field.getter
_bindElToModel: (model, field, selector) ->
model.bind 'change', =>
model.on 'change', =>
@valueSetter.setValue @$(selector), model[@_getField(field)], field.setter
Spine.Bindings =

View file

@ -34,7 +34,7 @@ class Spine.List extends Spine.Controller
@change @current
if @selectFirst
unless @children('.active').length
@children(':first').click()
@children(':first').trigger('click')
children: (sel) ->
@el.children(sel)

View file

@ -15,9 +15,9 @@ class Spine.Manager extends Spine.Module
@addOne(cont) for cont in controllers
addOne: (controller) ->
controller.bind 'active', (args...) =>
controller.on 'active', (args...) =>
@trigger('change', controller, args...)
controller.bind 'release', =>
controller.on 'release', =>
@controllers = (c for c in @controllers when c isnt controller)
@controllers.push(controller)

View file

@ -67,9 +67,9 @@ class Route extends Spine.Module
return if @options.shim
if @history
$(window).bind('popstate', @change)
$(window).on('popstate', @change)
else
$(window).bind('hashchange', @change)
$(window).on('hashchange', @change)
@change()
@unbind: ->
@ -79,9 +79,9 @@ class Route extends Spine.Module
return if @options.shim
if @history
$(window).unbind('popstate', @change)
$(window).off('popstate', @change)
else
$(window).unbind('hashchange', @change)
$(window).off('hashchange', @change)
@navigate: (args...) ->
options = {}

View file

@ -27,18 +27,18 @@ Events =
true
listenTo: (obj, ev, callback) ->
obj.bind(ev, callback)
obj.on(ev, callback)
@listeningTo or= []
@listeningTo.push {obj, ev, callback}
this
listenToOnce: (obj, ev, callback) ->
listeningToOnce = @listeningToOnce or= []
obj.bind ev, handler = ->
obj.on ev, handler = ->
idx = -1
for lt, i in listeningToOnce when lt.obj is obj
idx = i if lt.ev is ev and lt.callback is handler
obj.unbind(ev, handler)
obj.off(ev, handler)
listeningToOnce.splice(idx, 1) unless idx is -1
callback.apply(this, arguments)
listeningToOnce.push {obj, ev, callback: handler}
@ -49,7 +49,7 @@ Events =
for listeningTo in [@listeningTo, @listeningToOnce]
continue unless listeningTo?.length
for lt in listeningTo
lt.obj.unbind(lt.ev, lt.callback)
lt.obj.off(lt.ev, lt.callback)
@listeningTo = undefined
@listeningToOnce = undefined
@ -69,14 +69,14 @@ Events =
continue unless lt.obj is obj
continue if callback and lt.callback isnt callback
if (not ev) or (ev is lt.ev)
lt.obj.unbind(lt.ev, lt.callback)
lt.obj.off(lt.ev, lt.callback)
listeningTo.splice(idx, 1) unless idx is -1
else if ev
evts = lt.ev.split(' ')
if ev in evts
evts = (e for e in evts when e isnt ev)
lt.ev = $.trim(evts.join(' '))
lt.obj.unbind(ev, lt.callback)
lt.ev = (evts.join(' ')).trim()
lt.obj.off(ev, lt.callback)
this
unbind: (ev, callback) ->
@ -574,7 +574,7 @@ class Controller extends Module
selector = match[2]
if selector is ''
@el.bind(eventName, method)
@el.on(eventName, method)
else
@el.on(eventName, selector, method)
@ -611,7 +611,7 @@ class Controller extends Module
replace: (element) ->
element = element.el or element
element = $.trim(element) if typeof element is "string"
element = (element).trim() if typeof element is "string"
# parseHTML is incompatible with Zepto
[previous, @el] = [@el, $($.parseHTML(element)?[0] or element)]
previous.replaceWith(@el)

View file

@ -101,7 +101,7 @@ class App.KnowledgeBaseAnswerTranslationContent extends App.Model
bodyWithPublicURLs: ->
parsed = $("<div>#{@body}</div>")
for linkDom in parsed.find('a').andSelf('a').toArray()
for linkDom in parsed.find('a').addBack('a').toArray()
switch $(linkDom).attr('data-target-type')
when 'knowledge-base-answer'
if object = App.KnowledgeBaseAnswerTranslation.find $(linkDom).attr('data-target-id')

View file

@ -5,7 +5,7 @@
// the compiled file.
//
//= require ./app/lib/core/jquery-2.2.1.js
//= require ./app/lib/core/jquery-3.6.0.js
//= require ./app/lib/core/jquery-ui-1.11.4.js
//= require ./app/lib/core/underscore-1.8.3.js
@ -257,6 +257,12 @@ jQuery.fn.extend( {
var multiple = $elem.prop('multiple');
var multiselect = multiple && $elem.hasClass('multiselect');
// in jQuery 3, select-multiple with nothing selected returns an empty array
// https://jquery.com/upgrade-guide/3.0/#breaking-change-select-multiple-with-nothing-selected-returns-an-empty-array
if (multiple === true && typeof val === 'object' && val.length == 0){
val = null;
}
var result;
if ( val == null ) {
// be sure that also null values are transferred
@ -267,7 +273,7 @@ jQuery.fn.extend( {
result = null
}
}
else if ( jQuery.isArray( val ) ) {
else if ( Array.isArray( val ) ) {
result = jQuery.map( val, function( val ) {
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ), type: type, multiselect: multiselect };
} );
@ -281,6 +287,6 @@ jQuery.fn.extend( {
} );
// start application
jQuery(function(){
(function(){
new App.Run();
});
})();

View file

@ -196,7 +196,7 @@ if ($sortByImageName) {
<? endforeach ?>
</div>
<script src="../app/assets/javascripts/app/lib/core/jquery-2.2.1.js"></script>
<script src="../app/assets/javascripts/app/lib/core/jquery-3.6.0.js"></script>
<script>
var self = "<?= basename($_SERVER["SCRIPT_FILENAME"]) ?>"
var filter = "off"

View file

@ -620,12 +620,12 @@ do($ = window.jQuery, window) ->
@input = @el.find('.zammad-chat-input')
# start bindings
@el.find('.js-chat-open').click @open
@el.find('.js-chat-toggle').click @toggle
@el.find('.js-chat-status').click @stopPropagation
@el.find('.js-chat-open').on 'click', @open
@el.find('.js-chat-toggle').on 'click', @toggle
@el.find('.js-chat-status').on 'click', @stopPropagation
@el.find('.zammad-chat-controls').on 'submit', @onSubmit
@el.find('.zammad-chat-body').on 'scroll', @detectScrolledtoBottom
@el.find('.zammad-scroll-hint').click @onScrollHintClick
@el.find('.zammad-scroll-hint').on 'click', @onScrollHintClick
@input.on(
keydown: @checkForEnter
input: @onInput
@ -836,7 +836,7 @@ do($ = window.jQuery, window) ->
$(window).on('beforeunload', =>
@onLeaveTemporary()
)
$(window).bind('hashchange', =>
$(window).on('hashchange', =>
if @isOpen
if @sessionId
@send 'chat_session_notice',
@ -907,7 +907,7 @@ do($ = window.jQuery, window) ->
onReady: ->
@log.debug 'widget ready for use'
$(".#{ @options.buttonClass }").click(@open).removeClass(@options.inactiveClass)
$(".#{ @options.buttonClass }").on('click', @open).removeClass(@options.inactiveClass)
@options.onReady?()
@ -954,7 +954,7 @@ do($ = window.jQuery, window) ->
@scrollToBottom()
if unfinishedMessage
@input.focus()
@input.trigger('focus')
onInput: =>
# remove unread-state from messages
@ -1346,7 +1346,7 @@ do($ = window.jQuery, window) ->
@el.find('.zammad-chat-agent').removeClass('zammad-chat-is-hidden')
@el.find('.zammad-chat-agent-status').removeClass('zammad-chat-is-hidden')
@input.focus() if not @isFullscreen
@input.trigger('focus') if not @isFullscreen
@setAgentOnlineState 'online'
@ -1361,7 +1361,7 @@ do($ = window.jQuery, window) ->
delay: @options.inactiveTimeout
reload = ->
location.reload()
@el.find('.js-restart').click reload
@el.find('.js-restart').on 'click', reload
@sessionClose()
showWaitingListTimeout: ->
@ -1369,7 +1369,7 @@ do($ = window.jQuery, window) ->
delay: @options.watingListTimeout
reload = ->
location.reload()
@el.find('.js-restart').click reload
@el.find('.js-restart').on 'click', reload
@sessionClose()
showLoader: ->

View file

@ -881,12 +881,12 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
}));
this.options.target.append(this.el);
this.input = this.el.find('.zammad-chat-input');
this.el.find('.js-chat-open').click(this.open);
this.el.find('.js-chat-toggle').click(this.toggle);
this.el.find('.js-chat-status').click(this.stopPropagation);
this.el.find('.js-chat-open').on('click', this.open);
this.el.find('.js-chat-toggle').on('click', this.toggle);
this.el.find('.js-chat-status').on('click', this.stopPropagation);
this.el.find('.zammad-chat-controls').on('submit', this.onSubmit);
this.el.find('.zammad-chat-body').on('scroll', this.detectScrolledtoBottom);
this.el.find('.zammad-scroll-hint').click(this.onScrollHintClick);
this.el.find('.zammad-scroll-hint').on('click', this.onScrollHintClick);
this.input.on({
keydown: this.checkForEnter,
input: this.onInput
@ -1095,7 +1095,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
return _this.onLeaveTemporary();
};
})(this));
$(window).bind('hashchange', (function(_this) {
$(window).on('hashchange', (function(_this) {
return function() {
if (_this.isOpen) {
if (_this.sessionId) {
@ -1206,7 +1206,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
ZammadChat.prototype.onReady = function() {
var base;
this.log.debug('widget ready for use');
$("." + this.options.buttonClass).click(this.open).removeClass(this.options.inactiveClass);
$("." + this.options.buttonClass).on('click', this.open).removeClass(this.options.inactiveClass);
if (typeof (base = this.options).onReady === "function") {
base.onReady();
}
@ -1709,7 +1709,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
reload = function() {
return location.reload();
};
this.el.find('.js-restart').click(reload);
this.el.find('.js-restart').on('click', reload);
return this.sessionClose();
};
@ -1721,7 +1721,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
reload = function() {
return location.reload();
};
this.el.find('.js-restart').click(reload);
this.el.find('.js-restart').on('click', reload);
return this.sessionClose();
};

File diff suppressed because one or more lines are too long

View file

@ -118,7 +118,7 @@ QUnit.test("form elements check", assert => {
assert.equal(el.find('[name="boolean2"]').val(), 'false')
});
QUnit.test("form params check", assert => {
QUnit.test("form params check 1", assert => {
// assert.deepEqual(item, test.value, 'group set/get tests' );
$('#qunit').append('<hr><h1>form params check</h1><form id="form2"></form>')
@ -359,7 +359,7 @@ QUnit.test("form params check", assert => {
boolean3: true,
boolean4: false,
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 1')
});
@ -589,7 +589,7 @@ QUnit.test("form dependend fields check", assert => {
date3: '2015-01-11',
date4: null,
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 2')
errors = form.validate(params)
test_errors = {
@ -619,7 +619,7 @@ QUnit.test("form dependend fields check", assert => {
date3: '2015-01-11',
date4: null,
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 3')
});
QUnit.test("form handler check with and without fieldset", assert => {
@ -694,7 +694,7 @@ QUnit.test("form handler check with and without fieldset", assert => {
select1: 'a',
select2: '1',
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 4')
el.find('[name="select1"]').val('b')
el.find('[name="select1"]').trigger('change')
params = App.ControllerForm.params(el)
@ -702,7 +702,7 @@ QUnit.test("form handler check with and without fieldset", assert => {
select1: 'b',
select2: '3',
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 5')
el.find('[name="select1"]').val('a')
el.find('[name="select1"]').trigger('change')
params = App.ControllerForm.params(el)
@ -710,7 +710,7 @@ QUnit.test("form handler check with and without fieldset", assert => {
select1: 'a',
select2: '1',
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 6')
// test with noFieldset
el.empty()
@ -739,7 +739,7 @@ QUnit.test("form handler check with and without fieldset", assert => {
select1: 'a',
select2: '1',
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 7')
el.find('[name="select1"]').val('b')
el.find('[name="select1"]').trigger('change')
params = App.ControllerForm.params(el)
@ -747,7 +747,7 @@ QUnit.test("form handler check with and without fieldset", assert => {
select1: 'b',
select2: '3',
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 8')
el.find('[name="select1"]').val('a')
el.find('[name="select1"]').trigger('change')
params = App.ControllerForm.params(el)
@ -755,7 +755,7 @@ QUnit.test("form handler check with and without fieldset", assert => {
select1: 'a',
select2: '1',
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 9')
});
@ -864,10 +864,10 @@ QUnit.test("form postmaster filter", assert => {
}
},
};
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 10')
el.find('[name="set::x-zammad-ticket-priority_id::value"]').closest('.js-filterElement').find('.js-remove').click()
el.find('[name="set::x-zammad-ticket-customer_id::value"]').closest('.js-filterElement').find('.js-remove').click()
el.find('[name="set::x-zammad-ticket-priority_id::value"]').closest('.js-filterElement').find('.js-remove').trigger('click')
el.find('[name="set::x-zammad-ticket-customer_id::value"]').closest('.js-filterElement').find('.js-remove').trigger('click')
params = App.ControllerForm.params(el)
test_params = {
@ -897,9 +897,9 @@ QUnit.test("form postmaster filter", assert => {
},
},
};
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 11')
el.find('.postmaster_set .js-filterElement').last().find('.filter-controls .js-add').click()
el.find('.postmaster_set .js-filterElement').last().find('.filter-controls .js-add').trigger('click')
params = App.ControllerForm.params(el)
test_params = {
@ -932,11 +932,11 @@ QUnit.test("form postmaster filter", assert => {
},
},
};
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 12')
App.Delay.set(function() {
QUnit.test("form postmaster filter - needed to do delayed because of tag ui", assert => {
el.find('[name="set::x-zammad-ticket-tags::value"]').closest('.js-filterElement').find('.token .close').last().click()
el.find('[name="set::x-zammad-ticket-tags::value"]').closest('.js-filterElement').find('.token .close').last().trigger('click')
params = App.ControllerForm.params(el)
test_params = {
input1: 'some not used default',
@ -968,7 +968,7 @@ QUnit.test("form postmaster filter", assert => {
},
},
};
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 13')
})
}, 500);
});
@ -994,17 +994,17 @@ QUnit.test("form selector", assert => {
input2: 'some name66',
};
params = App.ControllerForm.params(el)
assert.deepEqual(params, test_params, 'form param check via $("#form")')
assert.deepEqual(params, test_params, 'form param check 14 via $("#form")')
params = App.ControllerForm.params(el.find('input'))
assert.deepEqual(params, test_params, 'form param check via $("#form").find("input")')
assert.deepEqual(params, test_params, 'form param check 15 via $("#form").find("input")')
params = App.ControllerForm.params(el.parent())
assert.deepEqual(params, test_params, 'form param check via $("#form").parent()')
assert.deepEqual(params, test_params, 'form param check 16 via $("#form").parent()')
});
QUnit.test("form params check", assert => {
QUnit.test("form params check 2", assert => {
$('#qunit').append('<hr><h1>form params check</h1><form id="form9"></form>')
var el = $('#form9')
@ -1038,7 +1038,7 @@ QUnit.test("form params check", assert => {
}
//console.log('params', params)
//console.log('test_params', test_params)
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 17')
});
@ -1065,7 +1065,7 @@ QUnit.test("form params check direct", assert => {
}
//console.log('params', params)
//console.log('test_params', test_params)
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 18')
});
QUnit.test("object manager form 1", assert => {
@ -1118,7 +1118,7 @@ QUnit.test("object manager form 1", assert => {
}
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 19')
el.find('[name=data_type]').val('datetime').trigger('change')
@ -1153,7 +1153,7 @@ QUnit.test("object manager form 1", assert => {
}
}
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 20')
});
@ -1230,7 +1230,7 @@ QUnit.test("object manager form 2", assert => {
}
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 21')
});
@ -1284,10 +1284,10 @@ QUnit.test("object manager form 3", assert => {
}
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 22')
el.find('[name="screens::create_middle::ticket.customer::shown"]').click()
el.find('[name="screens::edit::ticket.customer::shown"]').click()
el.find('[name="screens::create_middle::ticket.customer::shown"]').trigger('click')
el.find('[name="screens::edit::ticket.customer::shown"]').trigger('click')
params = App.ControllerForm.params(el)
test_params = {
@ -1321,7 +1321,7 @@ QUnit.test("object manager form 3", assert => {
}
}
}
assert.deepEqual(params, test_params, 'form param check')
assert.deepEqual(params, test_params, 'form param check 23')
});

View file

@ -1,7 +1,7 @@
function check_ajax_field(field, value, count, callback, assert, waitTotal = 30000, wait = 0) {
$elementInput = $('[name="' + field + '"].js-shadow + .js-input')
if ($elementInput.val() != value) {
$elementInput.focus().val(value).trigger('input')
$elementInput.trigger('focus').val(value).trigger('input')
}
var $element = $('[name="' + field + '"]').closest('.searchableSelect').find('.js-optionsList')

Some files were not shown because too many files have changed in this diff Show more