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

View file

@ -181,7 +181,7 @@ class App.ControllerModal extends App.Controller
form = @el form = @el
# focus first input, select or textarea # 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() @initalFormParams = @formParams()

View file

@ -18,7 +18,7 @@ class App.GenericHistory extends App.ControllerModal
content = $ App.view('generic/history')( content = $ App.view('generic/history')(
items: localItem items: localItem
) )
content.find('a[data-type="sortorder"]').bind('click', (e) => content.find('a[data-type="sortorder"]').on('click', (e) =>
e.preventDefault() e.preventDefault()
@sortorder() @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--danger js-danger js-alert hide" role="alert"></div>')
@form.prepend('<div class="alert alert--success js-success 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 if @handlers.length
$(@dispatchHandlers) @dispatchHandlers()
# if element is given, prepend form to it # if element is given, prepend form to it
if @el if @el
@ -160,7 +157,7 @@ class App.ControllerForm extends App.Controller
for eventSelector, callback of @events for eventSelector, callback of @events
do (eventSelector, callback) -> do (eventSelector, callback) ->
evs = eventSelector.split(' ') 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 # bind tool tips
fieldset.find('.js-helpMessage').tooltip() fieldset.find('.js-helpMessage').tooltip()
@ -316,7 +313,7 @@ class App.ControllerForm extends App.Controller
item_bind = item.find('.richtext-content') item_bind = item.find('.richtext-content')
item_event = 'blur' item_event = 'blur'
item_bind.bind(item_event, (e) => item_bind.on(item_event, (e) =>
@lastChangedAttribute = attribute.name @lastChangedAttribute = attribute.name
params = App.ControllerForm.params(@form) params = App.ControllerForm.params(@form)
for handler in @handlers for handler in @handlers
@ -787,7 +784,7 @@ class App.ControllerForm extends App.Controller
# set autofocus by delay to make validation testable # set autofocus by delay to make validation testable
App.Delay.set( 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 200
'validate' 'validate'
) )

View file

@ -21,7 +21,7 @@ class App.ControllerReorderModal extends App.ControllerModal
onShown: -> onShown: ->
super super
@$('.js-submit').focus() @$('.js-submit').trigger('focus')
save: -> save: ->
ids = @$('tr.item').toArray().map (el) -> parseInt(el.dataset.id) 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 if @bindCheckbox.events
for event, callback of @bindCheckbox.events for event, callback of @bindCheckbox.events
do (table, event, callback) -> do (table, event, callback) ->
table.delegate('input[name="bulk"]', event, (e) -> table.on(event, 'input[name="bulk"]', (e) ->
e.stopPropagation() e.stopPropagation()
id = $(e.currentTarget).parents('tr').data('id') id = $(e.currentTarget).parents('tr').data('id')
checked = $(e.currentTarget).prop('checked') checked = $(e.currentTarget).prop('checked')
@ -424,12 +424,12 @@ class App.ControllerTable extends App.Controller
if @checkbox if @checkbox
# click first tr>td, catch click # 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() e.stopPropagation()
) )
# bind on full bulk click # bind on full bulk click
table.delegate('input[name="bulk_all"]', 'change', (e) => table.on('change', 'input[name="bulk_all"]', (e) =>
e.stopPropagation() e.stopPropagation()
clicks = [] clicks = []
if $(e.currentTarget).prop('checked') if $(e.currentTarget).prop('checked')

View file

@ -20,7 +20,7 @@ class App.ControllerWizardModal extends App.ControllerFullPage
@hideAlert(name) @hideAlert(name)
@$('.setup.wizard').addClass('hide') @$('.setup.wizard').addClass('hide')
@$(".setup.wizard.#{name}").removeClass('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) => showAlert: (screen, message) =>
@$(".#{screen}").find('.alert').first().removeClass('hide').text(App.i18n.translatePlain(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) -> onUrlSubmit: (event) ->
event.preventDefault() if event event.preventDefault() if event
@urlInput.focus() @urlInput.trigger('focus')
@changeDemoWebsite() @changeDemoWebsite()
changeDemoWebsite: -> changeDemoWebsite: ->

View file

@ -610,11 +610,11 @@ class ChannelEmailAccountWizard extends App.ControllerWizardModal
if !verify if !verify
@$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-inbound') @$('.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 else
@$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-intro') @$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-intro')
@$('.js-inbound-acknowledge .js-next').attr('data-slide', '') @$('.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() e.preventDefault()
@verify(@account) @verify(@account)
) )

View file

@ -170,7 +170,7 @@ class ChannelSmsAccount extends App.ControllerModal
params: @channel params: @channel
) )
@renderAdapterOptions(@channel.options?.adapter, el) @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) @renderAdapterOptions(e.target.value, el)
) )
el el
@ -309,7 +309,7 @@ class ChannelSmsNotification extends App.ControllerModal
params: @channel params: @channel
) )
@renderAdapterOptions(@channel.options?.adapter, el) @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) @renderAdapterOptions(e.target.value, el)
) )
el el

View file

@ -219,7 +219,7 @@ class AccountEdit extends App.ControllerModal
term: '' term: ''
group_id: '' group_id: ''
renderSearchTerms() renderSearchTerms()
content.find('.js-searchTermList [name="search::term"]').last().focus() content.find('.js-searchTermList [name="search::term"]').last().trigger('focus')
removeSearchTerm = (event) => removeSearchTerm = (event) =>
index = $(event.currentTarget).attr('data-index') index = $(event.currentTarget).attr('data-index')
@ -248,7 +248,7 @@ class AccountEdit extends App.ControllerModal
renderSearchTerms() 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-searchTermList').on('click', '.js-searchTermRemove', removeSearchTerm)
content.find('.js-mentionsGroup').replaceWith createGroupSelection(@channel.options.sync.mentions.group_id, 'mentions') 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) $('#global-search').val(currentValue)
delay = -> delay = ->
$('#global-search').focus() $('#global-search').trigger('focus')
App.Delay.set(delay, 20, 'global-search-delay') App.Delay.set(delay, 20, 'global-search-delay')
) )

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -24,7 +24,7 @@ class App.UiElement.holiday_selector
item.find('.js-datePicker').html(datePicker) item.find('.js-datePicker').html(datePicker)
# set active/inactive of date # set active/inactive of date
item.delegate('.js-active', 'click', (e) -> item.on('click', '.js-active', (e) ->
active = $(e.target).prop('checked') active = $(e.target).prop('checked')
row = $(e.target).closest('tr') row = $(e.target).closest('tr')
input = $(e.target).closest('tr').find('.js-summary') input = $(e.target).closest('tr').find('.js-summary')
@ -39,19 +39,19 @@ class App.UiElement.holiday_selector
) )
# remove date # remove date
item.delegate('.js-remove', 'click', (e) -> item.on('click', '.js-remove', (e) ->
$(e.target).closest('tr').remove() $(e.target).closest('tr').remove()
) )
# catch enter / apply add # catch enter / apply add
item.find('.js-summary').bind( 'keydown', (e) -> item.find('.js-summary').on( 'keydown', (e) ->
return if e.which isnt 13 return if e.which isnt 13
e.preventDefault() e.preventDefault()
item.find('.js-add').click() item.find('.js-add').trigger('click')
) )
# add date # 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() date = $(e.target).closest('tr').find('[name="{date}public_holidays_date"]').val()
return if !date return if !date
summary = $(e.target).closest('tr').find('.js-summary').val() 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() updateCheckManual()
item.find('.js-manual').val(attribute.value) item.find('.js-manual').val(attribute.value)
item.find('.js-check').bind('change', -> item.find('.js-check').on('change', ->
updateShadow() updateShadow()
) )
item.find('.js-list').bind('click change', -> item.find('.js-list').on('click change', ->
updateCheckList() updateCheckList()
updateShadow('list') updateShadow('list')
) )
item.find('.js-manual').bind('keyup focus blur', -> item.find('.js-manual').on('keyup focus blur', ->
updateCheckManual() updateCheckManual()
updateShadow('manual') updateShadow('manual')
) )

View file

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

View file

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

View file

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

View file

@ -12,7 +12,7 @@ class App.UiElement.richtext
buttons: attribute.buttons 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 if attribute.plugins
for plugin in 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) -> @bindEventListeners: (item, attribute, params) ->
if attribute.display_warn if attribute.display_warn
item.bind('change', (e) => item.on('change', (e) =>
@bindWarnDisplayListener(e.target.value, attribute, params, item) @bindWarnDisplayListener(e.target.value, attribute, params, item)
) )

View file

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

View file

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

View file

@ -163,7 +163,7 @@ class App.UiElement.ticket_perform_action
@updateAttributeSelectors: (elementFull) -> @updateAttributeSelectors: (elementFull) ->
# enable all # enable all
elementFull.find('.js-attributeSelector select option').removeAttr('disabled') elementFull.find('.js-attributeSelector select option').prop('disabled', false)
# disable all used attributes # disable all used attributes
elementFull.find('.js-attributeSelector select').each(-> 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').closest('.controls').removeClass('hide')
elementRow.find('.js-preCondition select').replaceWith(selection) elementRow.find('.js-preCondition select').replaceWith(selection)
elementRow.find('.js-preCondition select').bind('change', (e) -> elementRow.find('.js-preCondition select').on('change', (e) ->
toggleValue() 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 = $( App.view('generic/timer')( attribute: attribute, days: days, hours: hours, minutes: minutes ) )
timer.find('.js-boolean').data('field-type', 'boolean') timer.find('.js-boolean').data('field-type', 'boolean')
timer.find('.select-value').bind('click', (e) => timer.find('.select-value').on('click', (e) =>
@select(e) @select(e)
) )
@createOutputString(timer) @createOutputString(timer)
@ -93,7 +93,7 @@ class App.UiElement.timer
if target.hasClass('is-selected') if target.hasClass('is-selected')
# prevent zero selections # prevent zero selections
if target.siblings('.is-selected').size() > 0 if target.siblings('.is-selected').length > 0
target.removeClass('is-selected') target.removeClass('is-selected')
target.next().val('false') target.next().val('false')
else else

View file

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

View file

@ -129,7 +129,7 @@ class App.TicketCreate extends App.Controller
@$('[name="group_id"]').trigger('change') @$('[name="group_id"]').trigger('change')
# add observer to change options # 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()
) )
@updateSecurityOptions() @updateSecurityOptions()

View file

@ -49,11 +49,11 @@ class App.TicketMerge extends App.ControllerModal
radio: true 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) $(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') if $(e.target).prop('checked')
ticket_id = $(e.target).val() ticket_id = $(e.target).val()
ticket = App.Ticket.fullLocal(ticket_id) ticket = App.Ticket.fullLocal(ticket_id)

View file

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

View file

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

View file

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

View file

@ -243,11 +243,11 @@ class GettingStartedChannelEmail extends App.ControllerWizardFullScreen
if !verify if !verify
@$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-inbound') @$('.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 else
@$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-intro') @$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-intro')
@$('.js-inbound-acknowledge .js-next').attr('data-slide', '') @$('.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() e.preventDefault()
@verify(@account) @verify(@account)
) )

View file

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

View file

@ -96,7 +96,7 @@ class App.KnowledgeBaseReaderController extends App.Controller
prepareLinks: (input) -> prepareLinks: (input) ->
input = $($.parseHTML(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') switch $(linkDom).attr('data-target-type')
when 'knowledge-base-answer' when 'knowledge-base-answer'
if object = App.KnowledgeBaseAnswerTranslation.find $(linkDom).attr('data-target-id') 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) @renderResults?(data, originalQuery)
focus: -> focus: ->
@searchField.focus() @searchField.trigger('focus')
startSearch: (query) -> startSearch: (query) ->
@searchField @searchField

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,17 +14,17 @@ class App.TicketZoomArticleImageView extends App.ControllerModal
constructor: -> constructor: ->
super super
@unbindAll() @unbindAll()
$(document).bind('keydown.image_preview', 'right', (e) => $(document).on('keydown.image_preview', 'right', (e) =>
nextElement = @parentElement.closest('.attachment').next('.attachment.attachment--preview') nextElement = @parentElement.closest('.attachment').next('.attachment.attachment--preview')
return if nextElement.length is 0 return if nextElement.length is 0
@close() @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') prevElement = @parentElement.closest('.attachment').prev('.attachment.attachment--preview')
return if prevElement.length is 0 return if prevElement.length is 0
@close() @close()
prevElement.find('img').click() prevElement.find('img').trigger('click')
) )
content: -> content: ->
@ -40,4 +40,4 @@ class App.TicketZoomArticleImageView extends App.ControllerModal
@unbindAll() @unbindAll()
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 # set focus into field
if data.focus 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 return
# set focus at end of field # set focus at end of field
@ -422,7 +422,7 @@ class App.TicketZoomArticleNew extends App.Controller
@securityOptionsShow() @securityOptionsShow()
# add observer to change options # add observer to change options
@$('.js-to, .js-cc').bind('change', => @$('.js-to, .js-cc').on('change', =>
@updateSecurityOptions() @updateSecurityOptions()
) )
@updateSecurityOptions() @updateSecurityOptions()
@ -459,7 +459,7 @@ class App.TicketZoomArticleNew extends App.Controller
propagateOpenTextarea: (event) -> propagateOpenTextarea: (event) ->
event.stopPropagation() event.stopPropagation()
@textarea.focus() @textarea.trigger('focus')
updateLetterCount: => updateLetterCount: =>
return if !@maxTextLength return if !@maxTextLength
@ -505,7 +505,7 @@ class App.TicketZoomArticleNew extends App.Controller
easing: 'easeOutQuad' easing: 'easeOutQuad'
complete: => complete: =>
$(window).on('click.ticket-zoom-textarea', @closeTextarea) $(window).on('click.ticket-zoom-textarea', @closeTextarea)
@textarea.focus() if focus @textarea.trigger('focus') if focus
@textBubble.velocity @textBubble.velocity
properties: properties:

View file

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

View file

@ -56,7 +56,7 @@ class App.FormHandlerCoreWorkflow
if $(target).get(0).tagName == 'FORM' if $(target).get(0).tagName == 'FORM'
target = $(target).find('button[type=submit]').first() target = $(target).find('button[type=submit]').first()
$(target).click() $(target).trigger('click')
# checks if the controller has a running Core Workflow request # checks if the controller has a running Core Workflow request
@requestsRunning: (controllerForm) -> @requestsRunning: (controllerForm) ->
@ -170,7 +170,7 @@ class App.FormHandlerCoreWorkflow
eventToBind = event.type + '.' + event.namespace eventToBind = event.type + '.' + event.namespace
target = newElement.find("[name='" + target_name + "']") target = newElement.find("[name='" + target_name + "']")
if target.length > 0 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) if !_.isEmpty(attachments)
html += App.view('ticket_zoom/sidebar_article_attachment')(article: article, attachments: attachments) html += App.view('ticket_zoom/sidebar_article_attachment')(article: article, attachments: attachments)
@el.html(html) @el.html(html)
@el.delegate('.js-attachments img', 'click', (e) => @el.on('click', '.js-attachments img', (e) =>
@imageView(e) @imageView(e)
) )

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -100,7 +100,7 @@ class App.ColumnSelect extends Spine.Controller
@placeholder.addClass('is-hidden') @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() @clear()
onRemove: (event) -> onRemove: (event) ->

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -194,7 +194,7 @@
, defaults = { , defaults = {
minLength: this.options.showAutocompleteOnFocus ? 0 : null 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] ) args[0] = $.extend( {}, defaults, args[0] )
@ -222,8 +222,8 @@
} }
// Normalize label and value // Normalize label and value
attrs.value = $.trim(attrs.value.toString()); attrs.value = (attrs.value.toString()).trim();
attrs.label = attrs.label && attrs.label.length ? $.trim(attrs.label) : attrs.value 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 // 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 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_ZOOM = 'zoom';
var ACTION_NONE = 'none'; var ACTION_NONE = 'none';
// Function check
function _isFunction(obj){
return ((typeof obj) === 'function')
}
// Supports // Supports
var SUPPORT_CANVAS = $.isFunction($('<canvas>')[0].getContext); var SUPPORT_CANVAS = _isFunction($('<canvas>')[0].getContext);
// Maths // Maths
var sqrt = Math.sqrt; var sqrt = Math.sqrt;
@ -485,7 +490,7 @@
// Clear `cropBox` is necessary when replace // Clear `cropBox` is necessary when replace
this.cropBox = null; this.cropBox = null;
this.unbind(); this.off();
this.resetPreview(); this.resetPreview();
this.$preview = null; this.$preview = null;
@ -977,23 +982,23 @@
var $this = this.$element; var $this = this.$element;
var $cropper = this.$cropper; var $cropper = this.$cropper;
if ($.isFunction(options.cropstart)) { if (_isFunction(options.cropstart)) {
$this.on(EVENT_CROP_START, options.cropstart); $this.on(EVENT_CROP_START, options.cropstart);
} }
if ($.isFunction(options.cropmove)) { if (_isFunction(options.cropmove)) {
$this.on(EVENT_CROP_MOVE, options.cropmove); $this.on(EVENT_CROP_MOVE, options.cropmove);
} }
if ($.isFunction(options.cropend)) { if (_isFunction(options.cropend)) {
$this.on(EVENT_CROP_END, options.cropend); $this.on(EVENT_CROP_END, options.cropend);
} }
if ($.isFunction(options.crop)) { if (_isFunction(options.crop)) {
$this.on(EVENT_CROP, options.crop); $this.on(EVENT_CROP, options.crop);
} }
if ($.isFunction(options.zoom)) { if (_isFunction(options.zoom)) {
$this.on(EVENT_ZOOM, options.zoom); $this.on(EVENT_ZOOM, options.zoom);
} }
@ -1021,23 +1026,23 @@
var $this = this.$element; var $this = this.$element;
var $cropper = this.$cropper; var $cropper = this.$cropper;
if ($.isFunction(options.cropstart)) { if (_isFunction(options.cropstart)) {
$this.off(EVENT_CROP_START, options.cropstart); $this.off(EVENT_CROP_START, options.cropstart);
} }
if ($.isFunction(options.cropmove)) { if (_isFunction(options.cropmove)) {
$this.off(EVENT_CROP_MOVE, options.cropmove); $this.off(EVENT_CROP_MOVE, options.cropmove);
} }
if ($.isFunction(options.cropend)) { if (_isFunction(options.cropend)) {
$this.off(EVENT_CROP_END, options.cropend); $this.off(EVENT_CROP_END, options.cropend);
} }
if ($.isFunction(options.crop)) { if (_isFunction(options.crop)) {
$this.off(EVENT_CROP, options.crop); $this.off(EVENT_CROP, options.crop);
} }
if ($.isFunction(options.zoom)) { if (_isFunction(options.zoom)) {
$this.off(EVENT_ZOOM, options.zoom); $this.off(EVENT_ZOOM, options.zoom);
} }
@ -1947,7 +1952,7 @@
var cropBoxData = {}; var cropBoxData = {};
var ratio; var ratio;
if ($.isFunction(data)) { if (_isFunction(data)) {
data = data.call(this.$element); data = data.call(this.$element);
} }
@ -2030,7 +2035,7 @@
var canvas = this.canvas; var canvas = this.canvas;
var aspectRatio = canvas.aspectRatio; var aspectRatio = canvas.aspectRatio;
if ($.isFunction(data)) { if (_isFunction(data)) {
data = data.call(this.$element); data = data.call(this.$element);
} }
@ -2087,7 +2092,7 @@
var widthChanged; var widthChanged;
var heightChanged; var heightChanged;
if ($.isFunction(data)) { if (_isFunction(data)) {
data = data.call(this.$element); data = data.call(this.$element);
} }
@ -2443,7 +2448,7 @@
$this.data(NAMESPACE, (data = new Cropper(this, options))); $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); result = fn.apply(data, args);
} }
}); });

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -38,6 +38,11 @@
// where series is either just the data as [ [x1, y1], [x2, y2], ... ] // where series is either just the data as [ [x1, y1], [x2, y2], ... ]
// or { data: [ [x1, y1], [x2, y2], ... ], label: "some label", ... } // or { data: [ [x1, y1], [x2, y2], ... ], label: "some label", ... }
// Function check
function _isFunction(obj){
return ((typeof obj) === 'function')
}
var series = [], var series = [],
options = { options = {
// the color theme used for graphs // the color theme used for graphs
@ -778,7 +783,7 @@
octx.clearRect(0, 0, canvasWidth, canvasHeight); octx.clearRect(0, 0, canvasWidth, canvasHeight);
// then whack any remaining obvious garbage left // then whack any remaining obvious garbage left
eventHolder.unbind(); eventHolder.off();
placeholder.children().not([canvas, overlay]).remove(); placeholder.children().not([canvas, overlay]).remove();
} }
@ -789,12 +794,12 @@
function bindEvents() { function bindEvents() {
// bind events // bind events
if (options.grid.hoverable) { if (options.grid.hoverable) {
eventHolder.mousemove(onMouseMove); eventHolder.on('mousemove', onMouseMove);
eventHolder.mouseleave(onMouseLeave); eventHolder.on('mouseleave', onMouseLeave);
} }
if (options.grid.clickable) if (options.grid.clickable)
eventHolder.click(onClick); eventHolder.on('click', onClick);
executeHooks(hooks.bindEvents, [eventHolder]); executeHooks(hooks.bindEvents, [eventHolder]);
} }
@ -803,9 +808,9 @@
if (redrawTimeout) if (redrawTimeout)
clearTimeout(redrawTimeout); clearTimeout(redrawTimeout);
eventHolder.unbind("mousemove", onMouseMove); eventHolder.off("mousemove", onMouseMove);
eventHolder.unbind("mouseleave", onMouseLeave); eventHolder.off("mouseleave", onMouseLeave);
eventHolder.unbind("click", onClick); eventHolder.off("click", onClick);
executeHooks(hooks.shutdown, [eventHolder]); executeHooks(hooks.shutdown, [eventHolder]);
} }
@ -1362,7 +1367,7 @@
} }
axis.tickGenerator = generator; axis.tickGenerator = generator;
if ($.isFunction(opts.tickFormatter)) if (_isFunction(opts.tickFormatter))
axis.tickFormatter = function (v, axis) { return "" + opts.tickFormatter(v, axis); }; axis.tickFormatter = function (v, axis) { return "" + opts.tickFormatter(v, axis); };
else else
axis.tickFormatter = formatter; axis.tickFormatter = formatter;
@ -1373,7 +1378,7 @@
if (oticks == null || (typeof oticks == "number" && oticks > 0)) if (oticks == null || (typeof oticks == "number" && oticks > 0))
ticks = axis.tickGenerator(axis); ticks = axis.tickGenerator(axis);
else if (oticks) { else if (oticks) {
if ($.isFunction(oticks)) if (_isFunction(oticks))
// generate the ticks // generate the ticks
ticks = oticks({ min: axis.min, max: axis.max }); ticks = oticks({ min: axis.min, max: axis.max });
else else
@ -1485,7 +1490,7 @@
// draw markings // draw markings
var markings = options.grid.markings; var markings = options.grid.markings;
if (markings) { if (markings) {
if ($.isFunction(markings)) { if (_isFunction(markings)) {
var axes = plot.getAxes(); var axes = plot.getAxes();
// xmin etc. is backwards compatibility, to be // xmin etc. is backwards compatibility, to be
// removed in the future // 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) 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 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 /* jquery.mousewheel.min.js
@ -102,7 +102,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
* *
* Requires: 1.2.2+ * 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) { if (o.pan.interactive) {
eventHolder.bind("dragstart", { distance: 10 }, onDragStart); eventHolder.on("dragstart", { distance: 10 }, onDragStart);
eventHolder.bind("drag", onDrag); eventHolder.on("drag", onDrag);
eventHolder.bind("dragend", onDragEnd); eventHolder.on("dragend", onDragEnd);
} }
} }
@ -314,11 +314,11 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
} }
function shutdown(plot, eventHolder) { function shutdown(plot, eventHolder) {
eventHolder.unbind(plot.getOptions().zoom.trigger, onZoomClick); eventHolder.off(plot.getOptions().zoom.trigger, onZoomClick);
eventHolder.unbind("mousewheel", onMouseWheel); eventHolder.off("mousewheel", onMouseWheel);
eventHolder.unbind("dragstart", onDragStart); eventHolder.off("dragstart", onDragStart);
eventHolder.unbind("drag", onDrag); eventHolder.off("drag", onDrag);
eventHolder.unbind("dragend", onDragEnd); eventHolder.off("dragend", onDragEnd);
if (panTimeout) if (panTimeout)
clearTimeout(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(); var options = plot.getOptions();
if (options.series.pie.show && options.grid.hoverable) 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) 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. * Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/ * 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 ($) { (function ($) {
@ -44,7 +44,7 @@ plots, you can just fix the size of their placeholders.
} }
function shutdown(plot, eventHolder) { function shutdown(plot, eventHolder) {
plot.getPlaceholder().unbind("resize", onResize); plot.getPlaceholder().off("resize", onResize);
} }
plot.hooks.bindEvents.push(bindEvents); 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) { plot.hooks.bindEvents.push(function(plot, eventHolder) {
var o = plot.getOptions(); var o = plot.getOptions();
if (o.selection.mode != null) { if (o.selection.mode != null) {
eventHolder.mousemove(onMouseMove); eventHolder.on('mousemove', onMouseMove);
eventHolder.mousedown(onMouseDown); 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) { plot.hooks.shutdown.push(function (plot, eventHolder) {
eventHolder.unbind("mousemove", onMouseMove); eventHolder.off("mousemove", onMouseMove);
eventHolder.unbind("mousedown", onMouseDown); eventHolder.off("mousedown", onMouseDown);
if (mouseUpHandler) if (mouseUpHandler)
$(document).unbind("mouseup", mouseUpHandler); $(document).off("mouseup", mouseUpHandler);
}); });
} }

View file

@ -21,5 +21,5 @@ App.RenderScreen =
App.TaskManager.touch(@taskKey) if @taskKey App.TaskManager.touch(@taskKey) if @taskKey
(data.el || @).html App.view('generic/error/placeholder')(data) (data.el || @).html App.view('generic/error/placeholder')(data)
if data.action && data.actionCallback 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 @valueSetter.setValue @$(selector), model[@_getField(field)], field.setter
changeBindingSource: (model) -> changeBindingSource: (model) ->
@getModel().unbind 'change' @getModel().off 'change'
@walkBindings (selector) => @walkBindings (selector) =>
selector = false if selector is 'self' selector = false if selector is 'self'
@el.off 'change', selector @el.off 'change', selector
@ -87,7 +87,7 @@ BindingsInstance =
model[self._getField(field)] = self.valueSetter.getValue $(this), field.getter model[self._getField(field)] = self.valueSetter.getValue $(this), field.getter
_bindElToModel: (model, field, selector) -> _bindElToModel: (model, field, selector) ->
model.bind 'change', => model.on 'change', =>
@valueSetter.setValue @$(selector), model[@_getField(field)], field.setter @valueSetter.setValue @$(selector), model[@_getField(field)], field.setter
Spine.Bindings = Spine.Bindings =

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@
// the compiled file. // 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/jquery-ui-1.11.4.js
//= require ./app/lib/core/underscore-1.8.3.js //= require ./app/lib/core/underscore-1.8.3.js
@ -257,6 +257,12 @@ jQuery.fn.extend( {
var multiple = $elem.prop('multiple'); var multiple = $elem.prop('multiple');
var multiselect = multiple && $elem.hasClass('multiselect'); 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; var result;
if ( val == null ) { if ( val == null ) {
// be sure that also null values are transferred // be sure that also null values are transferred
@ -267,7 +273,7 @@ jQuery.fn.extend( {
result = null result = null
} }
} }
else if ( jQuery.isArray( val ) ) { else if ( Array.isArray( val ) ) {
result = jQuery.map( val, function( val ) { result = jQuery.map( val, function( val ) {
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ), type: type, multiselect: multiselect }; return { name: elem.name, value: val.replace( rCRLF, "\r\n" ), type: type, multiselect: multiselect };
} ); } );
@ -281,6 +287,6 @@ jQuery.fn.extend( {
} ); } );
// start application // start application
jQuery(function(){ (function(){
new App.Run(); new App.Run();
}); })();

View file

@ -196,7 +196,7 @@ if ($sortByImageName) {
<? endforeach ?> <? endforeach ?>
</div> </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> <script>
var self = "<?= basename($_SERVER["SCRIPT_FILENAME"]) ?>" var self = "<?= basename($_SERVER["SCRIPT_FILENAME"]) ?>"
var filter = "off" var filter = "off"

View file

@ -620,12 +620,12 @@ do($ = window.jQuery, window) ->
@input = @el.find('.zammad-chat-input') @input = @el.find('.zammad-chat-input')
# start bindings # start bindings
@el.find('.js-chat-open').click @open @el.find('.js-chat-open').on 'click', @open
@el.find('.js-chat-toggle').click @toggle @el.find('.js-chat-toggle').on 'click', @toggle
@el.find('.js-chat-status').click @stopPropagation @el.find('.js-chat-status').on 'click', @stopPropagation
@el.find('.zammad-chat-controls').on 'submit', @onSubmit @el.find('.zammad-chat-controls').on 'submit', @onSubmit
@el.find('.zammad-chat-body').on 'scroll', @detectScrolledtoBottom @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( @input.on(
keydown: @checkForEnter keydown: @checkForEnter
input: @onInput input: @onInput
@ -836,7 +836,7 @@ do($ = window.jQuery, window) ->
$(window).on('beforeunload', => $(window).on('beforeunload', =>
@onLeaveTemporary() @onLeaveTemporary()
) )
$(window).bind('hashchange', => $(window).on('hashchange', =>
if @isOpen if @isOpen
if @sessionId if @sessionId
@send 'chat_session_notice', @send 'chat_session_notice',
@ -907,7 +907,7 @@ do($ = window.jQuery, window) ->
onReady: -> onReady: ->
@log.debug 'widget ready for use' @log.debug 'widget ready for use'
$(".#{ @options.buttonClass }").click(@open).removeClass(@options.inactiveClass) $(".#{ @options.buttonClass }").on('click', @open).removeClass(@options.inactiveClass)
@options.onReady?() @options.onReady?()
@ -954,7 +954,7 @@ do($ = window.jQuery, window) ->
@scrollToBottom() @scrollToBottom()
if unfinishedMessage if unfinishedMessage
@input.focus() @input.trigger('focus')
onInput: => onInput: =>
# remove unread-state from messages # 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').removeClass('zammad-chat-is-hidden')
@el.find('.zammad-chat-agent-status').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' @setAgentOnlineState 'online'
@ -1361,7 +1361,7 @@ do($ = window.jQuery, window) ->
delay: @options.inactiveTimeout delay: @options.inactiveTimeout
reload = -> reload = ->
location.reload() location.reload()
@el.find('.js-restart').click reload @el.find('.js-restart').on 'click', reload
@sessionClose() @sessionClose()
showWaitingListTimeout: -> showWaitingListTimeout: ->
@ -1369,7 +1369,7 @@ do($ = window.jQuery, window) ->
delay: @options.watingListTimeout delay: @options.watingListTimeout
reload = -> reload = ->
location.reload() location.reload()
@el.find('.js-restart').click reload @el.find('.js-restart').on 'click', reload
@sessionClose() @sessionClose()
showLoader: -> 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.options.target.append(this.el);
this.input = this.el.find('.zammad-chat-input'); this.input = this.el.find('.zammad-chat-input');
this.el.find('.js-chat-open').click(this.open); this.el.find('.js-chat-open').on('click', this.open);
this.el.find('.js-chat-toggle').click(this.toggle); this.el.find('.js-chat-toggle').on('click', this.toggle);
this.el.find('.js-chat-status').click(this.stopPropagation); 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-controls').on('submit', this.onSubmit);
this.el.find('.zammad-chat-body').on('scroll', this.detectScrolledtoBottom); 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({ this.input.on({
keydown: this.checkForEnter, keydown: this.checkForEnter,
input: this.onInput input: this.onInput
@ -1095,7 +1095,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
return _this.onLeaveTemporary(); return _this.onLeaveTemporary();
}; };
})(this)); })(this));
$(window).bind('hashchange', (function(_this) { $(window).on('hashchange', (function(_this) {
return function() { return function() {
if (_this.isOpen) { if (_this.isOpen) {
if (_this.sessionId) { if (_this.sessionId) {
@ -1206,7 +1206,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
ZammadChat.prototype.onReady = function() { ZammadChat.prototype.onReady = function() {
var base; var base;
this.log.debug('widget ready for use'); 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") { if (typeof (base = this.options).onReady === "function") {
base.onReady(); base.onReady();
} }
@ -1709,7 +1709,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
reload = function() { reload = function() {
return location.reload(); return location.reload();
}; };
this.el.find('.js-restart').click(reload); this.el.find('.js-restart').on('click', reload);
return this.sessionClose(); return this.sessionClose();
}; };
@ -1721,7 +1721,7 @@ var bind = function(fn, me){ return function(){ return fn.apply(me, arguments);
reload = function() { reload = function() {
return location.reload(); return location.reload();
}; };
this.el.find('.js-restart').click(reload); this.el.find('.js-restart').on('click', reload);
return this.sessionClose(); 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') 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' ); // assert.deepEqual(item, test.value, 'group set/get tests' );
$('#qunit').append('<hr><h1>form params check</h1><form id="form2"></form>') $('#qunit').append('<hr><h1>form params check</h1><form id="form2"></form>')
@ -359,7 +359,7 @@ QUnit.test("form params check", assert => {
boolean3: true, boolean3: true,
boolean4: false, 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', date3: '2015-01-11',
date4: null, date4: null,
} }
assert.deepEqual(params, test_params, 'form param check') assert.deepEqual(params, test_params, 'form param check 2')
errors = form.validate(params) errors = form.validate(params)
test_errors = { test_errors = {
@ -619,7 +619,7 @@ QUnit.test("form dependend fields check", assert => {
date3: '2015-01-11', date3: '2015-01-11',
date4: null, 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 => { 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', select1: 'a',
select2: '1', 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"]').val('b')
el.find('[name="select1"]').trigger('change') el.find('[name="select1"]').trigger('change')
params = App.ControllerForm.params(el) params = App.ControllerForm.params(el)
@ -702,7 +702,7 @@ QUnit.test("form handler check with and without fieldset", assert => {
select1: 'b', select1: 'b',
select2: '3', 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"]').val('a')
el.find('[name="select1"]').trigger('change') el.find('[name="select1"]').trigger('change')
params = App.ControllerForm.params(el) params = App.ControllerForm.params(el)
@ -710,7 +710,7 @@ QUnit.test("form handler check with and without fieldset", assert => {
select1: 'a', select1: 'a',
select2: '1', select2: '1',
} }
assert.deepEqual(params, test_params, 'form param check') assert.deepEqual(params, test_params, 'form param check 6')
// test with noFieldset // test with noFieldset
el.empty() el.empty()
@ -739,7 +739,7 @@ QUnit.test("form handler check with and without fieldset", assert => {
select1: 'a', select1: 'a',
select2: '1', 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"]').val('b')
el.find('[name="select1"]').trigger('change') el.find('[name="select1"]').trigger('change')
params = App.ControllerForm.params(el) params = App.ControllerForm.params(el)
@ -747,7 +747,7 @@ QUnit.test("form handler check with and without fieldset", assert => {
select1: 'b', select1: 'b',
select2: '3', 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"]').val('a')
el.find('[name="select1"]').trigger('change') el.find('[name="select1"]').trigger('change')
params = App.ControllerForm.params(el) params = App.ControllerForm.params(el)
@ -755,7 +755,7 @@ QUnit.test("form handler check with and without fieldset", assert => {
select1: 'a', select1: 'a',
select2: '1', 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-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').click() el.find('[name="set::x-zammad-ticket-customer_id::value"]').closest('.js-filterElement').find('.js-remove').trigger('click')
params = App.ControllerForm.params(el) params = App.ControllerForm.params(el)
test_params = { 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) params = App.ControllerForm.params(el)
test_params = { 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() { App.Delay.set(function() {
QUnit.test("form postmaster filter - needed to do delayed because of tag ui", assert => { 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) params = App.ControllerForm.params(el)
test_params = { test_params = {
input1: 'some not used default', 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); }, 500);
}); });
@ -994,17 +994,17 @@ QUnit.test("form selector", assert => {
input2: 'some name66', input2: 'some name66',
}; };
params = App.ControllerForm.params(el) 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')) 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()) 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>') $('#qunit').append('<hr><h1>form params check</h1><form id="form9"></form>')
var el = $('#form9') var el = $('#form9')
@ -1038,7 +1038,7 @@ QUnit.test("form params check", assert => {
} }
//console.log('params', params) //console.log('params', params)
//console.log('test_params', test_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('params', params)
//console.log('test_params', test_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 => { 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') 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::create_middle::ticket.customer::shown"]').trigger('click')
el.find('[name="screens::edit::ticket.customer::shown"]').click() el.find('[name="screens::edit::ticket.customer::shown"]').trigger('click')
params = App.ControllerForm.params(el) params = App.ControllerForm.params(el)
test_params = { 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) { function check_ajax_field(field, value, count, callback, assert, waitTotal = 30000, wait = 0) {
$elementInput = $('[name="' + field + '"].js-shadow + .js-input') $elementInput = $('[name="' + field + '"].js-shadow + .js-input')
if ($elementInput.val() != value) { 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') 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