diff --git a/package-lock.json b/package-lock.json index 64bc2594..9838d53e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,8 @@ "html-loader": "^0.4.4", "html-webpack-plugin": "^3.2.0", "imports-loader": "^0.7.1", - "jquery": "1.11.3", + "install": "^0.13.0", + "jquery": "^3.7.1", "jshint": "^2.9.1-rc3", "luxon": "^3.7.2", "mark.js": "8.11.1", @@ -5888,6 +5889,15 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, + "node_modules/install": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/install/-/install-0.13.0.tgz", + "integrity": "sha512-zDml/jzr2PKU9I8J/xyZBQn8rPCAY//UOYNmR01XwNwyfhEWObo2SWfSl1+0tm1u6PhxLwDnfsT/6jB7OUxqFA==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/internal-slot": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", @@ -6388,10 +6398,11 @@ "optional": true }, "node_modules/jquery": { - "version": "1.11.3", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-1.11.3.tgz", - "integrity": "sha512-pHM/XLofp0FJc0/0AsRm8q/5ob+a1kno+vfclXGozaMBPv3qD7Xq19loECVcBB4MOLdygnyneQMPTsH5QiVNBQ==", - "dev": true + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", + "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==", + "dev": true, + "license": "MIT" }, "node_modules/js-base64": { "version": "2.6.4", @@ -16865,6 +16876,12 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, + "install": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/install/-/install-0.13.0.tgz", + "integrity": "sha512-zDml/jzr2PKU9I8J/xyZBQn8rPCAY//UOYNmR01XwNwyfhEWObo2SWfSl1+0tm1u6PhxLwDnfsT/6jB7OUxqFA==", + "dev": true + }, "internal-slot": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", @@ -17223,9 +17240,9 @@ "optional": true }, "jquery": { - "version": "1.11.3", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-1.11.3.tgz", - "integrity": "sha512-pHM/XLofp0FJc0/0AsRm8q/5ob+a1kno+vfclXGozaMBPv3qD7Xq19loECVcBB4MOLdygnyneQMPTsH5QiVNBQ==", + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", + "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==", "dev": true }, "js-base64": { diff --git a/package.json b/package.json index c71c47ba..85240e78 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,8 @@ "html-loader": "^0.4.4", "html-webpack-plugin": "^3.2.0", "imports-loader": "^0.7.1", - "jquery": "1.11.3", + "install": "^0.13.0", + "jquery": "^3.7.1", "jshint": "^2.9.1-rc3", "luxon": "^3.7.2", "mark.js": "8.11.1", diff --git a/rhodecode/public/js/mode/swift/swift.js b/rhodecode/public/js/mode/swift/swift.js index 55e31e27..f81e6d8d 100644 --- a/rhodecode/public/js/mode/swift/swift.js +++ b/rhodecode/public/js/mode/swift/swift.js @@ -75,7 +75,7 @@ } var stringMatch if (stringMatch = stream.match(/("""|"|')/)) { - var tokenize = tokenString.bind(null, stringMatch[0]) + var tokenize = tokenString.on(null, stringMatch[0]) state.tokenize.push(tokenize) return tokenize(stream, state) } diff --git a/rhodecode/public/js/src/bootstrap.js b/rhodecode/public/js/src/bootstrap.js index 2c642571..b7e19c90 100644 --- a/rhodecode/public/js/src/bootstrap.js +++ b/rhodecode/public/js/src/bootstrap.js @@ -745,7 +745,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") } if (!isActive || (isActive && e.keyCode == 27)) { if (e.which == 27) $parent.find(toggle).focus() - return $this.click() + return $this.trigger('click') } var $items = $('[role=menu] li:not(.divider):visible a', $parent) diff --git a/rhodecode/public/js/src/codemirror/codemirror.js b/rhodecode/public/js/src/codemirror/codemirror.js index 86692203..6c6dcf61 100644 --- a/rhodecode/public/js/src/codemirror/codemirror.js +++ b/rhodecode/public/js/src/codemirror/codemirror.js @@ -9660,7 +9660,7 @@ var wrappedSubmit = form.submit = function () { save(); form.submit = realSubmit; - form.submit(); + form.trigger('submit'); form.submit = wrappedSubmit; }; } catch(e) {} diff --git a/rhodecode/public/js/src/plugins/jquery.auto-grow-input.js b/rhodecode/public/js/src/plugins/jquery.auto-grow-input.js index eaf23041..1d013f90 100644 --- a/rhodecode/public/js/src/plugins/jquery.auto-grow-input.js +++ b/rhodecode/public/js/src/plugins/jquery.auto-grow-input.js @@ -51,7 +51,7 @@ testSubject.insertAfter(input); - $(this).bind('keyup keydown blur update', check); + $(this).on('keyup keydown blur update', check); }); diff --git a/rhodecode/public/js/src/plugins/jquery.autocomplete.js b/rhodecode/public/js/src/plugins/jquery.autocomplete.js index 82d11bdd..ec150ce0 100644 --- a/rhodecode/public/js/src/plugins/jquery.autocomplete.js +++ b/rhodecode/public/js/src/plugins/jquery.autocomplete.js @@ -215,7 +215,7 @@ $.extend(options, suppliedOptions); - that.isLocal = $.isArray(options.lookup); + that.isLocal = Array.isArray(options.lookup); if (that.isLocal) { options.lookup = that.verifySuggestionsFormat(options.lookup); @@ -525,14 +525,14 @@ if (that.isLocal) { response = that.getSuggestionsLocal(query); } else { - if ($.isFunction(serviceUrl)) { + if (typeof serviceUrl === 'function') { serviceUrl = serviceUrl.call(that.element, query); } var callParams = {}; //make an evaluated copy of params $.each(params, function(index, value) { - if($.isFunction(value)){ + if(typeof value === 'function'){ callParams[index] = value(); } else { @@ -544,7 +544,7 @@ response = that.cachedResponse[cacheKey]; } - if (response && $.isArray(response.suggestions)) { + if (response && Array.isArray(response.suggestions)) { that.suggestions = response.suggestions; that.suggest(); } else if (!that.isBadQuery(query)) { @@ -658,7 +658,7 @@ container.children().first().addClass(classSelected); } - if ($.isFunction(beforeRender)) { + if (typeof beforeRender === 'function') { beforeRender.call(that.element, container); } @@ -886,7 +886,7 @@ that.suggestions = []; that.selection = suggestion; - if ($.isFunction(onSelectCallback)) { + if (typeof onSelectCallback === 'function') { onSelectCallback.call(this, that.element, suggestion, prevElem); } }, diff --git a/rhodecode/public/js/src/plugins/jquery.dataTables.js b/rhodecode/public/js/src/plugins/jquery.dataTables.js index 0184b877..4b8d4e4a 100644 --- a/rhodecode/public/js/src/plugins/jquery.dataTables.js +++ b/rhodecode/public/js/src/plugins/jquery.dataTables.js @@ -251,7 +251,7 @@ var api = this.api( true ); /* Check if we want to add multiple rows or not */ - var rows = $.isArray(data) && ( $.isArray(data[0]) || $.isPlainObject(data[0]) ) ? + var rows = Array.isArray(data) && ( Array.isArray(data[0]) || $.isPlainObject(data[0]) ) ? api.rows.add( data ) : api.row.add( data ); @@ -337,7 +337,7 @@ * var oTable; * * // 'open' an information row when a row is clicked on - * $('#example tbody tr').click( function () { + * $('#example tbody tr').on('click', function () { * if ( oTable.fnIsOpen(this) ) { * oTable.fnClose( this ); * } else { @@ -489,7 +489,7 @@ * $(document).ready(function() { * oTable = $('#example').dataTable(); * - * oTable.$('tr').click( function () { + * oTable.$('tr').on('click', function () { * var data = oTable.fnGetData( this ); * // ... do something with the array / object of data for the row * } ); @@ -500,7 +500,7 @@ * $(document).ready(function() { * oTable = $('#example').dataTable(); * - * oTable.$('td').click( function () { + * oTable.$('td').on('click', function () { * var sData = oTable.fnGetData( this ); * alert( 'The cell clicked on had the value of '+sData ); * } ); @@ -562,7 +562,7 @@ * * @example * $(document).ready(function() { - * $('#example tbody td').click( function () { + * $('#example tbody td').on('click', function () { * // Get the position of the current data from the node * var aPos = oTable.fnGetPosition( this ); * @@ -611,7 +611,7 @@ * var oTable; * * // 'open' an information row when a row is clicked on - * $('#example tbody tr').click( function () { + * $('#example tbody tr').on('click', function () { * if ( oTable.fnIsOpen(this) ) { * oTable.fnClose( this ); * } else { @@ -647,7 +647,7 @@ * var oTable; * * // 'open' an information row when a row is clicked on - * $('#example tbody tr').click( function () { + * $('#example tbody tr').on('click', function () { * if ( oTable.fnIsOpen(this) ) { * oTable.fnClose( this ); * } else { @@ -976,7 +976,7 @@ // If the length menu is given, but the init display length is not, use the length menu if ( oInit.aLengthMenu && ! oInit.iDisplayLength ) { - oInit.iDisplayLength = $.isArray( oInit.aLengthMenu[0] ) ? + oInit.iDisplayLength = Array.isArray( oInit.aLengthMenu[0] ) ? oInit.aLengthMenu[0][0] : oInit.aLengthMenu[0]; } @@ -1092,7 +1092,7 @@ if ( oInit.iDeferLoading !== null ) { oSettings.bDeferLoading = true; - var tmp = $.isArray( oInit.iDeferLoading ); + var tmp = Array.isArray( oInit.iDeferLoading ); oSettings._iRecordsDisplay = tmp ? oInit.iDeferLoading[0] : oInit.iDeferLoading; oSettings._iRecordsTotal = tmp ? oInit.iDeferLoading[1] : oInit.iDeferLoading; } @@ -1822,7 +1822,7 @@ // orderData can be given as an integer var dataSort = init.aDataSort; - if ( dataSort && ! $.isArray( dataSort ) ) { + if ( dataSort && ! Array.isArray( dataSort ) ) { init.aDataSort = [ dataSort ]; } } @@ -2303,7 +2303,7 @@ def.targets : def.aTargets; - if ( ! $.isArray( aTargets ) ) + if ( ! Array.isArray( aTargets ) ) { aTargets = [ aTargets ]; } @@ -2622,7 +2622,7 @@ innerSrc = a.join('.'); // Traverse each entry in the array getting the properties requested - if ( $.isArray( data ) ) { + if ( Array.isArray( data ) ) { for ( var j=0, jLen=data.length ; j' ) .appendTo( container ); attach( inner, button ); diff --git a/rhodecode/public/js/src/plugins/jquery.debounce.js b/rhodecode/public/js/src/plugins/jquery.debounce.js index b48dd39a..f428336d 100644 --- a/rhodecode/public/js/src/plugins/jquery.debounce.js +++ b/rhodecode/public/js/src/plugins/jquery.debounce.js @@ -93,13 +93,12 @@ // // > var throttled = jQuery.throttle( delay, [ no_trailing, ] callback ); // > - // > jQuery('selector').bind( 'someevent', throttled ); - // > jQuery('selector').unbind( 'someevent', throttled ); + // > jQuery('selector').on( 'someevent', throttled ); + // > jQuery('selector').off( 'someevent', throttled ); // - // This also works in jQuery 1.4+: // - // > jQuery('selector').bind( 'someevent', jQuery.throttle( delay, [ no_trailing, ] callback ) ); - // > jQuery('selector').unbind( 'someevent', callback ); + // > jQuery('selector').on( 'someevent', jQuery.throttle( delay, [ no_trailing, ] callback ) ); + // > jQuery('selector').off( 'someevent', callback ); // // Arguments: // @@ -217,13 +216,12 @@ // // > var debounced = jQuery.debounce( delay, [ at_begin, ] callback ); // > - // > jQuery('selector').bind( 'someevent', debounced ); - // > jQuery('selector').unbind( 'someevent', debounced ); + // > jQuery('selector').on( 'someevent', debounced ); + // > jQuery('selector').off( 'someevent', debounced ); // - // This also works in jQuery 1.4+: // - // > jQuery('selector').bind( 'someevent', jQuery.debounce( delay, [ at_begin, ] callback ) ); - // > jQuery('selector').unbind( 'someevent', callback ); + // > jQuery('selector').on( 'someevent', jQuery.debounce( delay, [ at_begin, ] callback ) ); + // > jQuery('selector').off( 'someevent', callback ); // // Arguments: // diff --git a/rhodecode/public/js/src/plugins/jquery.pjax.js b/rhodecode/public/js/src/plugins/jquery.pjax.js index 8f9d2d53..f07aba1b 100644 --- a/rhodecode/public/js/src/plugins/jquery.pjax.js +++ b/rhodecode/public/js/src/plugins/jquery.pjax.js @@ -172,7 +172,7 @@ function handleSubmit(event, container, options) { function pjax(options) { options = $.extend(true, {}, $.ajaxSettings, pjax.defaults, options) - if ($.isFunction(options.url)) { + if (typeof options.url === 'function') { options.url = options.url() } @@ -187,7 +187,7 @@ function pjax(options) { // Without adding this secret parameter, some browsers will often // confuse the two. if (!options.data) options.data = {} - if ($.isArray(options.data)) { + if (Array.isArray(options.data)) { options.data.push({name: '_pjax', value: context.selector}) } else { options.data._pjax = context.selector @@ -505,7 +505,7 @@ function onPjaxPopstate(event) { // // Returns nothing since it retriggers a hard form submission. function fallbackPjax(options) { - var url = $.isFunction(options.url) ? options.url() : options.url, + var url = typeof options.url === 'function' ? options.url() : options.url, method = options.type ? options.type.toUpperCase() : 'GET' var form = $('
', { @@ -528,7 +528,7 @@ function fallbackPjax(options) { var pair = value.split('=') form.append($('', {type: 'hidden', name: pair[0], value: pair[1]})) }) - } else if ($.isArray(data)) { + } else if (Array.isArray(data)) { $.each(data, function(index, value) { form.append($('', {type: 'hidden', name: value.name, value: value.value})) }) @@ -539,7 +539,7 @@ function fallbackPjax(options) { } $(document.body).append(form) - form.submit() + form.trigger('submit') } // Internal: Abort an XmlHttpRequest if it hasn't been completed, @@ -910,9 +910,9 @@ function disable() { // Add the state property to jQuery's event object so we can use it in -// $(window).bind('popstate') -if ( $.inArray('state', $.event.props) < 0 ) - $.event.props.push('state') +// $(window).on('popstate') +if ( $.event && $.event.addProp ) + $.event.addProp('state') // Is pjax supported by this browser? $.support.pjax = diff --git a/rhodecode/public/js/src/plugins/jquery.scrollstop.js b/rhodecode/public/js/src/plugins/jquery.scrollstop.js index 33ac8e6d..30bc974a 100644 --- a/rhodecode/public/js/src/plugins/jquery.scrollstop.js +++ b/rhodecode/public/js/src/plugins/jquery.scrollstop.js @@ -52,10 +52,10 @@ }, _data.latency); }; - $(this).bind('scroll', handler).data(uid1, handler); + $(this).on('scroll', handler).data(uid1, handler); }, teardown: function() { - $(this).unbind('scroll', $(this).data(uid1)); + $(this).off('scroll', $(this).data(uid1)); } }; @@ -82,10 +82,10 @@ }, _data.latency); }; - $(this).bind('scroll', handler).data(uid2, handler); + $(this).on('scroll', handler).data(uid2, handler); }, teardown: function() { - $(this).unbind('scroll', $(this).data(uid2)); + $(this).off('scroll', $(this).data(uid2)); } }; })); diff --git a/rhodecode/public/js/src/plugins/jquery.timeago-extension.js b/rhodecode/public/js/src/plugins/jquery.timeago-extension.js index 11af1aa6..ab314d66 100644 --- a/rhodecode/public/js/src/plugins/jquery.timeago-extension.js +++ b/rhodecode/public/js/src/plugins/jquery.timeago-extension.js @@ -3,10 +3,10 @@ var AgeModule = (function () { return { age: function(prevdate, now, show_short_version, show_suffix, short_format) { - prevdate = DateTime.fromJSDate(prevdate, { zone: "utc" }); + prevdate = luxon.DateTime.fromJSDate(prevdate, { zone: "utc" }); now = now - ? DateTime.fromJSDate(now, { zone: "utc" }) - : DateTime.utc(); + ? luxon.DateTime.fromJSDate(now, { zone: "utc" }) + : luxon.DateTime.utc(); var show_short_version = show_short_version || false; var show_suffix = show_suffix || true; diff --git a/rhodecode/public/js/src/plugins/jquery.timeago.js b/rhodecode/public/js/src/plugins/jquery.timeago.js index 9cadc3f7..3464a3f0 100644 --- a/rhodecode/public/js/src/plugins/jquery.timeago.js +++ b/rhodecode/public/js/src/plugins/jquery.timeago.js @@ -94,7 +94,7 @@ var years = days / 365; function substitute(stringOrFunction, number) { - var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction; + var string = typeof stringOrFunction === 'function' ? stringOrFunction(number, distanceMillis) : stringOrFunction; var value = ($l.numbers && $l.numbers[number]) || number; return string.replace(/%d/i, value); } diff --git a/rhodecode/public/js/src/rhodecode.js b/rhodecode/public/js/src/rhodecode.js index 1aae54d3..4c87957c 100644 --- a/rhodecode/public/js/src/rhodecode.js +++ b/rhodecode/public/js/src/rhodecode.js @@ -30,7 +30,7 @@ if (typeof console == "undefined" || typeof console.log == "undefined"){ * show more */ var show_more_event = function(){ - $('table .show_more').click(function(e) { + $('table .show_more').on('click', function(e) { var cid = e.target.id.substring(1); var button = $(this); if (button.hasClass('open')) { @@ -65,7 +65,7 @@ var compare_radio_buttons = function(repo_name, compare_ref_type){ var source = $('input[name=compare_source]:checked').val(); var target = $('input[name=compare_target]:checked').val(); if(source && target){ - $('#compare_action').removeAttr("disabled"); + $('#compare_action').prop('disabled', false); $('#compare_action').removeClass("disabled"); } }) @@ -188,8 +188,8 @@ function collapsableContent() { $('.collapsable-content').not('.no-hide').hide(); - $('.btn-collapse').unbind(); //in case we've been here before - $('.btn-collapse').click(function() { + $('.btn-collapse').off(); //in case we've been here before + $('.btn-collapse').on('click', function() { var button = $(this); var togglename = $(this).data("toggle"); $('.collapsable-content[data-toggle='+togglename+']').toggle(); @@ -503,7 +503,7 @@ $(document).ready(function() { } }); - $('#expand_all_files').click(function() { + $('#expand_all_files').on('click', function() { $('.expand_file').each(function() { var node = $(this); var icon = $($(node.children().first()).children().first()); @@ -521,7 +521,7 @@ $(document).ready(function() { }); }); - $('#collapse_all_files').click(function() { + $('#collapse_all_files').on('click', function() { $('.collapse_file').each(function() { var node = $(this); var icon = $($(node.children().first()).children().first()); @@ -652,11 +652,11 @@ var feedLifetimeOptions = function(query, initialData){ if (isQuery) { - const now = DateTime.utc(); + const now = luxon.DateTime.utc(); var parseQuery = function(entry, now){ var fmt = 'dd/LL/yyyy H:mm'; - var parsed = DateTime.fromFormat(entry, fmt, { zone: "utc" }); + var parsed = luxon.DateTime.fromFormat(entry, fmt, { zone: "utc" }); var diffInMin = parsed.diff(now, "minutes").as("minutes"); if (diffInMin > 0){ diff --git a/rhodecode/public/js/src/rhodecode/codemirror.js b/rhodecode/public/js/src/rhodecode/codemirror.js index a3732429..9c2ac35c 100644 --- a/rhodecode/public/js/src/rhodecode/codemirror.js +++ b/rhodecode/public/js/src/rhodecode/codemirror.js @@ -349,12 +349,12 @@ var initCommentBoxCodeMirror = function(CommentForm, textAreaId, triggerActions) }; var submitForm = function(cm, pred) { - $(cm.display.input.textarea.form).find('.submit-comment-action').click(); + $(cm.display.input.textarea.form).find('.submit-comment-action').trigger('click'); return CodeMirror.Pass; }; var submitFormAsDraft = function(cm, pred) { - $(cm.display.input.textarea.form).find('.submit-draft-action').click(); + $(cm.display.input.textarea.form).find('.submit-draft-action').trigger('click'); return CodeMirror.Pass; }; diff --git a/rhodecode/public/js/src/rhodecode/comments.js b/rhodecode/public/js/src/rhodecode/comments.js index 64e25df3..5150d3b5 100644 --- a/rhodecode/public/js/src/rhodecode/comments.js +++ b/rhodecode/public/js/src/rhodecode/comments.js @@ -509,7 +509,7 @@ var _submitAjaxPOST = function(url, postData, successHandler, failHandler) { $(self.editButton).parent().removeClass('active'); }); - $(this.submitForm).submit(function(e) { + $(this.submitForm).on('submit', function(e) { e.preventDefault(); var allowedToSubmit = self.isAllowedToSubmit(); if (!allowedToSubmit){ @@ -551,7 +551,7 @@ var initVersionSelector = function(selector, initialData) { $(selector).on('select2-selecting', function (e) { // hide the mast as we later do preventDefault() - $("#select2-drop-mask").click(); + $("#select2-drop-mask").trigger('click'); e.preventDefault(); e.choice.action(); }); diff --git a/rhodecode/public/js/src/rhodecode/files.js b/rhodecode/public/js/src/rhodecode/files.js index 98cb2901..a8d2d604 100644 --- a/rhodecode/public/js/src/rhodecode/files.js +++ b/rhodecode/public/js/src/rhodecode/files.js @@ -552,7 +552,7 @@ var checkFileHead = function($editForm, commit_id, f_path, operation) { $editForm.find('#commit_btn').data('validHead', true); $editForm.find('#commit_btn').val('Committing...'); - $editForm.submit(); + $editForm.trigger('submit'); } else { var message = ''; diff --git a/rhodecode/public/js/src/rhodecode/menus.js b/rhodecode/public/js/src/rhodecode/menus.js index 5f7cd3e0..2186db8e 100644 --- a/rhodecode/public/js/src/rhodecode/menus.js +++ b/rhodecode/public/js/src/rhodecode/menus.js @@ -26,7 +26,7 @@ var quick_repo_menu = function() { $('.menu_items_container').hide(); $('.active_quick_repo').removeClass('active_quick_repo'); }; - $('.quick_repo_menu').hover(function() { + $('.quick_repo_menu').on('mouseenter', function() { hide_quick_repo_menus(); if (!$(this).hasClass('active_quick_repo')) { $('.menu_items_container', this).removeClass("hidden").show(); diff --git a/rhodecode/public/js/src/rhodecode/pullrequests.js b/rhodecode/public/js/src/rhodecode/pullrequests.js index 16d53583..08eacce0 100644 --- a/rhodecode/public/js/src/rhodecode/pullrequests.js +++ b/rhodecode/public/js/src/rhodecode/pullrequests.js @@ -44,7 +44,7 @@ var prButtonLock = function(lockEnabled, msg, scope) { $('#pr_submit').attr('disabled', 'disabled'); } else if (checksMeet) { - $('#pr_submit').removeAttr('disabled'); + $('#pr_submit').prop('disabled', false); } if (msg) { @@ -653,10 +653,10 @@ window.VersionController = function () { this.attachVersionListener = function () { - self.$verTarget.change(function (e) { + self.$verTarget.on('change', function (e) { self.adjustRadioSelectors(this) }); - self.$verSource.change(function (e) { + self.$verSource.on('change', function (e) { self.adjustRadioSelectors(self.$verTarget.filter(':checked')) }); }; @@ -679,7 +679,7 @@ window.VersionController = function () { $showVersionDiff.html($showVersionDiff.data('labelTextLocked')); } else { - $showVersionDiff.removeAttr('disabled'); + $showVersionDiff.prop('disabled', false); $showVersionDiff.removeClass('disabled'); if (selectedVersion == otherVersion) { diff --git a/rhodecode/public/js/src/rhodecode/utils/ajax.js b/rhodecode/public/js/src/rhodecode/utils/ajax.js index 45c03fe5..e6eae230 100644 --- a/rhodecode/public/js/src/rhodecode/utils/ajax.js +++ b/rhodecode/public/js/src/rhodecode/utils/ajax.js @@ -176,7 +176,7 @@ function submitConfirm(event, self, question, confirmText, htmlText) { confirmButtonText: confirmText }).then(function(result) { if (result.value) { - $(self).closest("form").submit(); + $(self).closest("form").trigger('submit'); } }) } \ No newline at end of file diff --git a/rhodecode/public/js/src/select2/select2.js b/rhodecode/public/js/src/select2/select2.js index 2d4a502c..276bee20 100755 --- a/rhodecode/public/js/src/select2/select2.js +++ b/rhodecode/public/js/src/select2/select2.js @@ -428,7 +428,7 @@ the specific language governing permissions and limitations under the Apache Lic if (handler && typeof handler.abort === "function") { handler.abort(); } if (options.params) { - if ($.isFunction(options.params)) { + if (typeof options.params === 'function') { $.extend(params, options.params.call(self)); } else { $.extend(params, options.params); @@ -481,12 +481,12 @@ the specific language governing permissions and limitations under the Apache Lic tmp, text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search - if ($.isArray(data)) { + if (Array.isArray(data)) { tmp = data; data = { results: tmp }; } - if ($.isFunction(data) === false) { + if (typeof data !== 'function') { tmp = data; data = function() { return tmp; }; } @@ -495,7 +495,7 @@ the specific language governing permissions and limitations under the Apache Lic if (dataItem.text) { text = dataItem.text; // if text is not a function we assume it to be a key name - if (!$.isFunction(text)) { + if (typeof data !== 'function') { dataText = dataItem.text; // we need to store this in a separate variable because in the next step data gets reset and data.text is no longer available text = function (item) { return item[dataText]; }; } @@ -535,11 +535,11 @@ the specific language governing permissions and limitations under the Apache Lic // TODO javadoc function tags(data) { - var isFunc = $.isFunction(data); + var isFunc = typeof data === 'function'; return function (query) { var t = query.term, filtered = {results: []}; var result = isFunc ? data(query) : data; - if ($.isArray(result)) { + if (Array.isArray(result)) { $(result).each(function () { var isObject = this.text !== undefined, text = isObject ? this.text : this; @@ -561,7 +561,7 @@ the specific language governing permissions and limitations under the Apache Lic * @param formatter */ function checkFormatter(formatter, formatterName) { - if ($.isFunction(formatter)) return true; + if (typeof formatter === 'function') return true; if (!formatter) return false; if (typeof(formatter) === 'string') return true; throw new Error(formatterName +" must be a string, function, or falsy value"); @@ -576,7 +576,7 @@ the specific language governing permissions and limitations under the Apache Lic * @returns {*} */ function evaluate(val, context) { - if ($.isFunction(val)) { + if (typeof val === 'function') { var args = Array.prototype.slice.call(arguments, 2); return val.apply(context, args); } @@ -816,7 +816,7 @@ the specific language governing permissions and limitations under the Apache Lic this.lastSearchTerm = undefined; - if ($.isFunction(this.opts.initSelection)) { + if (typeof this.opts.initSelection === 'function') { // initialize selection based on the current value of the source element this.initSelection(); @@ -1026,7 +1026,7 @@ the specific language governing permissions and limitations under the Apache Lic var elemTags = opts.element.data('tags'); // data-tags should actually be a boolean - if (!$.isArray(elemTags)) { + if (!Array.isArray(elemTags)) { elemTags = []; } @@ -1045,7 +1045,7 @@ the specific language governing permissions and limitations under the Apache Lic // ajax.results -> ajax.processResults if (opts.ajax != null) { - if ($.isFunction(opts.ajax.processResults)) { + if (typeof opts.ajax.processResults === 'function') { opts.ajax.results = opts.ajax.processResults; } } @@ -1055,32 +1055,32 @@ the specific language governing permissions and limitations under the Apache Lic var lang = opts.language; // formatNoMatches -> language.noMatches - if ($.isFunction(lang.noMatches)) { + if (typeof lang.noMatches === 'function') { opts.formatNoMatches = lang.noMatches; } // formatSearching -> language.searching - if ($.isFunction(lang.searching)) { + if (typeof lang.searching === 'function') { opts.formatSearching = lang.searching; } // formatInputTooShort -> language.inputTooShort - if ($.isFunction(lang.inputTooShort)) { + if (typeof lang.inputTooShort === 'function') { opts.formatInputTooShort = lang.inputTooShort; } // formatInputTooLong -> language.inputTooLong - if ($.isFunction(lang.inputTooLong)) { + if (typeof lang.inputTooLong === 'function') { opts.formatInputTooLong = lang.inputTooLong; } // formatLoading -> language.loadingMore - if ($.isFunction(lang.loadingMore)) { + if (typeof lang.loadingMore === 'function') { opts.formatLoading = lang.loadingMore; } // formatSelectionTooBig -> language.maximumSelected - if ($.isFunction(lang.maximumSelected)) { + if (typeof lang.maximumSelected === 'function') { opts.formatSelectionTooBig = lang.maximumSelected; } } @@ -1152,7 +1152,7 @@ the specific language governing permissions and limitations under the Apache Lic opts.id = function (e) { return e[idKey]; }; } - if ($.isArray(opts.element.data("select2Tags"))) { + if (Array.isArray(opts.element.data("select2Tags"))) { if ("tags" in opts) { throw "tags specified as both an attribute 'data-select2-tags' and in options of Select2 " + opts.element.attr("id"); } @@ -1217,7 +1217,7 @@ the specific language governing permissions and limitations under the Apache Lic $(splitVal(element.val(), opts.separator, opts.transformVal)).each(function () { var obj = { id: this, text: this }, tags = opts.tags; - if ($.isFunction(tags)) tags=tags(); + if (typeof tags === 'function') tags=tags(); $(tags).each(function() { if (equal(this.id, obj.id)) { obj = this; return false; } }); data.push(obj); }); @@ -1321,7 +1321,7 @@ the specific language governing permissions and limitations under the Apache Lic // some validation frameworks ignore the change event and listen instead to keyup, click for selects // so here we trigger the click event manually - this.opts.element.click(); + this.opts.element.trigger('click'); // ValidationEngine ignores the change event and listens instead to blur // so here we trigger the blur event manually if so desired @@ -1904,7 +1904,7 @@ the specific language governing permissions and limitations under the Apache Lic var maxSelSize = this.getMaximumSelectionSize(); if (maxSelSize >=1) { data = this.data(); - if ($.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) { + if (Array.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) { render("
  • " + evaluate(opts.formatSelectionTooBig, opts.element, maxSelSize) + "
  • "); return; } @@ -2116,7 +2116,7 @@ the specific language governing permissions and limitations under the Apache Lic } return null; - } else if ($.isFunction(this.opts.width)) { + } else if (typeof this.opts.width === 'function') { return this.opts.width(); } else { return this.opts.width; @@ -2530,7 +2530,7 @@ the specific language governing permissions and limitations under the Apache Lic } return is_match; }, - callback: !$.isFunction(callback) ? $.noop : function() { + callback: typeof callback !== 'function' ? $.noop : function() { callback(match); } }); @@ -2822,7 +2822,7 @@ the specific language governing permissions and limitations under the Apache Lic } return is_match; }, - callback: !$.isFunction(callback) ? $.noop : function() { + callback: typeof callback !== 'function' ? $.noop : function() { // reorder matches based on the order they appear in the ids array because right now // they are in the order in which they appear in data array var ordered = []; @@ -3642,7 +3642,7 @@ the specific language governing permissions and limitations under the Apache Lic id: function (e) { return e == undefined ? null : e.id; }, text: function (e) { if (e && this.data && this.data.text) { - if ($.isFunction(this.data.text)) { + if (typeof this.data.text === 'function') { return this.data.text(e); } else { return e[this.data.text]; diff --git a/rhodecode/templates/admin/auth/auth_settings.mako b/rhodecode/templates/admin/auth/auth_settings.mako index 1e430b34..22409ffc 100644 --- a/rhodecode/templates/admin/auth/auth_settings.mako +++ b/rhodecode/templates/admin/auth/auth_settings.mako @@ -96,7 +96,7 @@ diff --git a/rhodecode/templates/admin/repos/repo_edit_maintenance.mako b/rhodecode/templates/admin/repos/repo_edit_maintenance.mako index 662be268..0c3fb28a 100644 --- a/rhodecode/templates/admin/repos/repo_edit_maintenance.mako +++ b/rhodecode/templates/admin/repos/repo_edit_maintenance.mako @@ -57,7 +57,7 @@ executeTask = function() { $(displayHtml).append(data); $('#results').html(displayHtml); - btn.removeAttr('disabled'); + btn.prop('disabled', false); btn.removeClass('disabled'); }; ajaxGET(url, success, null); diff --git a/rhodecode/templates/admin/repos/repo_edit_strip.mako b/rhodecode/templates/admin/repos/repo_edit_strip.mako index ebc2647e..b27efe7f 100644 --- a/rhodecode/templates/admin/repos/repo_edit_strip.mako +++ b/rhodecode/templates/admin/repos/repo_edit_strip.mako @@ -187,7 +187,7 @@ checkCommits = function() { }; btn.html('Strip'); - btn.removeAttr('disabled'); + btn.prop('disabled', false); btn.removeClass('disabled'); btn.attr('onclick','strip();return false;'); ajaxPOST(url, postData, success, null); diff --git a/rhodecode/templates/admin/settings/settings_ai.mako b/rhodecode/templates/admin/settings/settings_ai.mako index 6e8e31e9..4c68763b 100644 --- a/rhodecode/templates/admin/settings/settings_ai.mako +++ b/rhodecode/templates/admin/settings/settings_ai.mako @@ -160,7 +160,7 @@ import json setAIFieldsActive(this.checked); }); - $updateModelsBtn.click(function () { + $updateModelsBtn.on('click', function () { const $apiKey = $('#rhodecode_ai_api_key input'); if (!$apiKey.val()) { @@ -211,7 +211,7 @@ import json }); - $form.submit(function () { + $form.on('submit', function () { let $f = $(this); let $tmpEnabled = $f.find(':disabled'); diff --git a/rhodecode/templates/admin/settings/settings_system.mako b/rhodecode/templates/admin/settings/settings_system.mako index 26d14104..edaf81c0 100644 --- a/rhodecode/templates/admin/settings/settings_system.mako +++ b/rhodecode/templates/admin/settings/settings_system.mako @@ -96,7 +96,7 @@