Skip to content

Commit

Permalink
Update jQuery to v3.7
Browse files Browse the repository at this point in the history
Update to latest version of jQuery and removed all possible jQuery deprecations. Some jQuery plugins still have deprecations, but they are going to work with v3.7.
  • Loading branch information
sascha-karnatz committed Nov 2, 2023
1 parent bbeb6e5 commit ac965c6
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/alchemy/admin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Alchemy CMS Sprockets Manifest
// ------------------------------
//= require jquery2
//= require jquery3
//= require jquery_ujs
//= require jquery-ui/widgets/draggable
//= require jquery-ui/widgets/sortable
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/alchemy/alchemy.growler.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Alchemy.Growler =

fade: ->
$(".flash:not(.error)", "#flash_notices").delay(5000).queue(-> Alchemy.Growler.dismiss(this))
$(".flash", "#flash_notices").click((e) => @dismiss(e.currentTarget))
$(".flash", "#flash_notices").on("click", (e) => @dismiss(e.currentTarget))
return

dismiss: (element) ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Alchemy.PreviewWindow =
$iframe = $("<iframe name=\"alchemy_preview_window\" src=\"#{@previewUrl}\" id=\"alchemy_preview_window\" frameborder=\"0\"/>")
$reload = $('#reload_preview_button')
@_showSpinner()
$iframe.load =>
$iframe.on "load", =>
@_hideSpinner()
$('body').append($iframe)
@currentWindow = $iframe
Expand All @@ -31,7 +31,7 @@ Alchemy.PreviewWindow =
@_showSpinner()
# We need to be sure that no load event is binded on the preview frame.
$iframe.off('load')
$iframe.load (e) =>
$iframe.on "load", (e) =>
@_hideSpinner()
if callback
callback.call(e, $iframe)
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/alchemy_admin/dirty.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function checkPageDirtyness(element) {
}

function PageLeaveObserver() {
$("#main_navi a").click(function (event) {
$("#main_navi a").on("click", function (event) {
if (!checkPageDirtyness(event.currentTarget)) {
event.preventDefault()
}
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/alchemy_admin/image_cropper.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ export default class ImageCropper {
}

bind() {
this.dialog.dialog_body.find('button[type="submit"]').click(() => {
this.dialog.dialog_body.find('button[type="submit"]').on("click", () => {
Alchemy.setElementDirty(`[data-element-id='${this.elementId}']`)
this.dialog.close()
return false
})
this.dialog.dialog_body.find('button[type="reset"]').click(() => {
this.dialog.dialog_body.find('button[type="reset"]').on("click", () => {
this.reset()
return false
})
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/alchemy_admin/initializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function Initialize() {
// Add observer for please wait overlay.
$(".please_wait, .button_with_label form :submit")
.not("*[data-alchemy-confirm]")
.click(Alchemy.pleaseWaitOverlay)
.on("click", Alchemy.pleaseWaitOverlay)

// Hack for enabling tab focus for <a>'s styled as button.
$("a.button").attr({ tabindex: 0 })
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/alchemy_admin/tags_autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function initSelection(element, callback) {
const data = []
$(element.val().split(",")).each(function () {
data.push({
id: $.trim(this),
id: this.trim(),
text: this
})
})
Expand Down
2 changes: 1 addition & 1 deletion app/views/alchemy/admin/pictures/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
e.preventDefault;
return false;
});
$('.thumbnail_background').click(function(event) {
$('.thumbnail_background').on("click", function(event) {
var url = $(this).attr('href');
var overlay = new Alchemy.ImageOverlay(url);
overlay.open();
Expand Down
2 changes: 1 addition & 1 deletion app/views/alchemy/base/500.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<script>
$(function(){
$('.error_details--toggle').click(function(){
$('.error_details--toggle').on("click", function(){
$('.error.message p').toggleClass('hidden');
return false;
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"jest": "^29.6.4",
"jest-environment-jsdom": "^29.6.4",
"jsdom-testing-mocks": "^1.11.0",
"jquery": "^2.2.4",
"jquery": "^3.7.1",
"lodash-es": "^4.17.21",
"prettier": "^3.0.0",
"sortablejs": "^1.10.2",
Expand Down

0 comments on commit ac965c6

Please sign in to comment.