Changeset 3742801 for langforge/trunk/admin/class-strings-screen.php
- Timestamp:
- 10/13/2026 02:57:34 AM (2 weeks ago)
- File:
-
- 1 edited
-
langforge/trunk/admin/class-strings-screen.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
langforge/trunk/admin/class-strings-screen.php
r3742586 r3742801 66 66 /** The box with the "Find WooCommerce strings" button (drawn where WooCommerce runs). */ 67 67 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; 68 70 ?> 69 71 <div class="lf-find-woo"> 70 72 <button type="button" class="button" id="lf-find-woo-strings"><?php esc_html_e('Find WooCommerce strings', 'langforge'); ?></button> 71 73 <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; ?> 72 77 <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> 73 78 </div> … … 94 99 var $btn = $('#lf-find-woo-strings'); 95 100 var $status = $('#lf-find-woo-status'); 101 var $note = $('#lf-find-woo-resume'); 102 var $restart = $('#lf-find-woo-restart'); 96 103 if (!$btn.length) { return; } 97 104 var t = __TEXTS__; … … 100 107 var sofar = ''; 101 108 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 = ''; 102 114 103 115 function stop(text) { … … 126 138 cursor: cursor, 127 139 found: found, 128 skipped: skipped 140 skipped: skipped, 141 begin: starting && !restarting ? 1 : 0, 142 restart: starting && restarting ? 1 : 0, 143 run: run 129 144 }).done(function (r) { 130 145 if (!r || !r.success || !r.data) { … … 133 148 } 134 149 var d = r.data; 150 starting = false; 151 run = typeof d.run === 'string' ? d.run : ''; 135 152 found = parseInt(d.total_added, 10) || 0; 136 153 skipped = parseInt(d.total_skipped, 10) || 0; … … 148 165 } 149 166 150 $btn.on('click', function () {167 function press(over) { 151 168 found = 0; 152 169 skipped = 0; 153 170 sofar = ''; 154 171 requests = 0; 172 run = ''; 173 starting = true; 174 restarting = over; 175 $note.hide(); 155 176 $btn.prop('disabled', true); 156 177 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); 157 184 }); 158 185 })(jQuery);
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)