Plugin Directory


Ignore:
Timestamp:
10/13/2026 02:57:34 AM (2 weeks ago)
Author:
avakodeforge
Message:

Release 1.2.10 (trunk + tag; see readme changelog)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • langforge/trunk/admin/class-strings-screen.php

    r3742586 r3742801  
    6666    /** The box with the "Find WooCommerce strings" button (drawn where WooCommerce runs). */
    6767    public static function render_find_box() {
     68        // A pass that stopped before it was done leaves its place on the server: the button goes on from there.
     69        $stopped = LANGFORGE_Woo_Strings::instance()->saved_place() !== null;
    6870        ?>
    6971        <div class="lf-find-woo">
    7072            <button type="button" class="button" id="lf-find-woo-strings"><?php esc_html_e('Find WooCommerce strings', 'langforge'); ?></button>
    7173            <span id="lf-find-woo-status" class="lf-find-woo-status" role="status" aria-live="polite"></span>
     74            <?php if ($stopped) : ?>
     75            <p class="description" id="lf-find-woo-resume"><?php esc_html_e('The last search stopped before it was done. The button goes on from where it stopped.', 'langforge'); ?> <button type="button" class="button-link" id="lf-find-woo-restart"><?php esc_html_e('Start over', 'langforge'); ?></button></p>
     76            <?php endif; ?>
    7277            <p class="description"><?php esc_html_e('Looks through the shop in small steps and lists attribute names, attribute values and saved email texts. Nothing is changed or deleted, and the translations you have are kept.', 'langforge'); ?></p>
    7378        </div>
    … …  
    9499    var $btn = $('#lf-find-woo-strings');
    95100    var $status = $('#lf-find-woo-status');
     101    var $note = $('#lf-find-woo-resume');
     102    var $restart = $('#lf-find-woo-restart');
    96103    if (!$btn.length) { return; }
    97104    var t = __TEXTS__;
    … …  
    100107    var sofar = '';
    101108    var requests = 0;
     109    // The first request of a press asks the server for the place the last pass stopped at (or, with "Start over", to throw it away);
     110    // the server answers with a run, which every later request of the press sends back.
     111    var starting = false;
     112    var restarting = false;
     113    var run = '';
    102114
    103115    function stop(text) {
    … …  
    126138            cursor: cursor,
    127139            found: found,
    128             skipped: skipped
     140            skipped: skipped,
     141            begin: starting && !restarting ? 1 : 0,
     142            restart: starting && restarting ? 1 : 0,
     143            run: run
    129144        }).done(function (r) {
    130145            if (!r || !r.success || !r.data) {
    … …  
    133148            }
    134149            var d = r.data;
     150            starting = false;
     151            run = typeof d.run === 'string' ? d.run : '';
    135152            found = parseInt(d.total_added, 10) || 0;
    136153            skipped = parseInt(d.total_skipped, 10) || 0;
    … …  
    148165    }
    149166
    150     $btn.on('click', function () {
     167    function press(over) {
    151168        found = 0;
    152169        skipped = 0;
    153170        sofar = '';
    154171        requests = 0;
     172        run = '';
     173        starting = true;
     174        restarting = over;
     175        $note.hide();
    155176        $btn.prop('disabled', true);
    156177        step('__FIRST__', 0);
     178    }
     179
     180    $btn.on('click', function () { press(false); });
     181    $restart.on('click', function (e) {
     182        if (e && e.preventDefault) { e.preventDefault(); }
     183        press(true);
    157184    });
    158185})(jQuery);
Note: See TracChangeset for help on using the changeset viewer.