From 92eff0d88131a983fc6da07740ba53e2d21cfce0 Mon Sep 17 00:00:00 2001 From: Scott Kingsley Clark Date: Mon, 1 Feb 2021 21:44:01 -0600 Subject: [PATCH] jQuery fixes and update compatibility --- admin/handlers.php | 9 ++++----- admin/new.php | 2 +- readme.txt | 4 +++- scripts/gigpress-admin.js | 36 ++++++++++++++++++------------------ scripts/gigpress.js | 10 +++++----- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/admin/handlers.php b/admin/handlers.php index 17898b6..868eec1 100644 --- a/admin/handlers.php +++ b/admin/handlers.php @@ -320,11 +320,12 @@ function gigpress_update_show() { $updateshow = $wpdb->update(GIGPRESS_SHOWS, $show, $where, $format, $where_format); // Was the query successful? - if($updateshow != FALSE) - { + if ( false === $updateshow ) { ?> +

+ -

' . __("Edit the related post", "gigpress"). '.'); ?>

+

' . __("Edit the related post", "gigpress"). '.');} ?>

- -

-
+ diff --git a/readme.txt b/readme.txt index ea8c7a7..641a1f7 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: theeventscalendar, brianjessee, camwynsp, paulkim, sc0ttkclark, aguseo, bordoni, borkweb, GeoffBel, jentheo, leahkoerper, lucatume, neillmcshea, patriciahillebrandt, vicskf, zbtirrell, juanfra Tags: concerts, bands, tours, shows, record labels, music, musicians, performers, artists Requires at least: 4.5 -Tested up to: 5.4 +Tested up to: 5.6 Stable tag: 2.3.25 GigPress is a live performance listing and management plugin that's been serving musicians and performers since 2007. @@ -38,6 +38,8 @@ If you want to go beyond GigPress, we also have other plugins that could work gr = 2.3.25 [2021-02-01] = +* Fix - When saving an existing show, it now correctly loads the show edit form again with success message. +* Fix - A few jQuery problems for WordPress 5.6 compatibility. * Fix - Support differently named plugin folders instead of hardcoding checks for `/gigpress/`. [GP-8] * Fix - Prevent PHP warnings for CSV exports. [GP-9] * Tweak - Added the possibility to view and restore deleted shows. [GP-6] diff --git a/scripts/gigpress-admin.js b/scripts/gigpress-admin.js index 33b7246..a9a59e4 100644 --- a/scripts/gigpress-admin.js +++ b/scripts/gigpress-admin.js @@ -1,23 +1,23 @@ $gp=jQuery.noConflict(); -$gp(document).ready(function() +$gp(function() { // If we're using the 12-hour clock, then do this magic if ( $gp('select#gp_hh.twelve').length > 0 ) { var time = $gp('select#gp_hh option:selected').parent().attr('label'); $gp('span#ampm').text(time); - - $gp('select#gp_hh.twelve').change(function() + + $gp('select#gp_hh.twelve').on('change',function() { var time = $gp('select#gp_hh option:selected').parent().attr('label'); $gp('span#ampm').text(time); } ); } - + $gp('tr.gigpress-inactive, tbody.gigpress-inactive').hide(); - - $gp('input#show_multi').click(function() + + $gp('input#show_multi').on('click',function() { // $gp('tr#expire').toggle(); // Workaround for IE 8 nonsense @@ -25,8 +25,8 @@ $gp(document).ready(function() this.blur(); } ); - - $gp('select.can-add-new').change(function() + + $gp('select.can-add-new').on('change',function() { var scope = $gp(this); var target = $gp(this).attr('id') + '_new'; @@ -37,7 +37,7 @@ $gp(document).ready(function() } } ); - + // Return a helper with preserved width of cells var fixHelper = function(e, ui) { ui.children().each(function() { @@ -45,24 +45,24 @@ $gp(document).ready(function() }); return ui; }; - + // Sortable artist table $gp('img.gp-sort-handle').show(); $gp('.gigpress-artist-sort').sortable({ - handle: '.gp-sort-handle', + handle: '.gp-sort-handle', axis: 'y', helper: fixHelper, - update : function () { + update : function () { var order = $gp('.gigpress-artist-sort').sortable('serialize'); $gp("#artist-sort-update").load(ajaxurl, order + '&action=gigpress_reorder_artists&cachebuster=' + Math.floor(Math.random()*99999), function() { - $gp("#artist-sort-update").fadeIn(100, function(){$gp(this).fadeOut(1500)}); + $gp("#artist-sort-update").fadeIn(100, function(){$gp(this).fadeOut(1500)}); } - ); - } + ); + } }); - - // Remove the "Manual Offset" optgroup from the timezone menu - $gp('select[name="gigpress_settings[timezone]"] optgroup').last().remove(); + + // Remove the "Manual Offset" optgroup from the timezone menu + $gp('select[name="gigpress_settings[timezone]"] optgroup').last().remove(); } ); \ No newline at end of file diff --git a/scripts/gigpress.js b/scripts/gigpress.js index 0983d6b..8bd7ca7 100644 --- a/scripts/gigpress.js +++ b/scripts/gigpress.js @@ -1,14 +1,14 @@ -jQuery(document).ready(function($) { +jQuery(function($) { $.fn.fadeToggle = function(speed, easing, callback) { - return this.animate({opacity: "toggle"}, speed, easing, callback); - }; - $("a.gigpress-links-toggle").click(function() { + return this.animate({opacity: "toggle"}, speed, easing, callback); + }; + $("a.gigpress-links-toggle").on('click',function() { target = $(this).attr("href").replace(document.location.href,''); $(target).fadeToggle("fast"); $(this).toggleClass("gigpress-link-active"); return false; }); - $("select.gigpress_menu").change(function() + $("select.gigpress_menu").on('change',function() { window.location = $(this).val(); });