It seems it still is problematic in 5.0.3.
There’s still
jQuery(document).ready(function(){
function shortpixel_notice_dismiss(event) {
event.preventDefault();
var ev = event.detail;
var target = event.target;
var parent = target.parentElement;
console.log(ev);
var data = {
'plugin_action': 'dismiss',
'action' : 'ShortPixel-notices',
'nonce' : '9728a764b6',
}
data.time = target.getAttribute('data-dismiss');
data.id = parent.getAttribute('id');
jQuery.post("https:\/\/www.amperagemarketing.com\/wp-admin\/admin-ajax.php",data);
$(parent).fadeTo(100,0,function() {
$(parent).slideUp(100, 0, function () {
$(parent).remove();
})
});
} jQuery("#Error100").find(".notice-dismiss").on("click", shortpixel_notice_dismiss);
});
being loaded onto the page where it has $
used in various spots that should be switched to jQuery
as JS debug still shows the Uncaught TypeError: $ is not a function
error when trying to dismiss a ShortPixel notice in the site admin (it then pointing specifically to the shortpixel_notice_dismiss()
function containing the problematic code.)
There’s also:
var el = document.getElementById('$id');
var el = document.getElementById('$id');
$(el).fadeTo(100,0,function() {
jQuery(el).fadeTo(100,0,function() {
$(el).slideUp(100, 0, function () {
jQuery(el).slideUp(100, 0, function () {
$(el).remove();
jQuery(el).remove();
})
which may cause a similar $
issue due to jQuery noconflict or some other $
conflict.
My guess is that switching out that code for:
jQuery(document).ready(function(){
function shortpixel_notice_dismiss(event) {
event.preventDefault();
var ev = event.detail;
var target = event.target;
var parent = target.parentElement;
console.log(ev);
var data = {
'plugin_action': 'dismiss',
'action' : 'ShortPixel-notices',
'nonce' : '9728a764b6',
}
data.time = target.getAttribute('data-dismiss');
data.id = parent.getAttribute('id');
jQuery.post("https:\/\/www.amperagemarketing.com\/wp-admin\/admin-ajax.php",data);
jQuery(parent).fadeTo(100,0,function() {
jQuery(parent).slideUp(100, 0, function () {
jQuery(parent).remove();
})
});
} jQuery("#Error100").find(".notice-dismiss").on("click", shortpixel_notice_dismiss);
});
as well as:
var el = document.getElementById('$id');
jQuery(el).fadeTo(100,0,function() {
jQuery(el).slideUp(100, 0, function () {
jQuery(el).remove();
})
respectively will address the issue (again just swap out the few remaining instances of $
in the script for jQuery
with the .fadeTo
, .slideUp
, and .remove
functions that are called after the .post
AJAX call completes.)