Plugin Directory

Changeset 2942418


Ignore:
Timestamp:
07/24/2023 09:15:36 AM (3 years ago)
Author:
siteimprove
Message:

Version 2.0.3

Location:
siteimprove
Files:
29 added
4 edited

Legend:

Unmodified
Added
Removed
  • siteimprove/trunk/admin/class-siteimprove-admin.php

    r2929010 r2942418  
    101101    public function enqueue_scripts() {
    102102        wp_enqueue_script( 'siteimprove_admin_js', plugin_dir_url( __FILE__ ) . 'js/siteimprove-admin.js', array( 'jquery' ), $this->version, false );
     103    }
     104
     105
     106    /**
     107     * Siteimprove Preview - Enqueue this script to empty #wp-admin-bar
     108     */
     109    public function siteimprove_preview() {
     110        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/siteimprove-remove-adminbar.js', array( 'jquery' ), $this->version, false );
    103111    }
    104112
     
    181189            }
    182190        }
    183 
    184         wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/siteimprove.js', array( 'jquery' ), $this->version, false );
    185         wp_enqueue_script( 'siteimprove_overlay', $overlay_path, array(), $this->version, true );
     191        if ( ! isset( $_GET['si_preview'] ) || '0' === $_GET['si_preview'] ) {
     192            wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/siteimprove.js', array( 'jquery' ), $this->version, false );
     193            wp_enqueue_script( 'siteimprove_overlay', $overlay_path, array(), $this->version, true );
     194        }
    186195        $public_url = get_option( 'siteimprove_public_url' );
    187196
  • siteimprove/trunk/includes/class-siteimprove.php

    r2919146 r2942418  
    146146
    147147        // Siteimprove Actions.
    148         if ( ! isset( $_GET['si_preview'] ) || '0' === $_GET['si_preview'] ) {
     148        if ( isset( $_GET['si_preview'] ) || '1' === $_GET['si_preview'] ) {
     149            $this->loader->add_action( 'wp_head', $plugin_admin, 'siteimprove_preview' );
     150        } else {
    149151            $this->loader->add_action( 'admin_init', $plugin_admin, 'siteimprove_init' );
    150152            $this->loader->add_action( 'publish_page', $plugin_admin, 'siteimprove_save_session_url_post' );
  • siteimprove/trunk/readme.txt

    r2929010 r2942418  
    8787== Changelog ==
    8888
     89= 2.0.3 =
     90* Bugfix - When doing prepublish, the si-preview empties the wp-admin-bar instead of removing it, which improves highlight selectors
     91
    8992= 2.0.2 =
    9093* Added - Calling "clear" on non-content pages in WordPress
  • siteimprove/trunk/siteimprove.php

    r2929010 r2942418  
    1010 * Plugin URI:          https://www.siteimprove.com/integrations/cms-plugin/wordpress/
    1111 * Description:         Integration with Siteimprove.
    12  * Version:             2.0.2
     12 * Version:             2.0.3
    1313 * Author:              Siteimprove
    1414 * Author URI:          http://www.siteimprove.com/
     
    2424    die;
    2525}
    26 
    27 /**
    28  * Hide the WordPress admin bar when the `si_preview` parameter is present.
    29  */
    30 function si_preview() {
    31     if ( isset( $_GET['si_preview'] ) && '1' === $_GET['si_preview'] ) {
    32         add_filter( 'show_admin_bar', '__return_false' );
    33     }
    34 }
    35 add_action( 'parse_query', 'si_preview' );
    3626
    3727/**
Note: See TracChangeset for help on using the changeset viewer.