Plugin Directory

Changeset 2699794


Ignore:
Timestamp:
03/25/2022 09:41:32 PM (4 years ago)
Author:
bettersecurity
Message:

Fixed images and added passive event listeners option.

Location:
better-speed/trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • better-speed/trunk/better-speed.php

    r2675058 r2699794  
    33Plugin Name:  Why So Slow?
    44Description:  Improve the loading speed of your website by removing bloat and unused features <em>(formerly named <strong>Better Speed</strong>)</em>
    5 Version:      2.0
     5Version:      2.1
    66Author:       Why So Slow?
    77Author URI:   https://whysoslow.co.uk
     
    311311        }
    312312    }
     313
     314    //jQuery passive event listeners
     315    if(better_speed_check_other_setting('others-passive')) {
     316        wp_add_inline_script('jquery', 'jQuery.event.special.touchstart={setup:function(e,t,s){this.addEventListener("touchstart",s,{passive:!t.includes("noPreventDefault")})}},jQuery.event.special.touchmove={setup:function(e,t,s){this.addEventListener("touchmove",s,{passive:!t.includes("noPreventDefault")})}},jQuery.event.special.wheel={setup:function(e,t,s){this.addEventListener("wheel",s,{passive:!0})}},jQuery.event.special.mousewheel={setup:function(e,t,s){this.addEventListener("mousewheel",s,{passive:!0})}};', 'after');
     317    }
    313318}
    314319add_action('wp_enqueue_scripts', 'better_speed_wp_enqueue_scripts');
     
    397402
    398403  add_settings_section('better-speed-section-others', __('Settings', 'whysoslow'), 'better_speed_section_others', 'better-speed-others');
    399   add_settings_field('better-speed-others-timings', __('Server Timings', 'whysoslow'), 'better_speed_others_timings', 'better-speed-others', 'better-speed-section-others');
     404  add_settings_field('better-speed-others-timings', __('Add Server Timings', 'whysoslow'), 'better_speed_others_timings', 'better-speed-others', 'better-speed-section-others');
     405  add_settings_field('better-speed-others-passive', __('Use Passive Listeners', 'whysoslow'), 'better_speed_others_passive', 'better-speed-others', 'better-speed-section-others');
    400406
    401407  add_settings_section('better-speed-section-instant', __('Instant Page', 'whysoslow'), 'better_speed_section_instant', 'better-speed-instant');
     
    423429  $whitelist_options['better-speed'][] = 'better-speed-features-revisions';
    424430  $whitelist_options['better-speed'][] = 'better-speed-others-timings';
     431  $whitelist_options['better-speed'][] = 'better-speed-others-passive';
    425432  $whitelist_options['better-speed'][] = 'better-speed-instant-page';
    426433  $whitelist_options['better-speed'][] = 'better-speed-instant-intensity';
     
    558565  echo '    </div>';
    559566  echo '    <div id="better-speed-tabs-recommend">';
    560   echo '      <a class="better-speed-recommendation" href="https://wp-rocket.me/?ref=dfdb22ef" target="_blank">';
     567  echo '      <a class="better-speed-recommendation" href="https://flying-press.com/?campaign=betterspeed&ref=sifz" target="_blank">';
     568  echo '        <img src="' . plugins_url('images/flyingpress.svg', __FILE__) . '" width="172px" height="28px" align="left">';
     569  echo '        <h3><u>' . __('FlyingPress', 'whysoslow') . '</u> <small><em>(plugin)</em></small></h3>';
     570  echo '        <p>' . __('FlyingPress is a lightweight, easy to use and configurable speed optimization plugin for WordPress. Boost your websites&apos; Core Web Vitals in a few clicks.', 'whysoslow') . '</p>';
     571  echo '      </a>';
     572    echo '      <br>';
     573  echo '      <a class="better-speed-recommendation" href="https://shareasale.com/r.cfm?b=1075949&u=2391583&m=74778" target="_blank">';
    561574  echo '        <img src="' . plugins_url('images/wprocket.png', __FILE__) . '" width="172px" height="46px" align="left">';
    562575  echo '        <h3><u>' . __('WP Rocket', 'whysoslow') . '</u> <small><em>(plugin)</em></small></h3>';
    563576  echo '        <p>' . __('WP Rocket is the most powerful web performance plugin in the world. It will instantly reduce your load time and boost your Google PageSpeed and Core Web Vitals scores. No coding skills needed.', 'whysoslow') . '</p>';
     577  echo '      </a>';
     578    echo '      <br>';
     579  echo '      <a class="better-speed-recommendation" href="https://rocketcdn.me/?ref=betterspeed" target="_blank">';
     580  echo '        <img src="' . plugins_url('images/wprocket.png', __FILE__) . '" width="172px" height="46px" align="left">';
     581  echo '        <h3><u>' . __('RocketCDN', 'whysoslow') . '</u> <small><em>(CDN)</em></small></h3>';
     582  echo '        <p>' . __('RocketCDN is a custom Content Delivery Network created by the WP Rocket team. It provides fast content delivery anywhere in the world and reduces website loading time, making a website faster for visitors far away from where the server is located.', 'whysoslow') . '</p>';
    564583  echo '      </a>';
    565584    echo '      <br>';
     
    885904        $checked = " checked";
    886905    }
    887   echo '<label><input id="better-speed-others-timings" name="better-speed-settings[better-speed-others-timings]" type="checkbox" value="YES"' . $checked . '> ' . __('Add <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing" target="_blank" rel="noopener">Server Timing</a> headers to aid debugging', 'whysoslow');
     906  echo '<label><input id="better-speed-others-timings" name="better-speed-settings[better-speed-others-timings]" type="checkbox" value="YES"' . $checked . '> ' . __('Add <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing" target="_blank" rel="noopener">Server Timing</a> headers - this won&apos;t speed things up but can aid debugging', 'whysoslow');
     907}
     908
     909//defined output for settings
     910function better_speed_others_passive() {
     911    $checked = "";
     912    if(better_speed_check_other_setting('others-passive')) {
     913        $checked = " checked";
     914    }
     915  echo '<label><input id="better-speed-others-passive" name="better-speed-settings[better-speed-others-passive]" type="checkbox" value="YES"' . $checked . '> ' . __('Use <a href="https://web.dev/uses-passive-event-listeners/" target="_blank" rel="noopener">passive listeners</a> to improve scrolling performance', 'whysoslow');
    888916}
    889917
Note: See TracChangeset for help on using the changeset viewer.