Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/wp-rocket/assets/js/cpcss-removal.js

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + function wprRemoveCPCSS() {
2 + let preload_stylesheets = document.querySelectorAll( 'link[data-rocket-async="style"][rel="preload"]' );
3 + if ( preload_stylesheets && preload_stylesheets.length > 0 ) {
4 + for ( let stylesheet_index = 0;stylesheet_index < preload_stylesheets.length;stylesheet_index++ ){
5 + let media = preload_stylesheets[stylesheet_index].getAttribute('media') || 'all';
6 + if( window.matchMedia(media).matches ){
7 + setTimeout( wprRemoveCPCSS, 200 );
8 + return;
9 + }
10 + }
11 + }
12 +
13 + const elem = document.getElementById( 'rocket-critical-css' );
14 + if ( elem && 'remove' in elem ) {
15 + elem.remove();
16 + }
17 + }
18 +
19 + if ( window.addEventListener ) {
20 + window.addEventListener( 'load', wprRemoveCPCSS );
21 + } else if ( window.attachEvent ) {
22 + window.attachEvent( 'onload', wprRemoveCPCSS );
23 + }
24 +