51 parsed.errors = true; |
51 parsed.errors = true; |
52 } ).length ) { response.errors = false; } |
52 } ).length ) { response.errors = false; } |
53 parsed.responses.push( response ); |
53 parsed.responses.push( response ); |
54 } ); |
54 } ); |
55 if ( err.length ) { |
55 if ( err.length ) { |
56 re.html( '<div class="error">' + err + '</div>' ); |
56 re.html( '<div class="notice notice-error" role="alert">' + err + '</div>' ); |
57 wp.a11y.speak( err ); |
57 wp.a11y.speak( err ); |
58 } else if ( noticeMessage.length ) { |
58 } else if ( noticeMessage.length ) { |
59 re.html( '<div class="updated notice is-dismissible"><p>' + noticeMessage + '</p></div>'); |
59 re.html( '<div class="notice notice-success is-dismissible" role="alert"><p>' + noticeMessage + '</p></div>'); |
60 jQuery(document).trigger( 'wp-updates-notice-added' ); |
60 jQuery(document).trigger( 'wp-updates-notice-added' ); |
61 wp.a11y.speak( noticeMessage ); |
61 wp.a11y.speak( noticeMessage ); |
62 } |
62 } |
63 return parsed; |
63 return parsed; |
64 } |
64 } |
65 if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); } |
65 if ( isNaN( x ) ) { |
66 x = parseInt(x,10); |
66 wp.a11y.speak( x ); |
67 if ( -1 === x ) { return !re.html('<div class="error"><p>' + wpAjax.noPerm + '</p></div>'); } |
67 return ! re.html( '<div class="notice notice-error" role="alert"><p>' + x + '</p></div>' ); |
68 else if ( 0 === x ) { return !re.html('<div class="error"><p>' + wpAjax.broken + '</p></div>'); } |
68 } |
|
69 x = parseInt( x, 10 ); |
|
70 if ( -1 === x ) { |
|
71 wp.a11y.speak( wpAjax.noPerm ); |
|
72 return ! re.html( '<div class="notice notice-error" role="alert"><p>' + wpAjax.noPerm + '</p></div>' ); |
|
73 } else if ( 0 === x ) { |
|
74 wp.a11y.speak( wpAjax.broken ); |
|
75 return ! re.html( '<div class="notice notice-error" role="alert"><p>' + wpAjax.broken + '</p></div>' ); |
|
76 } |
69 return true; |
77 return true; |
70 }, |
78 }, |
71 invalidateForm: function ( selector ) { |
79 invalidateForm: function ( selector ) { |
72 return jQuery( selector ).addClass( 'form-invalid' ).find('input').one( 'change wp-check-valid-field', function() { jQuery(this).closest('.form-invalid').removeClass( 'form-invalid' ); } ); |
80 return jQuery( selector ).addClass( 'form-invalid' ).find('input').one( 'change wp-check-valid-field', function() { jQuery(this).closest('.form-invalid').removeClass( 'form-invalid' ); } ); |
73 }, |
81 }, |