Changeset 57024 for branches/6.4
- Timestamp:
- 10/27/2023 08:05:57 PM (14 months ago)
- Location:
- branches/6.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.4
-
branches/6.4/src/js/_enqueues/admin/common.js
r56810 r57024 2130 2130 * Freeze animated plugin icons when reduced motion is enabled. 2131 2131 * 2132 * When the user has enabled the 'prefers-reduced-motion' setting, this module 2133 * stops animations for all GIFs on the page with the class 'plugin-icon' or 2132 * When the user has enabled the 'prefers-reduced-motion' setting, this module 2133 * stops animations for all GIFs on the page with the class 'plugin-icon' or 2134 2134 * plugin icon images in the update plugins table. 2135 2135 * … … 2157 2157 var height = img.height; 2158 2158 var canvas = document.createElement( 'canvas' ); 2159 2159 2160 2160 // Set canvas dimensions. 2161 2161 canvas.width = width; … … 2220 2220 // Listen for jQuery AJAX events. 2221 2221 ( function( $ ) { 2222 $( document ).ajaxComplete( function( event, xhr, settings ) { 2223 // Check if this is the 'search-install-plugins' request. 2224 if ( settings.data && settings.data.includes( 'action=search-install-plugins' ) ) { 2225 // Recheck if the user prefers reduced motion. 2226 if ( window.matchMedia ) { 2227 var mediaQuery = window.matchMedia( '(prefers-reduced-motion: reduce)' ); 2228 if ( mediaQuery.matches ) { 2229 pub.freezeAll(); 2230 } 2231 } else { 2232 // Fallback for browsers that don't support matchMedia. 2233 if ( true === priv.pauseAll ) { 2234 pub.freezeAll(); 2222 if ( window.pagenow === 'plugin-install' ) { 2223 // Only listen for ajaxComplete if this is the plugin-install.php page. 2224 $( document ).ajaxComplete( function( event, xhr, settings ) { 2225 2226 // Check if this is the 'search-install-plugins' request. 2227 if ( settings.data && typeof settings.data === 'string' && settings.data.includes( 'action=search-install-plugins' ) ) { 2228 // Recheck if the user prefers reduced motion. 2229 if ( window.matchMedia ) { 2230 var mediaQuery = window.matchMedia( '(prefers-reduced-motion: reduce)' ); 2231 if ( mediaQuery.matches ) { 2232 pub.freezeAll(); 2233 } 2234 } else { 2235 // Fallback for browsers that don't support matchMedia. 2236 if ( true === priv.pauseAll ) { 2237 pub.freezeAll(); 2238 } 2235 2239 } 2236 2240 } 2237 } 2238 } );2241 } ); 2242 } 2239 2243 } )( jQuery ); 2240 2244
Note: See TracChangeset
for help on using the changeset viewer.