promptexecute.html.php 665 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace zin;
  3. h::globalJS(<<<JAVASCRIPT
  4. requestAnimationFrame(() =>
  5. {
  6. setTimeout(() =>
  7. {
  8. const currentURL = new URL(\$.apps.getLastApp().currentUrl, location.href);
  9. const formURL = new URL(`{$formLocation}`, location.href);
  10. /* Prevent unnecessary refresh. */
  11. const isRegen = window.sessionStorage.getItem('ai-prompt-regen') === 'true';
  12. if(currentURL.href === formURL.href && !isRegen) return;
  13. /* Go back to prompts page when entering audit, prevent showing a blank page. */
  14. if(\$.apps.currentCode == 'admin') goBack();
  15. openUrl(`{$formLocation}`);
  16. }, 1000);
  17. });
  18. JAVASCRIPT
  19. );