js.php 1.4 KB

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