fix: defer log viewer JS until DOM ready to resolve peptideNewsAdmin reference

The inline log viewer script was executing before wp_localize_script
had defined peptideNewsAdmin. Switching from an IIFE to jQuery
document.ready ensures the localized object is available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Terence Ong
2026-04-07 16:14:18 +07:00
parent 6c57f6ca11
commit e8a45e9068
2 changed files with 4 additions and 4 deletions

View File

@@ -753,7 +753,7 @@ class Peptide_News_Admin {
?> ?>
<script> <script>
(function($) { jQuery(document).ready(function($) {
var currentPage = 1; var currentPage = 1;
function levelBadge(level) { function levelBadge(level) {
@@ -830,7 +830,7 @@ class Peptide_News_Admin {
// Initial load. // Initial load.
loadLogs(1); loadLogs(1);
})(jQuery); });
</script> </script>
<?php <?php

View File

@@ -753,7 +753,7 @@ class Peptide_News_Admin {
?> ?>
<script> <script>
(function($) { jQuery(document).ready(function($) {
var currentPage = 1; var currentPage = 1;
function levelBadge(level) { function levelBadge(level) {
@@ -830,7 +830,7 @@ class Peptide_News_Admin {
// Initial load. // Initial load.
loadLogs(1); loadLogs(1);
})(jQuery); });
</script> </script>
<?php <?php