N°3817 - Audit and fix calls to deprecated jQuery method

This commit is contained in:
Anne-Cath
2025-08-06 19:47:57 +02:00
parent 1667f834b9
commit 5b9e0a1d4f
66 changed files with 188 additions and 211 deletions

View File

@@ -23,7 +23,7 @@
$(document).ready(function() {
$("#viewer").iviewer({src: '{{ path('graphs/classes.svg') }}', zoom_animation: false});
$('#viewer img').bind('dragstart', function(event){
$('#viewer img').on('dragstart', function(event){
event.preventDefault();
});
$(window).resize();

View File

@@ -2931,11 +2931,11 @@ JS
$sStatesSelection .= '</select>';
$sStatesSelection .= '<input type="hidden" id="obj_state_orig" name="obj_state_orig" value="'.$this->GetState().'"/>';
$oPage->add_ready_script(<<<JS
$('.state_select_{$this->m_iFormId}').change( function() {
$('.state_select_{$this->m_iFormId}').on('change', function() {
if ($('#obj_state_orig').val() != $(this).val()) {
$('.state_select_{$this->m_iFormId}').val($(this).val());
$('#form_{$this->m_iFormId}').data('force_submit', true);
$('#form_{$this->m_iFormId}').submit();
$('#form_{$this->m_iFormId}').trigger('submit');
}
});
JS

View File

@@ -363,7 +363,7 @@ $('#$sDialogId').dialog({
buttons: [
{ text: "$sOkButtonLabel", click: function() {
var oForm = $(this).closest('.ui-dialog').find('form');
oForm.submit();
oForm.trigger('submit');
if (AnimateDlgButtons)
{
sFormId = oForm.attr('id');

View File

@@ -13037,7 +13037,7 @@ class AttributeRedundancySettings extends AttributeDBField
$sEditValue = $bSelected ? $iCurrentValue : '';
$sValue = '<input class="redundancy-min-up-count" type="string" size="3" name="'.$sName.'" value="'.$sEditValue.'">';
// To fix an issue on Firefox: focus set to the option (because the input is within the label for the option)
$oPage->add_ready_script("\$('[name=\"$sName\"]').on('click', function(){var me=this; setTimeout(function(){\$(me).focus();}, 100);});");
$oPage->add_ready_script("\$('[name=\"$sName\"]').on('click', function(){var me=this; setTimeout(function(){\$(me).trigger('focus');}, 100);});");
}
else
{
@@ -13052,7 +13052,7 @@ class AttributeRedundancySettings extends AttributeDBField
$sEditValue = $bSelected ? $iCurrentValue : '';
$sValue = '<input class="redundancy-min-up-percent" type="string" size="3" name="'.$sName.'" value="'.$sEditValue.'">';
// To fix an issue on Firefox: focus set to the option (because the input is within the label for the option)
$oPage->add_ready_script("\$('[name=\"$sName\"]').on('click', function(){var me=this; setTimeout(function(){\$(me).focus();}, 100);});");
$oPage->add_ready_script("\$('[name=\"$sName\"]').on('click', function(){var me=this; setTimeout(function(){\$(me).trigger('focus');}, 100);});");
}
else
{

View File

@@ -1,7 +1,7 @@
{# @copyright Copyright (C) 2010-2024 Combodo SAS #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
<div class="sso-button" title="{{ aData.sTooltip }}" onclick="$('#login_mode').val('{{ aData.sLoginMode }}'); $('#login_form').submit(); return false;">
<div class="sso-button" title="{{ aData.sTooltip }}" onclick="$('#login_mode').val('{{ aData.sLoginMode }}'); $('#login_form').trigger('submit'); return false;">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 336.82 167.83" class="logo sso-image" style="max-height: 20px;">
<defs>
<style>

View File

@@ -326,7 +326,7 @@ editor.commands.addCommand({
var submitButton = $('#submit_button');
if (submitButton.is(":enabled")) {
editorForm.submit();
editorForm.trigger('submit');
}
}
});

View File

@@ -4,7 +4,7 @@
$("#do-update").on("click", function(oEvent) {
$(this).prop("disabled", true);
$("#cancel-update").prop("disabled", true);
$(this).parents('form').submit();
$(this).parents('form').trigger('submit');
oEvent.preventDefault();
oEvent.stopPropagation();
return false;

View File

@@ -18,7 +18,7 @@ $.ajax({
if(data.sMessageDetails){
$("#header-requirements-details").removeClass("ibo-is-hidden");
$('#can-core-update-details').html(data.sMessageDetails);
$("#toggle-requirements-details").click( function() { $("#can-core-update-details").toggle(); } );
$("#toggle-requirements-details").on('click', function() { $("#can-core-update-details").toggle(); } );
}
oRequirements.removeClass("ibo-is-information");
if (data.bStatus) {
@@ -106,7 +106,7 @@ $("#check-update").on("click", function(e) {
$("#submit-wait").removeClass("ibo-is-hidden");
$(this).prop("disabled", true);
$(".ajax-spin").removeClass("fa-sync-alt").removeClass("fa-spin").addClass("fa-times");
$(this).parents('form').submit();
$(this).parents('form').trigger('submit');
e.preventDefault();
e.stopPropagation();
return false;

View File

@@ -291,7 +291,7 @@ try {
$aDataToPost = MakeDataToPost($sTargetRoute);
$oPage->add('<form id="hub_launch_form" action="'.$sHubUrlStateless.'" method="post">');
$oPage->add('<input type="hidden" name="json" value="'.utils::EscapeHtml(json_encode($aDataToPost)).'">');
$oPage->add_ready_script('$("#hub_launch_form").submit();');
$oPage->add_ready_script('$("#hub_launch_form").trigger(\'submit\');');
} else {
IssueLog::Error('TokenValidation failed on inform_after_setup page');
throw new Exception("Not allowed");
@@ -378,7 +378,7 @@ $("#GoToHubBtn").on("click", function() {
window.setTimeout(function () {
var bNewWindow = $('#itophub_open_in_new_window').prop("checked");
if(bNewWindow) { $("#hub_launch_form").attr("target", "_blank"); } else { $("#hub_launch_form").removeAttr("target"); }
$('#hub_launch_form').submit();
$('#hub_launch_form').trigger('submit');
window.setTimeout(function () {
$("#GoToHubBtn").prop('disabled', false);
$("#hub_launch_image").removeClass("animate");

View File

@@ -50,13 +50,13 @@ const oOpenSignInWindow = function (url, name) {
then we load it in the already opened secondary window, and then
we bring such window back on top/in front of its parent window. */
oWindowObjectReference = window.open(url, name, sWindowFeatures);
oWindowObjectReference.focus();
oWindowObjectReference.trigger('focus');
} else {
/* Else the window reference must exist and the window
is not closed; therefore, we can bring it back on top of any other
window with the focus() method. There would be no need to re-create
the window or to reload the referenced resource. */
oWindowObjectReference.focus();
oWindowObjectReference.trigger('focus');
}
/* Let know every second our child window that we're waiting for it to complete,
once we reach our landing page, it'll send us a reply

View File

@@ -31,7 +31,7 @@ $.fn.modal.Constructor.prototype.enforceFocus = function () {
var $parent = $(e.target.parentNode);
if ($modalElement[0] !== e.target && !$modalElement.has(e.target).length &&
!$parent.hasClass('ck-input')) {
$(e.target.activeElement).focus();
$(e.target.activeElement).trigger('focus');
}
})
};

View File

@@ -440,7 +440,7 @@ $(function()
window.close();
// In some browser (eg. Firefox 70), window won't close if it has NOT been open by JS. In that case, we try to redirect to homepage as a fallback.
var sHomepageUrl = (this.options.base_url !== null) ? this.options.base_url : $('#sidebar .menu .brick_menu_item:first a').attr('href')
var sHomepageUrl = (this.options.base_url !== null) ? this.options.base_url : $('#sidebar .menu .brick_menu_item').first().find('a').attr('href')
window.location.href = sHomepageUrl;
}
},

View File

@@ -55,11 +55,11 @@ const CombodoCKEditorHandler = {
// Adjust size if passed in configuration
// - Width
if (aConfiguration.width !== undefined) {
editor.editing.view.change( writer => { writer.setStyle( 'width', aConfiguration.width, editor.editing.view.document.getRoot() ); } );
editor.editing.view.on('change', writer => { writer.setStyle( 'width', aConfiguration.width, editor.editing.view.document.getRoot() ); } );
}
// - Height
if (aConfiguration.height !== undefined) {
editor.editing.view.change( writer => { writer.setStyle( 'height', aConfiguration.height, editor.editing.view.document.getRoot() ); } );
editor.editing.view.on('change', writer => { writer.setStyle( 'height', aConfiguration.height, editor.editing.view.document.getRoot() ); } );
}
this.instances[sElem] = editor;

View File

@@ -24,11 +24,11 @@ $('body').on('enter_loading_state.button_group.itop', '[data-role="ibo-button-gr
$(this).find('[data-role="ibo-button"]').each(function(){
$(this).prop('disabled', true);
});
$(this).find('[data-role="ibo-button"]:first').trigger('enter_loading_state.button.itop');
$(this).find('[data-role="ibo-button"]').first().trigger('enter_loading_state.button.itop');
})
.on('leave_loading_state.button_group.itop', '[data-role="ibo-button-group"]', function(){
$(this).find('[data-role="ibo-button"]').each(function(){
$(this).prop('disabled', false);
});
$(this).find('[data-role="ibo-button"]:first').trigger('leave_loading_state.button.itop');
$(this).find('[data-role="ibo-button"]').first().trigger('leave_loading_state.button.itop');
});

View File

@@ -63,7 +63,7 @@ $(function () {
let $listLink = $eventTarget
.closest(this.js_selectors.dashlet_container)
.find(this.js_selectors.dashlet_action_list);
$listLink[0].click();
$listLink[0].trigger('click');
}
})
});

View File

@@ -41,11 +41,11 @@ $(function () {
fullscreen_elements: '.ibo-is-fullscreen',
},
block: {
panel_header: '[data-role="ibo-panel--header"]:first',
panel_header_sticky_sentinel_top: '[data-role="ibo-panel--header--sticky-sentinel-top"]:first',
panel_body: '[data-role="ibo-panel--body"]:first',
tab_container: '[data-role="ibo-tab-container"]:first',
tab_container_tabs_list: '[data-role="ibo-tab-container--tabs-list"]:first',
panel_header: '[data-role="ibo-panel--header"]',
panel_header_sticky_sentinel_top: '[data-role="ibo-panel--header--sticky-sentinel-top"]',
panel_body: '[data-role="ibo-panel--body"]',
tab_container: '[data-role="ibo-tab-container"]',
tab_container_tabs_list: '[data-role="ibo-tab-container--tabs-list"]',
}
},
// {ScrollMagic.Controller} SM controller for the sticky header
@@ -127,10 +127,10 @@ $(function () {
let oSMScene = new ScrollMagic.Scene({
// Traduction: As soon as the header's top sentinel...
triggerElement: this.element.find(this.js_selectors.block.panel_header_sticky_sentinel_top)[0],
triggerElement: this.element.find(this.js_selectors.block.panel_header_sticky_sentinel_top).first(),
// ... leaves the viewport...
triggerHook: 0,
offset: this.element.find(this.js_selectors.block.panel_header_sticky_sentinel_top).outerHeight()
offset: this.element.find(this.js_selectors.block.panel_header_sticky_sentinel_top).first().outerHeight()
})
// ... we consider the header as sticking...
.on('enter', function () {
@@ -151,18 +151,18 @@ $(function () {
.addTo(this.sticky_header_controller);
},
_onHeaderBecomesSticky: function () {
this.element.find(this.js_selectors.block.panel_header).addClass(this.css_classes.is_sticking);
this.element.find(this.js_selectors.block.panel_header).first().addClass(this.css_classes.is_sticking);
if (this._hasTabContainer()) {
this._updateTabsListPosition(false /* Need to wait for the header transition to end */);
}
},
_onHeaderStopsBeingSticky: function () {
const fPanelBottomPosition = this.element.position().top + this.element.find(this.js_selectors.block.panel_header_sticky_sentinel_top).outerHeight();
const fPanelBottomPosition = this.element.position().top + this.element.find(this.js_selectors.block.panel_header_sticky_sentinel_top).first().outerHeight();
const fViewportVerticalScrollPosition = this.options.viewport_elem.scrollHeight - this.options.viewport_elem.clientHeight;
// Test to prevent the screen from flashing (cf bug 4124)
if (fPanelBottomPosition < fViewportVerticalScrollPosition) {
this.element.find(this.js_selectors.block.panel_header).removeClass(this.css_classes.is_sticking);
this.element.find(this.js_selectors.block.panel_header).first().removeClass(this.css_classes.is_sticking);
if (this._hasTabContainer()) {
this._updateTabsListPosition(false /* Need to wait for the header transition to end */);
}
@@ -181,17 +181,17 @@ $(function () {
}
const me = this;
const oTabsListElem = this.element.find(this.js_selectors.block.tab_container_tabs_list);
const oTabsListElem = this.element.find(this.js_selectors.block.tab_container_tabs_list).first();
if(this._isHeaderSticking()){
// Unfortunately for now the timeout is hardcoded as we don't know how to get notified when the *CSS* transition is done.
const iTimeout = bImmediate ? 0 : 300;
setTimeout(function(){
const oHeaderElem = me.element.find(me.js_selectors.block.panel_header);
const oHeaderElem = me.element.find(me.js_selectors.block.panel_header).first();
const oHeaderOffset = oHeaderElem.offset();
const iHeaderWidth = oHeaderElem.outerWidth();
const iHeaderHeight = oHeaderElem.outerHeight();
const iPanelBorderWidth = parseInt(me.element.find(me.js_selectors.block.panel_body).css('border-left-width'));
const iPanelBorderWidth = parseInt(me.element.find(me.js_selectors.block.panel_body).first().css('border-left-width'));
oTabsListElem
.css('top', oHeaderOffset.top + iHeaderHeight)
@@ -222,7 +222,7 @@ $(function () {
* @private
*/
_isHeaderSticking: function () {
return this.element.find(this.js_selectors.block.panel_header).hasClass(this.css_classes.is_sticking);
return this.element.find(this.js_selectors.block.panel_header).first().hasClass(this.css_classes.is_sticking);
},
/**
* @return {boolean} True if the panel has a tab container
@@ -239,7 +239,7 @@ $(function () {
if(!this._hasTabContainer()) {
return false;
}
return this.element.find(this.js_selectors.block.tab_container).hasClass(this.css_classes.is_vertical);
return this.element.find(this.js_selectors.block.tab_container).first().hasClass(this.css_classes.is_vertical);
},
});
});

View File

@@ -462,7 +462,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
if (dlg.height() > ($(window).height()-70)) {
dlg.height($(window).height()-70);
}
var searchForm = dlg.find('div.display_block:first'); // Top search form, enclosing display_block
var searchForm = dlg.find('div.display_block').first(); // Top search form, enclosing display_block
var results = $('#dr_'+me.id);
var oPadding = {};
var aKeys = ['top', 'right', 'bottom', 'left'];
@@ -591,9 +591,9 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
}
if ($('#label_'+me.id).length) {
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
} else {
$('#'+me.id).focus();
$('#'+me.id).trigger('focus');
}
me.ajax_request = null;
@@ -633,7 +633,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
$('#dr_'+me.id).html(me.emptyHtml);
}
$('#label_'+me.id).removeClass('ac_dlg_loading');
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
me.ajax_request = null;
};
@@ -749,7 +749,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
} else {
$('#label_'+me.id).removeClass('ac_dlg_loading');
}
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
$('#ac_create_'+me.id).dialog("destroy");
$('#ac_create_'+me.id).remove();
$('#ajax_'+me.id).html('');
@@ -820,7 +820,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
$('#label_'+me.id).val(txt);
$('#label_'+me.id).data('selected_value',txt);
$('#label_'+me.id).removeClass('ac_dlg_loading');
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
}
$('#'+me.id).trigger('validate');
$('#'+me.id).trigger('extkeychange');
@@ -909,7 +909,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
} else {
$('#label_'+me.id).removeClass('ac_dlg_loading');
}
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
$('#dlg_tree_'+me.id).dialog("destroy");
$('#dlg_tree_'+me.id).remove();
};
@@ -959,7 +959,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
});
$('#'+me.id).multiselect('refresh');
}
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
me.ajax_request = null;
},
'json'

View File

@@ -53,16 +53,16 @@ $(function()
.addClass('field_set');
this.element
.bind('field_change', function(oEvent, oData){
.on('field_change', function(oEvent, oData){
me._onFieldChange(oEvent, oData);
})
.bind('update_form', function(oEvent, oData){
.on('update_form', function(oEvent, oData){
me._onUpdateForm(oEvent, oData);
})
.bind('get_current_values', function(oEvent, oData){
.on('get_current_values', function(oEvent, oData){
return me._onGetCurrentValues(oEvent, oData);
})
.bind('validate', function(oEvent, oData){
.on('validate', function(oEvent, oData){
if (oData === undefined)
{
oData = {};

View File

@@ -24,12 +24,12 @@ $(function()
this.element.addClass('form_field');
this.element
.bind('set_validators', function(oEvent, oData){
.on('set_validators', function(oEvent, oData){
oEvent.stopPropagation();
me.options.validators = oData;
});
this.element
.bind('validate get_current_value set_current_value', function(oEvent, oData){
.on('validate get_current_value set_current_value', function(oEvent, oData){
oEvent.stopPropagation();
var callback = me.options[oEvent.type+'_callback'];
@@ -131,7 +131,7 @@ $(function()
var bMandatory = (this.options.validators.mandatory !== undefined);
var bNotEmptyExtKey = (this.options.validators.notemptyextkey !== undefined);
var bEmpty = ($.isArray(oValue)) ? (oValue.length === 0) : (oValue === '' || oValue === undefined);
var bEmpty = (Array.isArray(oValue)) ? (oValue.length === 0) : (oValue === '' || oValue === undefined);
var value = oValue;
// This is just a safety check in case a field doesn't always return an object when no value assigned, so we have to check the mandatory validator here...
@@ -167,7 +167,7 @@ $(function()
oResult.error_messages.push(oValidator.message);
}
// ... In case of non empty array, we have to check if the value is not null
else if($.isArray(value))
else if(Array.isArray(value))
{
for(var i in value)
{
@@ -215,7 +215,7 @@ $(function()
oResult.error_messages.push(oValidator.message);
}
}
else if($.isArray(value))
else if(Array.isArray(value))
{
for(var i in value)
{

View File

@@ -45,10 +45,10 @@ $(function()
.addClass('form_handler');
// Binding events
this.element.bind('update_fields', function(oEvent, oData){
this.element.on('update_fields', function(oEvent, oData){
me._onUpdateFields(oEvent, oData);
});
this.element.bind('fields_touched', function(oEvent){
this.element.on('fields_touched', function(oEvent){
me._onFieldsTouched(oEvent);
});

View File

@@ -183,7 +183,7 @@ function CheckFields(sFormId, bDisplayAlert)
$('#'+sFormId+' :submit').prop('disable', false);
$('#'+sFormId+' :button[type=submit]').prop('disable', false);
if (oFormErrors['input_'+sFormId] != null) {
$('#'+oFormErrors['input_'+sFormId]).focus();
$('#'+oFormErrors['input_'+sFormId]).trigger('focus');
}
}

View File

@@ -537,7 +537,7 @@
// Simple key, even simpler rules, since only scalars and shallow
// arrays are allowed.
if ( $.isArray( obj[key] ) ) {
if ( Array.isArray( obj[key] ) ) {
// val is already an array, so push on the next value.
obj[key].push( val );
@@ -895,7 +895,7 @@
// For each passed key, delete the corresponding property from the current
// state.
$.each( $.isArray( arr ) ? arr : arguments, function(i,v){
$.each( Array.isArray( arr ) ? arr : arguments, function(i,v){
delete state[ v ];
});
}
@@ -905,6 +905,7 @@
};
// Event: hashchange event (BBQ)
//
// Usage in jQuery 1.4 and newer:
//
@@ -978,7 +979,7 @@
// This may seem a little complicated, but it normalizes the special event
// .add method between jQuery 1.4/1.4.1 and 1.4.2+
if ( $.isFunction( handleObj ) ) {
if ( typeof ( handleObj ) === 'function' ) {
// 1.4, 1.4.1
old_handler = handleObj;
return new_handler;

File diff suppressed because one or more lines are too long

View File

@@ -26,7 +26,7 @@
var msie = /MSIE/.test(navigator.userAgent);
var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
var mode = document.documentMode || 0;
var setExpr = $.isFunction( document.createElement('div').style.setExpression );
var setExpr = (typeof (document.createElement('div').style.setExpression) === 'function');
// global $ methods for blocking/unblocking the entire page
$.blockUI = function(opts) { install(window, opts); };

View File

@@ -159,7 +159,7 @@
restoreTextSelection();
// persist state if necessary
if (_this.options.persistState !== null) {
$.isFunction(_this.options.persistState) ? _this.options.persistState(_this.originalTable) : _this.persistState();
(typeof( _this.options.persistState) === 'function') ? _this.options.persistState(_this.originalTable) : _this.persistState();
}
};
},
@@ -330,7 +330,7 @@
}
// restore state if necessary
if (this.options.restoreState !== null) {
$.isFunction(this.options.restoreState) ? this.options.restoreState(this.originalTable) : this._restoreState(this.options.restoreState);
(typeof( _this.options.restoreState) === 'function') ? this.options.restoreState(this.originalTable) : this._restoreState(this.options.restoreState);
}
var _this = this;
this.bindTo.mousedown(function(evt) {
@@ -354,7 +354,7 @@
this._create();
},
destroy: function() {
this.bindTo.unbind('mousedown');
this.bindTo.off('mousedown');
$.Widget.prototype.destroy.apply(this, arguments); // default destroy
// now do other stuff particular to this widget
}

View File

@@ -110,7 +110,7 @@ $.widget('itop.set_widget',
var dataArray = JSON.parse(originalFieldValue),
setWidget = this;
this.possibleValues = dataArray[this.POSSIBLE_VAL_KEY];
this.partialValues = ($.isArray(dataArray[this.PARTIAL_VAL_KEY])) ? dataArray[this.PARTIAL_VAL_KEY] : [];
this.partialValues = (Array.isArray(dataArray[this.PARTIAL_VAL_KEY])) ? dataArray[this.PARTIAL_VAL_KEY] : [];
this.originalValue = dataArray[this.ORIG_VAL_KEY];
this.maxItemsAllowed = dataArray[this.MAX_ITEMS_ALLOWED_KEY];
this.setItemsCodesStatus = {};
@@ -176,7 +176,7 @@ $.widget('itop.set_widget',
_bindEvents: function($widgetElement) {
var setWidget = this;
$widgetElement.bind("update", function() {
$widgetElement.on("update", function() {
if (setWidget.options.isDebug) {
console.debug("update event in Selectize !", this);
}

View File

@@ -222,7 +222,7 @@
if(numChecked === 0) {
value = o.noneSelectedText;
} else {
if($.isFunction(o.selectedText)) {
if(typeof o.selectedText === 'function') {
value = o.selectedText.call(this, numChecked, $inputs.length, $checked.get());
} else if(/\d/.test(o.selectedList) && o.selectedList > 0 && numChecked <= o.selectedList) {
value = $checked.map(function() { return $(this).next().html(); }).get().join(', ');

View File

@@ -14,7 +14,7 @@ jQuery.fn.popupmenu = function ()
var popupmenu = null;
return this.each(function()
{
$(this).bind('click.popup_menu', function (evt)
$(this).on('click.popup_menu', function (evt)
{
var previous_popup = popupmenu;
var bMenuClosed = false;
@@ -58,7 +58,7 @@ jQuery.fn.popupmenu = function ()
evt.stopPropagation();
});
$(document).bind('click.popup_menu', function(evt)
$(document).on('click.popup_menu', function(evt)
{
if (popupmenu)
{

View File

@@ -367,7 +367,7 @@ $(function()
oEvent.stopImmediatePropagation();
// Simulate click on the only menu item
this.element.find(this.js_selectors.compose_menu_item+':first').trigger('click');
this.element.find(this.js_selectors.compose_menu_item).first().trigger('click');
}
// Else, the compose menu will open automatically
@@ -1550,7 +1550,7 @@ $(function()
*/
_CreateEntryGroup: function (sAuthorLogin, sOrigin, sPosition = 'start') {
// Note: When using the ActivityPanel, there should always be at least one entry group already, the one from the object creation
let oEntryGroupElem = this.element.find(this.js_selectors.entry_group+':first')
let oEntryGroupElem = this.element.find(this.js_selectors.entry_group).first()
.clone()
.attr('data-entry-author-login', sAuthorLogin)
.attr('data-entry-group-origin', sOrigin)

View File

@@ -179,7 +179,7 @@ $(function() {
});
// Set focus in the input
this.element.on('set_focus.caselog_entry_form.itop', function () {
CKEditorInstance.focus();
CKEditorInstance.trigger('focus');
});
},

View File

@@ -150,7 +150,7 @@ $(function()
{
if(this._getActiveMenuGroupId() === null)
{
const sFirstMenuGroupId = this.element.find(this.js_selectors.menu_group+':first').attr('data-menu-group-id');
const sFirstMenuGroupId = this.element.find(this.js_selectors.menu_group).first().attr('data-menu-group-id');
this._openDrawer(sFirstMenuGroupId);
}
@@ -310,7 +310,7 @@ $(function()
// Show matching menu node
this.element.find('[data-role="ibo-navigation-menu--menu-node"]').each(function () {
// Note: We don't filter on data-role="ibo-navigation-menu--menu-node-label" on purpose so we can also filter the counters
const sNodeValue = me._formatValueForFilterComparison($(this).children('[data-role="ibo-navigation-menu--menu-node-title"]:first').text());
const sNodeValue = me._formatValueForFilterComparison($(this).children('[data-role="ibo-navigation-menu--menu-node-title"]').first().text());
let bMatches = true;
// On first non matching part, we consider that the menu node is not a match

View File

@@ -41,7 +41,7 @@ $(function()
// Keep URL's hash parameters when clicking on a link of the header
// Note: ":first" used to only target the header of the object, not what could be in the content of its body
this.element.on('click', '[data-role="ibo-panel--header-right"]:first a', function() {
this.element.find('[data-role="ibo-panel--header-right"]').first().on('click', 'a', function() {
aMatches = /#(.*)$/.exec(window.location.href);
if (aMatches != null) {
currentHash = aMatches[1];
@@ -68,7 +68,7 @@ $(function()
}
// Check if transitions available
const oHeaderElem = this.element.find('[data-role="ibo-panel--header"]:first');
const oHeaderElem = this.element.find('[data-role="ibo-panel--header"]').first();
const oButtonsToolbarElem = oHeaderElem.find('[data-role="ibo-panel--header-right"] [data-role="ibo-toolbar"]');
const oTransitionButtonsElems = oButtonsToolbarElem.find('[name="next_action"][data-role="ibo-button"]');
if (oHeaderElem.find('[name="next_action"][data-role="ibo-button"]').length === 0) {

View File

@@ -43,7 +43,7 @@ $.widget( "itop.regulartabs", $.ui.tabs, {
// the body anyway.
.on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() {
if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
this.blur();
this.trigger('blur');
}
} );

View File

@@ -14,7 +14,7 @@ $.widget( "itop.scrollabletabs", $.ui.tabs, {
panel.prepend('<div class="ibo-tab-container--tab-container--label"><span>' + tab.text() + '</span></div>');
let oTempDiv = $('<div>').addClass('ibo-tab--temporary-remote-content')
let oPlaceholder = $('<div>').addClass('ibo-tab--temporary-remote-content--placeholder').load(tab.attr('data-placeholder'));
let oLoadButton = $('<div>').addClass('ibo-tab--temporary-remote-content--button').text(placeholder).on('click', function(){tab.find('a').click()})
let oLoadButton = $('<div>').addClass('ibo-tab--temporary-remote-content--button').text(placeholder).on('click', function(){tab.find('a').trigger('click')})
oTempDiv.append(oPlaceholder)
oTempDiv.append(oLoadButton)
panel.append(oTempDiv);

View File

@@ -121,7 +121,7 @@ $(function()
/*
this.datatable.trigger("update").trigger("applyWidgets");
this.datatable.tableHover();*/
this.datatable.find('.selectList'+this.id).bind('change', function () {
this.datatable.find('.selectList'+this.id).on('change', function () {
me._updateButtons();
});
@@ -202,7 +202,7 @@ $(function()
me.oDlg = $('<div></div>');
$('body').append(me.oDlg);
me.oDlg.html(data);
me.oDlg.find('form').removeAttr('onsubmit').bind('submit', function () {
me.oDlg.find('form').removeAttr('onsubmit').on('submit', function () {
me._onSearchToAdd();
return false;
});
@@ -429,7 +429,7 @@ $(function()
me.oDlg.find('span.indicator').html('<img src="../images/indicator.gif">');
$.post(this.options.submit_to, oParams, function (data) {
me.oDlg.html(data);
me.oDlg.find('form').removeAttr('onsubmit').bind('submit', function () {
me.oDlg.find('form').removeAttr('onsubmit').on('submit', function () {
me._onCreateRow();
return false;
});

View File

@@ -260,7 +260,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH
theMap[this.name] = this.value;
}
}
$(this).parents('tr:first').remove(); // Remove the whole line, so that, next time the dialog gets displayed it's no longer there
$(this).parents('tr').first().remove(); // Remove the whole line, so that, next time the dialog gets displayed it's no longer there
}
);
@@ -342,7 +342,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH
}
width = dlg.innerWidth()-padding_right-padding_left-22; // 5 (margin-left) + 5 (padding-left) + 5 (padding-right) + 5 (margin-right) + 2 for rounding !
height = dlg.innerHeight()-padding_top-padding_bottom-22;
wizard = dlg.find('.wizContainer:first');
wizard = dlg.find('.wizContainer').first();
wizard.width(width);
wizard.height(height);
form_height = searchForm.outerHeight();

View File

@@ -226,7 +226,7 @@ $(function()
// Focus on right input
var oOpElemRadioChecked = this.element.find('.sfc_fg_operator .sfc_op_radio:checked');
var oOpElemInputFirst = oOpElemRadioChecked.closest('.sfc_fg_operator').find('.sfc_op_content input[type="text"]:first');
var oOpElemInputFirst = oOpElemRadioChecked.closest('.sfc_fg_operator').find('.sfc_op_content input[type="text"]').first();
oOpElemInputFirst.filter(':not([data-no-auto-focus])').trigger('click').trigger('focus');
@@ -656,7 +656,7 @@ $(function()
if ($(oEvent.target).is('input[type="text"], select')) {
return;
}
oOpContentElem.focus();
oOpContentElem.trigger('focus');
});
// - Mark as draft on key typing
oOpContentElem.on('keydown', function(oEvent){

View File

@@ -230,7 +230,7 @@ $(function()
var odatetimepickerOptions = $.extend({}, oInputParam.picker_extra_params, odatetimepickerOptionsDefault, me.options.datepicker, {
onSelect: function() {
fHandleSynchCallback(this, false);
$(this).focus();
$(this).trigger('focus');
}
});
@@ -581,7 +581,7 @@ $(function()
oOpElemDropdown.find('.sfc_op_radio').prop('checked', true);
me._markAsDraft();
}
oOpElemDropdown.find('input[type="text"]:first').focus();
oOpElemDropdown.find('input[type="text"]').first().trigger('focus');
})
.appendTo(this.element.find('.sfc_fg_operators'))
;

View File

@@ -129,7 +129,7 @@ $(function()
if ($(oEvent.target).is('input[type="text"], select')) {
return;
}
oOpContentElemFrom.focus();
oOpContentElemFrom.trigger('focus');
});
// - Apply on "enter" key hit
// TODO: this could be refactored

View File

@@ -319,9 +319,9 @@ $(function()
// - Open it first
this.elements.more_criterion.addClass('opened');
// - Focus filter
this.elements.more_criterion.find('.sf_filter:first input[type="text"]')
this.elements.more_criterion.find('.sf_filter').first().find('input[type="text"]')
.val('')
.focus();
.trigger('focus');
// - Then only check if more menu is to close to the right side (otherwise we might not have the right element's position)
var iFormWidth = this.element.outerWidth();
var iFormLeftPos = this.element.offset().left;
@@ -436,7 +436,7 @@ $(function()
// DOM
this.elements.more_criterion = $('<div></div>')
.addClass('sf_more_criterion')
.appendTo(this.elements.criterion_area.find('.sf_criterion_row:first'));
.appendTo(this.elements.criterion_area.find('.sf_criterion_row').first());
// Header part
var oHeaderElem = $('<div class="sfm_header"></div>')
@@ -705,7 +705,7 @@ $(function()
this.elements.submit_button = $('<div></div>')
.addClass('sf_button')
.addClass('sf_submit')
.appendTo(this.elements.criterion_area.find('.sf_criterion_row:first'));
.appendTo(this.elements.criterion_area.find('.sf_criterion_row').first());
var sButtonText = (this.options.auto_submit === true) ? Dict.S('UI:Button:Refresh') : Dict.S('UI:Button:Search');
var sButtonIcon = (this.options.auto_submit === true) ? 'fas fa-sync-alt' : 'fas fa-search';
@@ -871,7 +871,7 @@ $(function()
// Add to first OR condition if not specified
if(oCriterionGroupElem === undefined)
{
oCriterionGroupElem = this.elements.criterion_area.find('.sf_criterion_row:first .sf_criterion_group');
oCriterionGroupElem = this.elements.criterion_area.find('.sf_criterion_row').first().find('.sf_criterion_group');
}
// Protection against bad initialization data
@@ -1209,7 +1209,7 @@ $(function()
{
const me = this;
const oFormPanelHeaderElem = this._getFormPanelHeaderElem();
const oResultsPanelBodyElem = this._getResultsPanelElem().find('.ibo-panel--body:first');
const oResultsPanelBodyElem = this._getResultsPanelElem().find('.ibo-panel--body').first();
// Ensure result body panel has been created
if (oResultsPanelBodyElem.length === 0) {
@@ -1418,7 +1418,7 @@ $(function()
return null;
}
return oFormPanelElem.find('[data-role="ibo-panel--header"]:first');
return oFormPanelElem.find('[data-role="ibo-panel--header"]').first();
},
/**
* @return {null|Object} The jQuery object representing the body of the search form panel; or null if none found
@@ -1431,7 +1431,7 @@ $(function()
return null;
}
return oFormPanelElem.find('[data-role="ibo-panel--body"]:first');
return oFormPanelElem.find('[data-role="ibo-panel--body"]').first();
},
/**
* @return {Object} The jQuery object representing the complete results panel
@@ -1439,7 +1439,7 @@ $(function()
*/
_getResultsPanelElem: function()
{
return this.elements.results_area === null ? null : this.elements.results_area.find('[data-role="ibo-panel"]:first')
return this.elements.results_area === null ? null : this.elements.results_area.find('[data-role="ibo-panel"]').first();
},
/**
* @return {Object} The jQuery object representing the top toolbar of the results (pagination, ...)
@@ -1447,7 +1447,7 @@ $(function()
*/
_getResultsToolbarTopElem: function()
{
return this.elements.results_area === null ? null : this.elements.results_area.find('.ibo-datatable--toolbar:first');
return this.elements.results_area === null ? null : this.elements.results_area.find('.ibo-datatable--toolbar').first();
},
/**
* @return {Object} The jQuery object representing the columns headers of the results
@@ -1455,7 +1455,7 @@ $(function()
*/
_getResultsTableHeaders: function()
{
return this.elements.results_area === null ? null : this.elements.results_area.find('.dataTables_scrollHead:first');
return this.elements.results_area === null ? null : this.elements.results_area.find('.dataTables_scrollHead').first();
},

View File

@@ -129,7 +129,7 @@ function SearchFormForeignKeys(id, sTargetClass, sAttCode, oSearchWidgetElmt, sF
{
dlg.height($(window).height()-70);
}
var searchForm = dlg.find('div.display_block:first'); // Top search form, enclosing display_block
var searchForm = dlg.find('div.display_block').first(); // Top search form, enclosing display_block
var results = $('#SearchResultsToAdd_'+me.id);
var oPadding = {};
var aKeys = ['top', 'right', 'bottom', 'left'];
@@ -257,7 +257,7 @@ function SearchFormForeignKeys(id, sTargetClass, sAttCode, oSearchWidgetElmt, sF
theMap[this.name] = this.value;
}
}
$(this).parents('tr:first').remove(); // Remove the whole line, so that, next time the dialog gets displayed it's no longer there
$(this).parents('tr').first().remove(); // Remove the whole line, so that, next time the dialog gets displayed it's no longer there
}
);
theMap["sFilter"] = $('#datatable_ResultsToAdd_'+me.id+' [name="filter"]').val();
@@ -300,7 +300,7 @@ function SearchFormForeignKeys(id, sTargetClass, sAttCode, oSearchWidgetElmt, sF
$('#SearchResultsToAdd_'+me.id).html(me.emptyHtml);
}
$('#label_'+me.id).removeClass('dlg_loading');
$('#label_'+me.id).focus();
$('#label_'+me.id).trigger('focus');
me.ajax_request = null;
};

View File

@@ -118,7 +118,7 @@ MicroPlugin.mixin = function (Interface) {
loaded: {}
};
if (isArray(plugins)) {
if (Array.isArray(plugins)) {
for (i = 0, n = plugins.length; i < n; i++) {
if (typeof plugins[i] === 'string') {
queue.push(plugins[i]);
@@ -665,7 +665,7 @@ var getInputSelection = function (input) {
result.start = input.selectionStart;
result.length = input.selectionEnd - result.start;
} else if (document.selection) {
input.focus();
input.trigger('focus');
var sel = document.selection.createRange();
var selLen = document.selection.createRange().text.length;
sel.moveStart('character', -input.value.length);
@@ -830,7 +830,7 @@ var Selectize = function($input, settings) {
var computedStyle = window.getComputedStyle && window.getComputedStyle(input, null);
dir = computedStyle ? computedStyle.getPropertyValue('direction') : input.currentStyle && input.currentStyle.direction;
dir = dir || $input.parents('[dir]:first').attr('dir') || '';
dir = dir || $input.parents('[dir]').first().attr('dir') || '';
self.settings = {};
@@ -1180,7 +1180,7 @@ $.extend(Selectize.prototype, {
}
if (!self.isFocused || !self.isOpen) {
self.focus();
self.trigger('focus');
e.preventDefault();
}
},
@@ -1194,7 +1194,7 @@ $.extend(Selectize.prototype, {
if (!defaultPrevented) {
window.setTimeout(function () {
if (!self.isOpen) {
self.focus();
self.trigger('focus');
}
}, 0);
}
@@ -1377,7 +1377,7 @@ $.extend(Selectize.prototype, {
var wasFocused = self.isFocused;
if (self.isDisabled) {
self.blur();
self.trigger('blur');
e && e.preventDefault();
return false;
}
@@ -1415,7 +1415,7 @@ $.extend(Selectize.prototype, {
self.setCaret(self.items.length);
self.refreshState();
dest && dest.focus && dest.focus();
dest && dest.focus && dest.trigger('focus');
self.isBlurring = false;
self.ignoreFocus = false;
@@ -1589,7 +1589,7 @@ $.extend(Selectize.prototype, {
self.hideInput();
if (!this.isFocused) {
self.focus();
self.trigger('focus');
}
},
@@ -1637,7 +1637,7 @@ $.extend(Selectize.prototype, {
self.hideInput();
self.close();
}
self.focus();
self.trigger('focus');
},
hideInput: function() {
@@ -1658,7 +1658,7 @@ $.extend(Selectize.prototype, {
if (self.isDisabled) return self;
self.ignoreFocus = true;
self.$control_input[0].focus();
self.$control_input[0].trigger('focus');
window.setTimeout(function() {
self.ignoreFocus = false;
self.onFocus();
@@ -1667,7 +1667,7 @@ $.extend(Selectize.prototype, {
},
blur: function(dest) {
this.$control_input[0].blur();
this.$control_input[0].trigger('blur');
this.onBlur(null, dest);
return this;
},
@@ -1837,7 +1837,7 @@ $.extend(Selectize.prototype, {
if (results.items.length > 0) {
$active_before = active_before && self.getOption(active_before);
if (results.query !== "" && self.settings.setFirstOptionActive) {
$active = $dropdown_content.find('[data-selectable]:first')
$active = $dropdown_content.find('[data-selectable]').first();
} else if (results.query !== "" && $active_before && $active_before.length) {
$active = $active_before;
} else if (self.settings.mode === 'single' && self.items.length) {
@@ -1847,7 +1847,7 @@ $.extend(Selectize.prototype, {
if ($create && !self.settings.addPrecedence) {
$active = self.getAdjacentOption($create, 1);
} else {
$active = $dropdown_content.find('[data-selectable]:first');
$active = $dropdown_content.find('[data-selectable]').first();
}
}
} else {
@@ -2350,7 +2350,7 @@ $.extend(Selectize.prototype, {
(self.settings.mode === "multi" && self.isFull())
)
return;
self.focus();
self.trigger('focus');
self.isOpen = true;
self.refreshState();
self.$dropdown.css({ visibility: 'hidden', display: 'block' });
@@ -2368,7 +2368,7 @@ $.extend(Selectize.prototype, {
self.hideInput();
if (self.isBlurring) {
self.$control_input[0].blur();
self.$control_input[0].trigger('blur');
}
}

View File

@@ -86,13 +86,13 @@ $(function()
me._on_tabs_activate(ui);
});
}
$(window).bind('resized', function () {
$(window).on('resized', function () {
var that = me;
window.setTimeout(function () {
that._on_resize();
}, 50);
});
$('#dh_flash').bind('toggle_complete', function () {
$('#dh_flash').on('toggle_complete', function () {
var that = me;
window.setTimeout(function () {
that._on_resize();
@@ -655,7 +655,7 @@ $(function()
close: function() { $(this).remove(); },
buttons: [
{text: this.options.labels['cancel'], click: function() { $(this).dialog('close');} },
{text: this.options.labels['export'], click: function() { $('#graph_'+me.element.attr('id')+'_export_dlg').submit(); $(this).dialog('close');} },
{text: this.options.labels['export'], click: function() { $('#graph_'+me.element.attr('id')+'_export_dlg').trigger('submit'); $(this).dialog('close');} },
]
});
},

View File

@@ -47,7 +47,7 @@ $(document).ready(function () {
if (($cellClickedInput.length === 1)
&& ($cellClickedInput.is("input:radio") || $cellClickedInput.is("input:checkbox"))
) {
$cellClickedInput.click();
$cellClickedInput.trigger('click');
if ($cellClicked.not(":first-child")) {
return;
@@ -56,7 +56,7 @@ $(document).ready(function () {
var $lineClicked = $eventTarget.closest("tr");
var $lineClickedInput = $lineClicked.find(FIRST_CELL_WITH_INPUT_SELECTOR);
$lineClickedInput.click();
$lineClickedInput.trigger('click');
});
$(document).on('change', TABLE_SELECTOR, function (event) {

View File

@@ -33,7 +33,7 @@ function ReloadTruncatedList(divId, sSerializedFilter, sExtraParams) {
var table = $(this);
var id = $(this).parent();
aTruncatedLists[divId] = undefined;
var checkbox = (table.find('th:first :checkbox').length > 0);
var checkbox = (table.find('th').first().find(':checkbox').length > 0);
if (checkbox) {
// There is a checkbox in the first column, don't make it sortable
table.tablesorter({headers: {0: {sorter: false}}, widgets: ['myZebra', 'truncatedList']}).tablesorterPager({container: $("#pager")}); // sortable and zebra tables
@@ -387,7 +387,7 @@ function OpenOql(sOQL) {
form.appendChild(input);
document.body.appendChild(form);
// form.submit() is blocked by the browser
$('#run_query_form').submit();
$('#run_query_form').trigger('submit');
document.body.removeChild(form);
}
@@ -1397,7 +1397,7 @@ let CombodoModal = {
let oSelectorElem = null;
switch(typeof oOptions.base_modal.selector) {
case 'string':
oSelectorElem = $(oOptions.base_modal.selector);
oSelectorElem = $(oOptions.base_modal.selector).first();
if (oSelectorElem.length === 0) {
CombodoJSConsole.Error('Could not open modal dialog as the selector option did not return any element: ' + oOptions.base_modal.selector);
return null;

View File

@@ -53,7 +53,7 @@ $oP->SetBreadCrumbEntry('ui-tool-universalsearch', Dict::S('Menu:UniversalSearch
//$sSearchHeaderForceDropdown
$sSearchHeaderForceDropdown = '<select id="select_class" name="baseClass" onChange="this.form.submit();">';
$sSearchHeaderForceDropdown = '<select id="select_class" name="baseClass" onChange="this.form.trigger(\'submit\');">';
$aClassLabels = array();
foreach (MetaModel::GetClasses('bizmodel, grant_by_profile') as $sCurrentClass) {
if ((MetaModel::HasCategory($sCurrentClass, 'grant_by_profile') && UserRights::IsActionAllowed($sCurrentClass, UR_ACTION_BULK_MODIFY))

View File

@@ -390,7 +390,7 @@ try
$oPage->add_ready_script(
<<<EOF
$('select[name^=field]').change( DoCheckMapping );
$('select[name^=field]').on('change', DoCheckMapping );
aDefaultKeys = new Array($sDefaultKeys);
aReadOnlyKeys = new Array($sReadOnlyKeys);
DoCheckMapping();

View File

@@ -681,7 +681,7 @@ try
$aResult['JSURLs'] = str_replace('"', '\'', $oBlock->sJSURLs);
$aResult['js'] = 'charts['.$iRefresh.'].load({json: '.str_replace('"', '\'', $oBlock->sJson).
',keys: { x: \'label\', value: [\'value\']'.
'},onclick: function (d) { var aURLs = $.parseJSON('.str_replace('"', '\'', $oBlock->sJSURLs).'); window.location.href= aURLs[d.index]; }})';
'},onclick: function (d) { var aURLs = JSON.parse('.str_replace('"', '\'', $oBlock->sJSURLs).'); window.location.href= aURLs[d.index]; }})';
break;
case 'pie':
@@ -692,7 +692,7 @@ try
$aResult['JSURLs'] = str_replace('"', '\'', $oBlock->sJSURLs);
$aResult['js'] = 'charts['.$iRefresh.'].load({columns: '.str_replace('"', '\'', $oBlock->sJSColumns).
',names: '.str_replace('"', '\'', $oBlock->sJSNames).
',onclick: function (d) { var aURLs = $.parseJSON('.str_replace('"', '\'', $oBlock->sJSURLs).'); window.location.href= aURLs[d.index]; }})';
',onclick: function (d) { var aURLs = JSON.parse('.str_replace('"', '\'', $oBlock->sJSURLs).'); window.location.href= aURLs[d.index]; }})';
break;
}
} else {
@@ -2194,7 +2194,7 @@ EOF
<<<EOF
$('#upload_button').on('change', function() {
$('#upload_status').html('<img src="{$sAppRootUrl}images/indicator.gif">');
$('#upload_form').submit();
$('#upload_form').trigger('submit');
$(this).prop('disabled', true);
});
$('.img-picker').magnificPopup({type: 'image', closeOnContentClick: true });

View File

@@ -422,14 +422,14 @@ EOF
{
$('input[name=step]').val(3);
$('#wizForm').removeAttr('onsubmit'); // No need to perform validation checks when going back
$('#wizForm').submit();
$('#wizForm').trigger('submit');
}
function CSVGoBack()
{
$('input[name=step]').val(2);
$('#wizForm').removeAttr('onsubmit'); // No need to perform validation checks when going back
$('#wizForm').submit();
$('#wizForm').trigger('submit');
}
@@ -437,7 +437,7 @@ EOF
{
$('input[name=step]').val(1);
$('#wizForm').removeAttr('onsubmit'); // No need to perform validation checks when going back
$('#wizForm').submit();
$('#wizForm').trigger('submit');
}
@@ -873,7 +873,7 @@ EOF
function GoBack()
{
$('input[name=step]').val(1);
$('#wizForm').submit();
$('#wizForm').trigger('submit');
}
var ajax_request = null;
@@ -1089,7 +1089,7 @@ EOF
);
$oPage->add_ready_script(
<<<EOF
$('#select_template_class').change( function() {
$('#select_template_class').on('change', function() {
DisplayTemplate(this.value);
});
EOF

View File

@@ -181,7 +181,7 @@ try
$oQueryForm->AddSubBlock($oQueryTextArea);
$oP->add_ready_script(<<<JS
$("#expression").select();
$("#expression").trigger('select');
$("#expression").on('keyup', function (oEvent) {
if ((oEvent.ctrlKey || oEvent.metaKey) && oEvent.key === 'Enter') {
$(this).closest('form').trigger('submit');
@@ -326,8 +326,8 @@ JS
$oUseSuggestedQueryButton->SetOnClickJsCode(
<<<JS
let \$oQueryTextarea = $('textarea[name=expression]');
\$oQueryTextarea.val($sEscapedExpression).focus();
\$oQueryTextarea.closest('form').submit();
\$oQueryTextarea.val($sEscapedExpression).trigger('focus');
\$oQueryTextarea.closest('form').trigger('submit');
JS
);
$oSyntaxErrorPanel->AddSubBlock($oUseSuggestedQueryButton);

View File

@@ -135,16 +135,16 @@ EOF
$oOpenAllButton = ButtonUIBlockFactory::MakeForAlternativePrimaryAction('Open All', '', '', false, 'lifecycleOpenAll');
$oOpenAllButton->SetOnClickJsCode(
<<<JS
$('#LifeCycleList').find('.expandable-hitarea').click();
$('#LifeCycleAttrOptList').find('.expandable-hitarea').click();
$('#LifeCycleList').find('.expandable-hitarea').trigger('click');
$('#LifeCycleAttrOptList').find('.expandable-hitarea').trigger('click');
JS
);
$oCloseAllButton = ButtonUIBlockFactory::MakeForAlternativePrimaryAction('Close All', '', '', false, 'lifecycleCloseAll');
$oCloseAllButton->SetOnClickJsCode(
<<<JS
$('#LifeCycleList').find('.collapsable-hitarea').click();
$('#LifeCycleAttrOptList').find('.collapsable-hitarea').click();
$('#LifeCycleList').find('.collapsable-hitarea').trigger('click');
$('#LifeCycleAttrOptList').find('.collapsable-hitarea').trigger('click');
JS
);

View File

@@ -55,7 +55,7 @@ try
$oP->SetBreadCrumbEntry('ui-tool-tag-admin', Dict::S('Menu:TagAdminMenu'), Dict::S('Menu:TagAdminMenu+'), '', 'fas fa-tags', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
$sSearchHeaderForceDropdown = '<select id="select_class" name="class" onChange="this.form.submit();">';
$sSearchHeaderForceDropdown = '<select id="select_class" name="class" onChange="this.form.trigger(\'submit\');">';
$aClassLabels = array();
foreach(MetaModel::EnumChildClasses($sBaseClass, ENUM_CHILD_CLASSES_EXCLUDETOP) as $sCurrentClass)
{

View File

@@ -60,7 +60,7 @@ function CheckDirectoryConfFilesPermissions(sWikiVersion){
200: function() {
$('#details').prepend('<div class="message message-warning"><span class="message-title">Security issue:</span> iTop is bundled with directory-level configuration files. You must check that those files will be read by your web server (eg. ' +
'AllowOverride directive should be set to <code>All</code> for Apache HTTP Server) <a href="https://www.itophub.io/wiki/page?id='+sWikiVersion+'%3Ainstall%3Asecurity#secure_critical_directories_access" target="_blank">see documentation</a>.</div>');
$('<span class="text-warning"> and 1 Security issue</span>').insertBefore('h2.message button:first');
$('<span class="text-warning"> and 1 Security issue</span>').insertBefore($('h2.message button').first());
}
}
});

View File

@@ -1517,7 +1517,7 @@ JS
$sDBNameInput .= '</select>';
}
$oPage->add_ready_script('$("#db_name_container").html("'.addslashes($sDBNameInput).'");');
$oPage->add_ready_script('$("#db_name").bind("click keyup change", function() { $("#existing_db").prop("checked", true); WizardUpdateButtons(); });');
$oPage->add_ready_script('$("#db_name").on("click keyup change", function() { $("#existing_db").prop("checked", true); WizardUpdateButtons(); });');
}
}

View File

@@ -320,9 +320,9 @@ HTML
//$oPage->add('</fieldset>');
$oPage->add_ready_script(
<<<JS
$("#radio_update").bind('change', function() { if (this.checked ) { $('#upgrade_info').show(); WizardUpdateButtons(); } else { $('#upgrade_info').hide(); } });
$("#radio_install").bind('change', function() { if (this.checked ) { $('#upgrade_info').hide(); WizardUpdateButtons(); } else { $('#upgrade_info').show(); } });
$("#db_backup_path").bind('change keyup', function() { WizardAsyncAction('check_backup', { db_backup_path: $('#db_backup_path').val() }); });
$("#radio_update").on('change', function() { if (this.checked ) { $('#upgrade_info').show(); WizardUpdateButtons(); } else { $('#upgrade_info').hide(); } });
$("#radio_install").on('change', function() { if (this.checked ) { $('#upgrade_info').hide(); WizardUpdateButtons(); } else { $('#upgrade_info').show(); } });
$("#db_backup_path").on('change keyup', function() { WizardAsyncAction('check_backup', { db_backup_path: $('#db_backup_path').val() }); });
JS
);
}
@@ -619,7 +619,7 @@ HTML
$oPage->add_ready_script(
<<<EOF
$("#changes_summary .title").on('click', function() { $(this).parent().toggleClass('closed'); } );
$('input[name=upgrade_type]').bind('click change', function() { WizardUpdateButtons(); });
$('input[name=upgrade_type]').on('click change', function() { WizardUpdateButtons(); });
EOF
);
@@ -740,7 +740,7 @@ This data remains anonymous until it is associated to a user account on iTop Hub
$oPage->add('<label for="rgpd_consent">&nbsp;I accept the processing of my personal data</label>');
$oPage->add('</fieldset>');
}
$oPage->add_ready_script('$(".check_select").bind("click change", function() { WizardUpdateButtons(); });');
$oPage->add_ready_script('$(".check_select").on("click change", function() { WizardUpdateButtons(); });');
$oPage->add_script(
<<<JS
@@ -923,9 +923,9 @@ class WizStepAdminAccount extends WizardStep
$oPage->add('</fieldset>');
$oPage->add_ready_script(
<<<EOF
$('#admin_user').bind('change keyup', function() { WizardUpdateButtons(); } );
$('#admin_pwd').bind('change keyup', function() { WizardUpdateButtons(); } );
$('#confirm_pwd').bind('change keyup', function() { WizardUpdateButtons(); } );
$('#admin_user').on('change keyup', function() { WizardUpdateButtons(); } );
$('#admin_pwd').on('change keyup', function() { WizardUpdateButtons(); } );
$('#confirm_pwd').on('change keyup', function() { WizardUpdateButtons(); } );
EOF
);
}
@@ -1066,8 +1066,8 @@ class WizStepInstallMiscParams extends AbstractWizStepMiscParams
$oPage->add('<input type="hidden" id="authent_token" value="'.$sAuthentToken.'"/>');
$oPage->add_ready_script(
<<<EOF
$('#application_url').bind('change keyup', function() { WizardUpdateButtons(); } );
$('#graphviz_path').bind('change keyup init', function() { WizardUpdateButtons(); WizardAsyncAction('check_graphviz', { graphviz_path: $('#graphviz_path').val(), authent: $('#authent_token').val()}); } ).trigger('init');
$('#application_url').on('change keyup', function() { WizardUpdateButtons(); } );
$('#graphviz_path').on('change keyup init', function() { WizardUpdateButtons(); WizardAsyncAction('check_graphviz', { graphviz_path: $('#graphviz_path').val(), authent: $('#authent_token').val()}); } ).trigger('init');
$('#btn_next').on('click', function() {
bRet = true;
if ($(this).attr('data-graphviz') != 'ok')
@@ -1207,8 +1207,8 @@ class WizStepUpgradeMiscParams extends AbstractWizStepMiscParams
$oPage->add('<input type="hidden" id="authent_token" value="'.$sAuthentToken.'"/>');
$oPage->add_ready_script(
<<<EOF
$('#application_url').bind('change keyup', function() { WizardUpdateButtons(); } );
$('#graphviz_path').bind('change keyup init', function() { WizardUpdateButtons(); WizardAsyncAction('check_graphviz', { graphviz_path: $('#graphviz_path').val(), authent: $('#authent_token').val() }); } ).trigger('init');
$('#application_url').on('change keyup', function() { WizardUpdateButtons(); } );
$('#graphviz_path').on('change keyup init', function() { WizardUpdateButtons(); WizardAsyncAction('check_graphviz', { graphviz_path: $('#graphviz_path').val(), authent: $('#authent_token').val() }); } ).trigger('init');
$('#btn_next').on('click', function() {
bRet = true;
if ($(this).attr('data-graphviz') != 'ok')
@@ -1531,7 +1531,7 @@ EOF
);
$oPage->add_ready_script(
<<<EOF
$('.wiz-choice').bind('change', function() { CheckChoice($(this).attr('id')); } );
$('.wiz-choice').on('change', function() { CheckChoice($(this).attr('id')); } );
$('.wiz-choice').trigger('change');
EOF
);
@@ -2326,7 +2326,7 @@ class WizStepSummary extends WizardStep
<<<JS
$("#params_summary div").addClass('closed');
$("#params_summary .title").on('click', function() { $(this).parent().toggleClass('closed'); } );
$("#btn_next").bind("click.install", function(event) {
$("#btn_next").on("click.install", function(event) {
$('#summary').hide();
$('#installation_progress').show();
$(this).prop('disabled', true); event.preventDefault(); ExecuteStep("");
@@ -2465,7 +2465,7 @@ EOF
$('#progress').progression( {Current:100, Maximum: 100} );
WizardUpdateButtons();
$("#btn_next").off("click.install");
$("#btn_next").click();
$("#btn_next").trigger('click');
EOF
);
} else {

View File

@@ -390,7 +390,7 @@ $sPageJS
$sPageReadyJS
$(document).ready(function() {
$('[data-role="ibo-navigation-menu--silo-selection--form"] #org_id').on('extkeychange', function() {
$('[data-role="ibo-navigation-menu--silo-selection--form"]').submit();
$('[data-role="ibo-navigation-menu--silo-selection--form"]').trigger('submit');
});
$('[data-role="ibo-navigation-menu--silo-selection--form"] #label_org_id').on('click', function() {
if ($('[data-role="ibo-navigation-menu--silo-selection--form"] #org_id').val() == '') {

View File

@@ -694,7 +694,7 @@ EOF
{
oOptions['base_modal'] = {
'usage': 'replace',
'selector': '.modal[data-source-element="{$sButtonAddId}"]:first'
'selector': '.modal[data-source-element="{$sButtonAddId}"]'
};
}
CombodoModal.OpenModal(oOptions);

View File

@@ -454,7 +454,7 @@ JS
{
oOptions['base_modal'] = {
'usage': 'replace',
'selector': '.modal[data-source-element="{$sSearchButtonId}"]:first'
'selector': '.modal[data-source-element="{$sSearchButtonId}"]'
};
}
CombodoModal.OpenModal(oOptions);

View File

@@ -242,7 +242,7 @@ EOF
name: $(me).closest(".form_field").attr("data-field-id"),
value: $(me).val()
});
}).on("mouseup", function(){this.focus();});
}).on("mouseup", function(){this.trigger('focus');});
JS
);
break;
@@ -275,7 +275,7 @@ JS
name: $(me).closest(".form_field").attr("data-field-id"),
value: $(me).val()
});
}).on("mouseup", function(){this.focus();});
}).on("mouseup", function(){this.trigger('focus');});
JS
);
}

View File

@@ -506,14 +506,14 @@ EOF
function CSVGoBack()
{
$('input[name=step]').val($iCurrentStep-1);
$('#wizForm').submit();
$('#wizForm').trigger('submit');
}
function CSVRestart()
{
$('input[name=step]').val(1);
$('#wizForm').submit();
$('#wizForm').trigger('submit');
}
@@ -560,7 +560,7 @@ function DoSubmit(bConfirm)
{
// Submit the form
$('#wizForm').block();
$('#wizForm').submit();
$('#wizForm').trigger('submit');
}
return false;
}
@@ -575,7 +575,7 @@ function RunImport()
$('#dlg_confirmation').dialog('close');
// Submit the form
$('#wizForm').block();
$('#wizForm').submit();
$('#wizForm').trigger('submit');
}
EOF
);

View File

@@ -12,7 +12,7 @@ oWelcomePopupDialogElem.dialog({
title: oWelcomePopupDialogElem.attr('data-title'),
open: function () {
// Focus on acknowledge button
const oAckButton = oWelcomePopupDialogElem.closest('[role="dialog"]').find('.ui-dialog-buttonset .ibo-is-primary:first');
const oAckButton = oWelcomePopupDialogElem.closest('[role="dialog"]').find('.ui-dialog-buttonset .ibo-is-primary').first();
oAckButton.trigger('focus');
// Count stack items and change button label to close if there is only one
@@ -75,13 +75,13 @@ oWelcomePopupDialogElem
oWelcomePopupDialogElem.find('[data-role="ibo-welcome-popup--stack-item"][data-uuid="' + sUUIDEscapedForSelector + '"]').addClass('ibo-is-acknowledged');
// Display next message if any
const oNextStackItemElem = oWelcomePopupDialogElem.find('[data-role="ibo-welcome-popup--stack-item"]:not(.ibo-is-acknowledged):first');
const oNextStackItemElem = oWelcomePopupDialogElem.find('[data-role="ibo-welcome-popup--stack-item"]:not(.ibo-is-acknowledged)').first();
if (oNextStackItemElem.length > 0) {
oNextStackItemElem.trigger('click');
// Count non acknowledged stack items and change button label to close if there is only one
if (oWelcomePopupDialogElem.find('[data-role="ibo-welcome-popup--stack-item"]:not(.ibo-is-acknowledged)').length === 1) {
const oAckButton = oWelcomePopupDialogElem.closest('[role="dialog"]').find('.ui-dialog-buttonset .ibo-is-primary:first');
const oAckButton = oWelcomePopupDialogElem.closest('[role="dialog"]').find('.ui-dialog-buttonset .ibo-is-primary').first();
oAckButton.text({{ 'UI:WelcomePopup:Button:AcknowledgeAndClose'|dict_s|json_encode|raw }});
}
} else {

View File

@@ -1,7 +1,7 @@
{# @copyright Copyright (C) 2010-2024 Combodo SAS #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% if oUIBlock.GetShowFilename() %}
$('#{{ oUIBlock.GetId() }}').bind('change', function() {
$('#{{ oUIBlock.GetId() }}').on('change', function() {
var fileName = $(this).val().replace(/^.*[\\\/]/, '');
fileName = $('<div/>').text(fileName).html();
$('#{{ oUIBlock.GetId() }}-file-name').html(fileName);

View File

@@ -5,7 +5,7 @@
{% include "base/components/input/inputlabel.html.twig" %}
{% endif %}
<select id="{{ oUIBlock.GetId() }}" name="{{ oUIBlock.GetName() }}"
{% if oUIBlock.GetSubmitOnChange() %} onChange="this.form.submit();" {% endif %}
{% if oUIBlock.GetSubmitOnChange() %} onChange="this.form.trigger('submit');" {% endif %}
{% if oUIBlock.IsMultiple() %} multiple {% endif %}
class="{% if oUIBlock.IsHidden() %}ibo-is-hidden{% endif %}{% if oUIBlock.GetAdditionalCSSClassesAsString() %} {{ oUIBlock.GetAdditionalCSSClassesAsString() }}{% endif %}"
{% if oUIBlock.GetDataAttributes() %}

View File

@@ -15,12 +15,12 @@
$('#{{ oUIBlock.GetId() }}').on('edit_object', function(){
let oFavoriteButton = $(this).find('#UIMenuModify');
if(oFavoriteButton[0]){
oFavoriteButton[0].click();
oFavoriteButton[0].trigger('click');
}
else{
let oPopupItemButton = $('[data-role="ibo-popover-menu"]').find('[data-resource-id="UI:Menu:Modify"]');
if(oPopupItemButton[0]){
oPopupItemButton[0].click();
oPopupItemButton[0].trigger('click');
}
}
});
@@ -28,12 +28,12 @@
$('#{{ oUIBlock.GetId() }}').on('delete_object', function(){
let oFavoriteButton = $(this).find('#UIMenuDelete');
if(oFavoriteButton[0]){
oFavoriteButton[0].click();
oFavoriteButton[0].trigger('click');
}
else{
let oPopupItemButton = $('[data-role="ibo-popover-menu"]').find('[data-resource-id="UI:Menu:Delete"]');
if(oPopupItemButton[0]){
oPopupItemButton[0].click();
oPopupItemButton[0].trigger('click');
}
}
});
@@ -41,22 +41,22 @@
$('#{{ oUIBlock.GetId() }}').on('new_object', function(){
let oFavoriteButton = $(this).find('#UIMenuNew');
if(oFavoriteButton[0]){
oFavoriteButton[0].click();
oFavoriteButton[0].trigger('click');
}
else{
let oPopupItemButton = $('[data-role="ibo-popover-menu"]').find('[data-resource-id="UI:Menu:New"]');
if(oPopupItemButton[0]){
oPopupItemButton[0].click();
oPopupItemButton[0].trigger('click');
}
}
});
{% if oUIBlock.GetObjectMode() == constant('cmdbAbstractObject::ENUM_DISPLAY_MODE_EDIT') or oUIBlock.GetObjectMode() == constant('cmdbAbstractObject::ENUM_DISPLAY_MODE_CREATE') %}
$('#{{ oUIBlock.GetId() }}').on('save_object', function(){
$(this).find('button[type="submit"][name=""][value=""]').click();
$(this).find('button[type="submit"][name=""][value=""]').trigger('click');
});
{% elseif oUIBlock.GetObjectMode() == constant('cmdbAbstractObject::ENUM_DISPLAY_MODE_STIMULUS') %}
$('#{{ oUIBlock.GetId() }}').on('save_object', function(){
$(this).find('button[type="submit"][name="submit"][value="submit"]').click();
$(this).find('button[type="submit"][name="submit"][value="submit"]').trigger('click');
});
{% endif %}
{% endblock %}

View File

@@ -1,4 +1,4 @@
{# @copyright Copyright (C) 2010-2024 Combodo SAS #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
$("#user").focus();
$("#user").trigger('focus');

View File

@@ -161,7 +161,7 @@ try
$oP->add(Dict::S('UI:RunQuery:ExpressionToEvaluate')."<br/>\n");
$oP->add("<textarea cols=\"120\" rows=\"8\" id=\"expression\" name=\"expression\">".utils::EscapeHtml($sExpression)."</textarea>\n");
$oP->add_ready_script(<<<JS
$("#expression").select();
$("#expression").trigger('select');
$("#expression").on('keyup', function (oEvent) {
if ((oEvent.ctrlKey || oEvent.metaKey) && oEvent.key === 'Enter') {
$(this).closest('form').trigger('submit');