js.php 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. <script defer src="/js/dist/main.min.js?<?= JS_LATEST_UPDATE ?>"></script>
  2. <script defer src="/js/dist/alpinejs.min.js?<?= JS_LATEST_UPDATE ?>"></script>
  3. <script>
  4. document.documentElement.classList.replace('no-js', 'js');
  5. document.addEventListener('alpine:init', () => {
  6. Alpine.store('globals', {
  7. USER_PREFIX: '<?= $user_plain ?>_',
  8. UNLIMITED: '<?= _("Unlimited") ?>',
  9. NOTIFICATIONS_EMPTY: '<?= _("No notifications") ?>',
  10. NOTIFICATIONS_DELETE_ALL: '<?= _("Delete all notifications") ?>',
  11. CONFIRM_LEAVE_PAGE: '<?= _("LEAVE_PAGE_CONFIRMATION") ?>',
  12. ERROR_MESSAGE: '<?= !empty($_SESSION['error_msg']) ? htmlentities($_SESSION['error_msg']) : '' ?>',
  13. BLACKLIST: '<?= _("BLACKLIST") ?>',
  14. IPVERSE: '<?= _("IPVERSE") ?>'
  15. });
  16. })
  17. </script>
  18. <?php
  19. $_SESSION['unset_alerts'] = true;
  20. ?>
  21. <?php
  22. $customScriptDirectory = new DirectoryIterator($_SERVER["HESTIA"] . "/web/js/custom_scripts");
  23. foreach ($customScriptDirectory as $customScript) {
  24. $extension = $customScript->getExtension();
  25. if ($extension === "js") {
  26. $customScriptPath = "/js/custom_scripts/" . rawurlencode($customScript->getBasename());
  27. echo '<script defer src="' . $customScriptPath . '"></script>';
  28. } elseif ($extension === "php") {
  29. require_once $customScript->getPathname();
  30. }
  31. } ?>