Plugin Directory

Changeset 3067718


Ignore:
Timestamp:
04/09/2024 01:56:16 PM (2 years ago)
Author:
electronart
Message:

Improved SERP Scroll Behaviour during paging, along with reliability improvement loading SERP.

Location:
site-search-one/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • site-search-one/trunk/README.txt

    r3066955 r3067718  
    7676== Changelog ==
    7777
    78 = 2.0.0.3525 (2024-04-08) =
     78= 2.0.0.3535 (2024-04-09) =
    7979
    80 * Fix: Bug when WP Dark Mode not installed.
     80* Enhancement: Improved scroll behaviour when navigating search result pages.
     81* Enhancement: Improved error handling when displaying search page.
  • site-search-one/trunk/admin/class-site-search-one-tokens.php

    r2860974 r3067718  
    9090     * @return string|null
    9191     */
    92     public static function issue_token( $attempt = 1 ) {
     92    public static function issue_token( $attempt = 1, $allow_retry = true ) {
    9393        //phpcs:disable WordPress.DB.DirectDatabaseQuery
    9494        //phpcs:disable WordPress.DB.PreparedSQL.NotPrepared
     
    109109        } else {
    110110            // Ran out of tokens. Attempt to get more if this is 1st attempt.
    111             if ( 1 === $attempt ) {
     111            if ( 1 === $attempt  && $allow_retry === true ) {
    112112                Site_Search_One_Debugging::log( 'SS1-WARNING Ran out of tokens - Cron not running?' );
    113113                self::request_more_tokens();
  • site-search-one/trunk/changelog.txt

    r3066955 r3067718  
    11== Changelog ==
     2
     3= 2.0.0.3525 (2024-04-08) =
     4
     5* Fix: Bug when WP Dark Mode not installed.
    26
    37= 2.0.0.3523 (2024-04-08) =
  • site-search-one/trunk/public/ss1-searchpage-iframe.php

    r3066955 r3067718  
    182182
    183183            if (event.data) {
     184                if (event.data.action === 'SS1-Scroll-To-Top-Of-SearchPage') {
     185
     186                    let iframeOffset    = $('#ss1-search-page').offset().top;
     187                    let adminBarHeight = 0;
     188                    if ( $('#wpadminbar').length ) {
     189                        // admin bar on page. This can overlap and hide the result count.
     190                        adminBarHeight  = $('#wpadminbar').height();
     191                    }
     192                    let resultsOffset   = event.data.resultsOffset;
     193
     194                    let totalOffset = iframeOffset + resultsOffset - adminBarHeight;
     195
     196                    window.scrollTo({
     197                        top: totalOffset,
     198                        behavior: 'instant'
     199                    });
     200                }
    184201                if (event.data.action === 'SS1-HV-Overlay-Show') {
    185202                    // Show the hitviewer.
  • site-search-one/trunk/site-search-one.php

    r3066955 r3067718  
    1616 * Plugin URI:        https://sitesearchone.com
    1717 * Description:       WordPress Site Search Powered by dtSearch
    18  * Version:           2.0.0.3525
     18 * Version:           2.0.0.3535
    1919 * Author:            ElectronArt Design Ltd
    2020 * Author URI:        https://profiles.wordpress.org/electronart/
     
    4242 * Plugin Build Number
    4343 */
    44 define( 'SITE_SEARCH_ONE_BUILD', '3525' );
     44define( 'SITE_SEARCH_ONE_BUILD', '3535' );
    4545
    4646/**
  • site-search-one/trunk/templates/site-search-one-searchpage-bs5.php

    r2953321 r3067718  
    7070
    7171require_once plugin_dir_path( __FILE__ ) . '../admin/class-site-search-one-tokens.php';
    72 $token = Site_Search_One_Tokens::issue_token();
    73 if ( $sp_post_id && $token ) {
     72$token = Site_Search_One_Tokens::issue_token( 1, false );
     73if ($token === null) {
     74    $token = 'invalid'; // At least allow search page to load. Fetch a valid token after initial load.
     75}
     76if ( $sp_post_id ) {
    7477    // Page is set correctly. We now proceed to fetch what Categories should be shown on this page.
    7578    require_once plugin_dir_path( __FILE__ ) . '../admin/class-site-search-one-search-page.php';
     
    22302233                        current_page = parseInt($(this).attr('data-page'));
    22312234                        display_results(false);
     2235                        request_scroll_to_first_results();
    22322236                        return false;
    22332237                    });
     
    22572261                        current_page++;
    22582262                        display_results(false);
     2263                        request_scroll_to_first_results();
    22592264                    }).attr('href','javascript:void(0);');
    22602265
     
    22632268                        current_page = last_page;
    22642269                        display_results(false);
     2270                        request_scroll_to_first_results();
    22652271                    }).attr('href','javascript:void(0);');
    22662272
     
    22682274                        current_page--;
    22692275                        display_results(false);
     2276                        request_scroll_to_first_results();
    22702277                    }).attr('href','javascript:void(0);');
    22712278
     
    22732280                        current_page = 1;
    22742281                        display_results(false);
     2282                        request_scroll_to_first_results();
    22752283                    }).attr('href','javascript:void(0);');
    22762284                    //endregion
     
    23062314                }
    23072315            );
     2316        }
     2317
     2318        // Called during page changes.
     2319        function request_scroll_to_first_results() {
     2320            let topOffset = $('#info-display').offset().top;
     2321            window.parent.postMessage({
     2322                'action': 'SS1-Scroll-To-Top-Of-SearchPage',
     2323                'resultsOffset': topOffset
     2324            }, "*");
    23082325        }
    23092326
Note: See TracChangeset for help on using the changeset viewer.