js.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <script defer src="/js/vendor/jquery-3.6.4.min.js?<?= JS_LATEST_UPDATE ?>"></script>
  2. <script defer src="/js/dist/main.min.js?<?= JS_LATEST_UPDATE ?>"></script>
  3. <script defer src="/js/vendor/alpine-3.12.0.min.js?<?= JS_LATEST_UPDATE ?>"></script>
  4. <script>
  5. // TODO: REMOVE
  6. const App = {
  7. Actions: {
  8. DB: {},
  9. WEB: {},
  10. PACKAGE: {},
  11. MAIL_ACC: {},
  12. MAIL: {},
  13. },
  14. Listeners: {
  15. DB: {},
  16. WEB: {},
  17. PACKAGE: {},
  18. MAIL_ACC: {},
  19. }
  20. }
  21. document.documentElement.classList.replace('no-js', 'js');
  22. document.addEventListener('alpine:init', () => {
  23. Alpine.store('globals', {
  24. USER_PREFIX: '<?= $user_plain ?>_',
  25. UNLIMITED: '<?= _("Unlimited") ?>',
  26. NOTIFICATIONS_EMPTY: '<?= _("No notifications") ?>',
  27. NOTIFICATIONS_DELETE_ALL: '<?= _("Delete all notifications") ?>',
  28. CONFIRM_LEAVE_PAGE: '<?= _("LEAVE_PAGE_CONFIRMATION") ?>',
  29. ERROR_MESSAGE: '<?= !empty($_SESSION['error_msg']) ? htmlentities($_SESSION['error_msg']) : '' ?>',
  30. BLACKLIST: '<?= _("BLACKLIST") ?>',
  31. IPVERSE: '<?= _("IPVERSE") ?>'
  32. });
  33. })
  34. </script>
  35. <?php if (!empty($_SESSION['error_msg'])) unset($_SESSION['error_msg']); ?>
  36. <?php
  37. $customScriptDirectory = new DirectoryIterator($_SERVER["HESTIA"] . "/web/js/custom_scripts");
  38. foreach ($customScriptDirectory as $customScript) {
  39. $extension = $customScript->getExtension();
  40. if ($extension === "js") {
  41. $customScriptPath = "/js/custom_scripts/" . rawurlencode($customScript->getBasename());
  42. echo '<script defer src="' . $customScriptPath . '"></script>';
  43. } elseif ($extension === "php") {
  44. require_once $customScript->getPathname();
  45. }
  46. } ?>