From c29bff4d912ba8feddace20bca54ccac1a1ca7d9 Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Tue, 26 Mar 2024 11:32:55 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B07355=20-=20Fix=20deprecated=20jQuery=20c?= =?UTF-8?q?all?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/dashboard.class.inc.php | 2 +- application/shortcut.class.inc.php | 2 +- application/ui.extkeywidget.class.inc.php | 2 +- application/ui.searchformforeignkeys.class.inc.php | 2 +- .../2.x/itop-attachments/renderers.itop-attachments.php | 4 ++-- js/dashboard.js | 2 +- js/dashlet.js | 2 +- js/extkeywidget.js | 2 +- js/icon_select.js | 6 +++--- js/links/links_direct_widget.js | 8 ++++---- js/links/links_widget.js | 4 ++-- js/searchformforeignkeys.js | 2 +- js/tabularfieldsselector.js | 4 ++-- js/utils.js | 2 +- .../block-object-picker-dialog/layout.ready.js.twig | 4 ++-- templates/base/components/datatable/layout.ready.js.twig | 2 +- 16 files changed, 25 insertions(+), 25 deletions(-) diff --git a/application/dashboard.class.inc.php b/application/dashboard.class.inc.php index 7ad64b7f7..25072a552 100644 --- a/application/dashboard.class.inc.php +++ b/application/dashboard.class.inc.php @@ -480,7 +480,7 @@ abstract class Dashboard CombodoTooltip.InitTooltipFromMarkup($("#attr_auto_reload_sec")); $("#attr_auto_reload_sec").prop('disabled', !$('#attr_auto_reload').is(':checked')); - $('#attr_auto_reload').change( function(ev) { + $('#attr_auto_reload').on('change', function(ev) { $("#attr_auto_reload_sec").prop('disabled', !$(this).is(':checked')); } ); diff --git a/application/shortcut.class.inc.php b/application/shortcut.class.inc.php index e442738b8..e84bb39c5 100644 --- a/application/shortcut.class.inc.php +++ b/application/shortcut.class.inc.php @@ -293,7 +293,7 @@ $("#attr_auto_reload_sec").attr('data-tooltip-content', '$sRateTitle'); CombodoTooltip.InitTooltipFromMarkup($("#attr_auto_reload_sec")); $("#attr_auto_reload_sec").prop('disabled', !$('#attr_auto_reload').is(':checked')); -$('#attr_auto_reload').change( function(ev) { +$('#attr_auto_reload').on('change', function(ev) { $("#attr_auto_reload_sec").prop('disabled', !$(this).is(':checked')); } ); diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php index 3eb0131cd..de82c3d4e 100644 --- a/application/ui.extkeywidget.class.inc.php +++ b/application/ui.extkeywidget.class.inc.php @@ -734,7 +734,7 @@ HTML ], }); $('#fs_{$this->iId}').on('submit.uiAutocomplete', oACWidget_{$this->iId}.DoSearchObjects); - $('#dc_{$this->iId}').resize(oACWidget_{$this->iId}.UpdateSizes); + $('#dc_{$this->iId}').on('resize', oACWidget_{$this->iId}.UpdateSizes); JS ); } diff --git a/application/ui.searchformforeignkeys.class.inc.php b/application/ui.searchformforeignkeys.class.inc.php index b4ecbbca4..8bc9e7911 100644 --- a/application/ui.searchformforeignkeys.class.inc.php +++ b/application/ui.searchformforeignkeys.class.inc.php @@ -99,7 +99,7 @@ HTML }); $('#dlg_{$this->m_iInputId}').dialog('option', {title:'$sTitle'}); $('#SearchFormToAdd_{$this->m_iInputId} form').on('submit.uilinksWizard', oForeignKeysWidget{$this->m_iInputId}.SearchObjectsToAdd); -$('#SearchFormToAdd_{$this->m_iInputId}').resize(oForeignKeysWidget{$this->m_iInputId}.UpdateSizes); +$('#SearchFormToAdd_{$this->m_iInputId}').on('resize', oForeignKeysWidget{$this->m_iInputId}.UpdateSizes); JS ); } diff --git a/datamodels/2.x/itop-attachments/renderers.itop-attachments.php b/datamodels/2.x/itop-attachments/renderers.itop-attachments.php index 4407d68a8..e0ecd4625 100644 --- a/datamodels/2.x/itop-attachments/renderers.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/renderers.itop-attachments.php @@ -276,7 +276,7 @@ abstract class AbstractAttachmentsRenderer e.stopPropagation(); }) - $(document).bind('dragover', function (e) { + $(document).on('dragover', function (e) { var bFiles = false; if (e.dataTransfer && e.dataTransfer.types) { @@ -317,7 +317,7 @@ abstract class AbstractAttachmentsRenderer window.dropZoneCnt++; }); - $(document).bind('dragend dragleave drop', function(event){ + $(document).on('dragend dragleave drop', function(event){ window.dropZoneCnt--; if(window.dropZone && window.dropZoneCnt === 0){ window.dropZone.removeClass('ibo-drag-in'); diff --git a/js/dashboard.js b/js/dashboard.js index 2699e189e..c604d262a 100644 --- a/js/dashboard.js +++ b/js/dashboard.js @@ -291,7 +291,7 @@ $(function() }, // Dirty means: at least one change has not been committed yet is_dirty: function () { - if ($('#dashboard_editor .ui-layout-east .itop-property-field-modified').size() > 0) { + if ($('#dashboard_editor .ui-layout-east .itop-property-field-modified').length > 0) { return true; } else { return false; diff --git a/js/dashlet.js b/js/dashlet.js index 5856f9e58..14f52f860 100644 --- a/js/dashlet.js +++ b/js/dashlet.js @@ -20,7 +20,7 @@ $(function() this.element .addClass('itop-dashlet') - .bind('click.itop-dashlet', function(event) { me._on_click(event); } ); + .on('click.itop-dashlet', function(event) { me._on_click(event); } ); this._update(); }, diff --git a/js/extkeywidget.js b/js/extkeywidget.js index d461c988f..98496b63b 100644 --- a/js/extkeywidget.js +++ b/js/extkeywidget.js @@ -433,7 +433,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper me.UpdateSizes(); me.UpdateButtons(); me.ajax_request = null; - $('#count_'+me.id+'_results').change(function () { + $('#count_'+me.id+'_results').on('change', function () { me.UpdateButtons(); }); if (me.bDoSearch) { diff --git a/js/icon_select.js b/js/icon_select.js index 0afd9bf48..ca8d6c15c 100644 --- a/js/icon_select.js +++ b/js/icon_select.js @@ -53,7 +53,7 @@ $(function() }); this.element.after(this.oButton); this.element.addClass( "itop-icon-select" ).button(); - this.element.bind( "reverted.itop-icon-select", function(ev, data) { + this.element.on( "reverted.itop-icon-select", function(ev, data) { var idx = me._find_item(data.previous_value); if (idx != null) { @@ -68,7 +68,7 @@ $(function() this.oButton.after(this.oUploadBtn); } var id = this.element.attr('id'); - $('#event_bus').bind('tabshow.itop-icon-select'+id, function(event) { + $('#event_bus').on('tabshow.itop-icon-select'+id, function(event) { // Compute the offsetX the first time the 'element' becomes visible... var bVisible = me.element.parent().is(':visible'); if ((me.options.offsetX == null) && (bVisible)) @@ -216,7 +216,7 @@ $(function() var me = this; this.oUploadDlg = $('

'+this.options.labels['pick_icon_file']+'

'); this.element.after(this.oUploadDlg); - $('input[type=file]').bind('change', function() { me._do_upload(); }); + $('input[type=file]').on('change', function() { me._do_upload(); }); this.oUploadDlg.dialog({ width: 400, modal: true, diff --git a/js/links/links_direct_widget.js b/js/links/links_direct_widget.js index b65eb6653..7eead55f8 100644 --- a/js/links/links_direct_widget.js +++ b/js/links/links_direct_widget.js @@ -68,7 +68,7 @@ $(function() .after(this.inputToBeRemoved) .after(this.indicator); - this.element.find('.selectList'+this.id).bind('change', function () { + this.element.find('.selectList'+this.id).on('change', function () { me._updateButtons(); }); @@ -206,7 +206,7 @@ $(function() me._onSearchToAdd(); return false; }); - $('#SearchFormToAdd_'+me.id).resize(function () { + $('#SearchFormToAdd_'+me.id).on('resize', function () { me._onSearchDlgUpdateSize(); }); @@ -249,7 +249,7 @@ $(function() } else { - $('#count_'+me.id).change(function() { + $('#count_'+me.id).on('change', function() { var c = this.value; me._onUpdateDlgButtons(c); }); @@ -298,7 +298,7 @@ $(function() $.post(this.options.submit_to, oParams, function(data) { $('#SearchResultsToAdd_'+me.id).html(data); - $('#count_'+me.id).change(function() { + $('#count_'+me.id).on('change', function() { var c = this.value; me._onUpdateDlgButtons(c); }); diff --git a/js/links/links_widget.js b/js/links/links_widget.js index 3e759bb22..6ea6bd71d 100644 --- a/js/links/links_widget.js +++ b/js/links/links_widget.js @@ -162,7 +162,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH if (me.bDoSearch) { me.SearchObjectsToAdd(); } else { - $('#count_'+me.id).change(function () { + $('#count_'+me.id).on('change', function () { let c = this.value; me.UpdateButtons(c); }); @@ -174,7 +174,7 @@ function LinksWidget(id, sClass, sAttCode, iInputId, sSuffix, bDuplicates, oWizH }; this.SearchObjectsToAdd = function () { - $('#count_'+me.id).change(function () { + $('#count_'+me.id).on('change', function () { let c = this.value; me.UpdateButtons(c); }); diff --git a/js/searchformforeignkeys.js b/js/searchformforeignkeys.js index 7fe01817b..11dd5c545 100644 --- a/js/searchformforeignkeys.js +++ b/js/searchformforeignkeys.js @@ -206,7 +206,7 @@ function SearchFormForeignKeys(id, sTargetClass, sAttCode, oSearchWidgetElmt, sF $('#fr_'+me.id+' input:radio').on('click', function() { me.UpdateButtons(); }); me.UpdateButtons(); me.ajax_request = null; - $('#count_'+me.id).change(function(){ + $('#count_'+me.id).on('change', function(){ me.UpdateButtons(); }); me.UpdateSizes(); diff --git a/js/tabularfieldsselector.js b/js/tabularfieldsselector.js index a94d63f98..4f702020e 100644 --- a/js/tabularfieldsselector.js +++ b/js/tabularfieldsselector.js @@ -34,11 +34,11 @@ $(function () { this._flatten_fields(this.options.fields); this.sId = this.element.attr('id'); this.element.addClass('itop-tabularfieldsselector'); - this.element.parent().bind('form-part-activate', function () { + this.element.parent().on('form-part-activate', function () { me._update_from_holder(); me._update_preview(); }); - this.element.parent().bind('validate', function () { + this.element.parent().on('validate', function () { me.validate(); }); diff --git a/js/utils.js b/js/utils.js index 7cdbb307a..cb58b6f4e 100644 --- a/js/utils.js +++ b/js/utils.js @@ -195,7 +195,7 @@ function ReloadSearchForm(divId, sClassName, sBaseClass, sContext, sTableId, sEx oDiv.empty(); oDiv.append(data); oDiv.unblock(); - oDiv.parent().resize(); // Inform the parent that the form has just been (potentially) resized + oDiv.parent().trigger('resize'); // Inform the parent that the form has just been (potentially) resized oDiv.find('form.search_form_handler').triggerHandler('itop.search.form.reloaded'); } ); diff --git a/templates/application/links/indirect/block-object-picker-dialog/layout.ready.js.twig b/templates/application/links/indirect/block-object-picker-dialog/layout.ready.js.twig index f3f499edb..1170061ff 100644 --- a/templates/application/links/indirect/block-object-picker-dialog/layout.ready.js.twig +++ b/templates/application/links/indirect/block-object-picker-dialog/layout.ready.js.twig @@ -29,7 +29,7 @@ $('#dlg_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }}').dialog({ }); -$('#SearchFormToAdd_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }} form').bind('submit.uilinksWizard', oWidget{{ oUIBlock.oUILinksWidget.GetInputId() }}.SearchObjectsToAdd); -$('#SearchFormToAdd_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }}').resize(oWidget{{ oUIBlock.oUILinksWidget.GetInputId() }}.UpdateSizes); +$('#SearchFormToAdd_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }} form').on('submit.uilinksWizard', oWidget{{ oUIBlock.oUILinksWidget.GetInputId() }}.SearchObjectsToAdd); +$('#SearchFormToAdd_{{ oUIBlock.oUILinksWidget.GetLinkedSetId() }}').on('resize', oWidget{{ oUIBlock.oUILinksWidget.GetInputId() }}.UpdateSizes); {% endapply %} \ No newline at end of file diff --git a/templates/base/components/datatable/layout.ready.js.twig b/templates/base/components/datatable/layout.ready.js.twig index 04bd5b3bb..9250ef84c 100644 --- a/templates/base/components/datatable/layout.ready.js.twig +++ b/templates/base/components/datatable/layout.ready.js.twig @@ -374,7 +374,7 @@ $('body').on('open_creation_modal.object.itop','#{{ oUIBlock.GetId() }}', functi {% endif %} {% if oUIBlock.GetOption('sCountSelector') is not empty %} -$('#{{ sListId }} [name="selectionCount"]').bind('change', function () { +$('#{{ sListId }} [name="selectionCount"]').on('change', function () { $('{{ oUIBlock.GetOption('sCountSelector') }}').val($('#{{ sListId }} [name="selectionCount"]').val()); $('{{ oUIBlock.GetOption('sCountSelector') }}').trigger('change'); });