fix(theme-check): perbaiki kapitalisasi WordPress, dimensi screenshot 1200x900, dan kompresi aset gambar
This commit is contained in:
+31
-240
@@ -1,8 +1,6 @@
|
||||
<?php defined( 'ABSPATH' ) || exit; ?>
|
||||
<?php
|
||||
/**
|
||||
* Template Footer EduKarsa Modern 4-Kolom
|
||||
*/
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$footer_logo = get_option( 'edukarsa_footer_logo' );
|
||||
if ( empty( $footer_logo ) ) {
|
||||
$footer_logo = get_option( 'edukarsa_header_logo' );
|
||||
@@ -12,16 +10,12 @@ $wa_clean = preg_replace( '/[^0-9]/', '', $raw_telp );
|
||||
if ( substr( $wa_clean, 0, 1 ) === '0' ) {
|
||||
$wa_clean = '62' . substr( $wa_clean, 1 );
|
||||
}
|
||||
|
||||
$wa_btn_label = get_option( 'edukarsa_wa_btn_text', 'Tanya PMB' );
|
||||
$wa_def_msg = get_option( 'edukarsa_wa_default_msg', 'Halo Admin EduKarsa, saya ingin bertanya informasi lebih lanjut.' );
|
||||
?>
|
||||
|
||||
<!-- MAIN FOOTER -->
|
||||
<footer class="site-footer">
|
||||
<div class="container footer-grid-wrapper">
|
||||
|
||||
<!-- Kolom 1: Brand & Profil -->
|
||||
<div class="footer-col footer-col-brand">
|
||||
<div class="footer-brand-logo">
|
||||
<?php if ( ! empty( $footer_logo ) ) : ?>
|
||||
@@ -33,36 +27,35 @@ $wa_def_msg = get_option( 'edukarsa_wa_default_msg', 'Halo Admin EduKarsa, say
|
||||
<p class="footer-brand-desc">
|
||||
<?php echo nl2br( esc_html( get_option( 'edukarsa_footer_desc', 'Institusi pendidikan terakreditasi unggul yang berdedikasi mencetak generasi berkarakter cerdas, kompetitif, dan berintegritas.' ) ) ); ?>
|
||||
</p>
|
||||
<?php
|
||||
$jam = get_option( 'edukarsa_footer_jam' );
|
||||
if ( ! empty( $jam ) ) :
|
||||
<?php
|
||||
$jam = get_option( 'edukarsa_footer_jam' );
|
||||
if ( ! empty( $jam ) ) :
|
||||
?>
|
||||
<div class="footer-hours-box">
|
||||
<span class="hours-icon">🕒</span>
|
||||
<span class="hours-icon">🕘</span>
|
||||
<div>
|
||||
<div style="font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; opacity: 0.8;">Jam Layanan</div>
|
||||
<div style="font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; opacity: 0.8;"><?php esc_html_e( 'Jam Layanan', 'edukarsa' ); ?></div>
|
||||
<div style="font-weight: 600; font-size: 13px; color: #fff; line-height: 1.6;"><?php echo nl2br( esc_html( $jam ) ); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- Kolom 2: Kontak Resmi -->
|
||||
<div class="footer-col">
|
||||
<h4 class="footer-col-title">Hubungi Kami</h4>
|
||||
<h4 class="footer-col-title"><?php esc_html_e( 'Hubungi Kami', 'edukarsa' ); ?></h4>
|
||||
<ul class="footer-contact-list">
|
||||
<li>
|
||||
<span class="f-icon">📍</span>
|
||||
<span class="f-icon">📍</span>
|
||||
<span><?php echo nl2br( esc_html( get_option( 'edukarsa_footer_alamat', 'Alamat belum diatur di dashboard' ) ) ); ?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="f-icon">📞</span>
|
||||
<span class="f-icon">📞</span>
|
||||
<a href="tel:<?php echo esc_attr( $wa_clean ); ?>">
|
||||
<?php echo esc_html( get_option( 'edukarsa_footer_telp', '(021) 000-0000' ) ); ?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="f-icon">✉️</span>
|
||||
<span class="f-icon">✉</span>
|
||||
<a href="mailto:<?php echo esc_attr( get_option( 'edukarsa_footer_email', '[email protected]' ) ); ?>">
|
||||
<?php echo esc_html( get_option( 'edukarsa_footer_email', '[email protected]' ) ); ?>
|
||||
</a>
|
||||
@@ -70,10 +63,9 @@ $wa_def_msg = get_option( 'edukarsa_wa_default_msg', 'Halo Admin EduKarsa, say
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Kolom 3: Tautan Penting -->
|
||||
<div class="footer-col">
|
||||
<h4 class="footer-col-title">Tautan Penting</h4>
|
||||
<nav class="footer-nav-clean">
|
||||
<h4 class="footer-col-title"><?php esc_html_e( 'Tautan Penting', 'edukarsa' ); ?></h4>
|
||||
<nav class="footer-nav-clean" aria-label="<?php esc_attr_e( 'Menu Footer', 'edukarsa' ); ?>">
|
||||
<?php
|
||||
wp_nav_menu( array(
|
||||
'theme_location' => 'menu-footer',
|
||||
@@ -86,11 +78,10 @@ $wa_def_msg = get_option( 'edukarsa_wa_default_msg', 'Halo Admin EduKarsa, say
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<!-- Kolom 4: Media Sosial Institusi -->
|
||||
<div class="footer-col">
|
||||
<h4 class="footer-col-title">Media Sosial</h4>
|
||||
<h4 class="footer-col-title"><?php esc_html_e( 'Media Sosial', 'edukarsa' ); ?></h4>
|
||||
<p style="font-size: 13px; opacity: 0.85; margin-bottom: 18px; line-height: 1.5;">
|
||||
Ikuti kanal resmi kami untuk update warta kegiatan kampus, prestasi, dan agenda akademik.
|
||||
<?php esc_html_e( 'Ikuti kanal resmi kami untuk update warta kegiatan kampus, prestasi, dan agenda akademik.', 'edukarsa' ); ?>
|
||||
</p>
|
||||
<div class="footer-social-icons">
|
||||
<?php if ( get_option( 'edukarsa_tampil_fb', 1 ) == 1 && get_option( 'edukarsa_footer_fb' ) ) : ?>
|
||||
@@ -98,93 +89,70 @@ $wa_def_msg = get_option( 'edukarsa_wa_default_msg', 'Halo Admin EduKarsa, say
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M22 12c0-5.52-4.48-10-10-10S2 6.48 2 12c0 4.84 3.44 8.87 8 9.8V15H8v-3h2V9.5C10 7.57 11.57 6 13.5 6H16v3h-2c-.55 0-1 .45-1 1v2h3v3h-3v6.95c5.05-.5 9-4.76 9-9.95z"/></svg>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( get_option( 'edukarsa_tampil_ig', 1 ) == 1 && get_option( 'edukarsa_footer_ig' ) ) : ?>
|
||||
<a href="<?php echo esc_url( get_option( 'edukarsa_footer_ig' ) ); ?>" target="_blank" rel="noopener" class="social-btn" title="Instagram">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689-.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z"/></svg>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( get_option( 'edukarsa_tampil_yt', 1 ) == 1 && get_option( 'edukarsa_footer_yt' ) ) : ?>
|
||||
<a href="<?php echo esc_url( get_option( 'edukarsa_footer_yt' ) ); ?>" target="_blank" rel="noopener" class="social-btn" title="YouTube">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"/></svg>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( get_option( 'edukarsa_tampil_tiktok', 0 ) == 1 && get_option( 'edukarsa_footer_tiktok' ) ) : ?>
|
||||
<a href="<?php echo esc_url( get_option( 'edukarsa_footer_tiktok' ) ); ?>" target="_blank" rel="noopener" class="social-btn" title="TikTok">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-1.01-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.24 1.07-.14 1.61.24 1.64 1.82 2.89 3.5 2.77 1.81-.05 3.29-1.52 3.36-3.33.04-3.78.02-7.57.02-11.35z"/></svg>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( get_option( 'edukarsa_tampil_x', 0 ) == 1 && get_option( 'edukarsa_footer_x' ) ) : ?>
|
||||
<a href="<?php echo esc_url( get_option( 'edukarsa_footer_x' ) ); ?>" target="_blank" rel="noopener" class="social-btn" title="X (Twitter)">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- COPYRIGHT BAR DENGAN WATERMARK KREATOR -->
|
||||
<div class="footer-bottom-bar">
|
||||
<div class="container footer-bottom-inner">
|
||||
<p class="copyright-text">
|
||||
© <?php echo date( 'Y' ); ?> <?php echo esc_html( get_option( 'edukarsa_footer_copyright', 'EduKarsa University. All Rights Reserved.' ) ); ?>
|
||||
<span style="opacity: 0.5; margin: 0 6px;">•</span>
|
||||
<span>Tema <a href="https://apps.masbudi.my.id/edukarsa" target="_blank" rel="noopener" style="color: #f39c12; font-weight: 700; text-decoration: none;">EduKarsa</a> oleh <a href="https://masbudi.my.id" target="_blank" rel="noopener" style="color: #ffffff; text-decoration: underline;">masbudi.my.id</a></span>
|
||||
© <?php echo esc_html( date( 'Y' ) ); ?> <?php echo esc_html( get_option( 'edukarsa_footer_copyright', 'EduKarsa. All Rights Reserved.' ) ); ?>
|
||||
</p>
|
||||
<div class="footer-bottom-badge">
|
||||
<span>Terakreditasi BAN-PT • Kampus Merdeka</span>
|
||||
<span><?php esc_html_e( 'Terakreditasi BAN-PT • Kampus Merdeka', 'edukarsa' ); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- WIDGET AKSESIBILITAS DISABILITAS & PEMBACA SUARA (WCAG TOOLBAR) -->
|
||||
<?php if ( get_option( 'edukarsa_tampil_accessibility', 1 ) == 1 ) : ?>
|
||||
<div class="edukarsa-a11y-wrapper" id="a11y-wrapper">
|
||||
<button type="button" class="edukarsa-a11y-trigger" id="a11y-trigger" aria-label="Buka Menu Aksesibilitas" title="Aksesibilitas Disabilitas">
|
||||
<button type="button" class="edukarsa-a11y-trigger" id="a11y-trigger" aria-label="<?php esc_attr_e( 'Buka Menu Aksesibilitas', 'edukarsa' ); ?>" title="<?php esc_attr_e( 'Aksesibilitas Disabilitas', 'edukarsa' ); ?>">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M12 2c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm9 7h-6v13h-2v-6h-2v6H9V9H3V7h18v2z"/></svg>
|
||||
</button>
|
||||
|
||||
<div class="edukarsa-a11y-panel" id="a11y-panel">
|
||||
<div class="a11y-panel-header">
|
||||
<h4>♿ Aksesibilitas</h4>
|
||||
<h4><?php esc_html_e( 'Aksesibilitas', 'edukarsa' ); ?></h4>
|
||||
<button type="button" class="a11y-close-btn" id="a11y-close">×</button>
|
||||
</div>
|
||||
<div class="a11y-panel-body">
|
||||
<div class="a11y-group">
|
||||
<span class="a11y-label">Pembaca Suara (Audio)</span>
|
||||
<span class="a11y-label"><?php esc_html_e( 'Pembaca Suara (Audio)', 'edukarsa' ); ?></span>
|
||||
<div class="a11y-btn-grid">
|
||||
<button type="button" class="a11y-btn" id="a11y-speak-play">🔊 Baca</button>
|
||||
<button type="button" class="a11y-btn" id="a11y-speak-stop">⏹ Berhenti</button>
|
||||
<button type="button" class="a11y-btn" id="a11y-speak-play"><?php esc_html_e( 'Baca', 'edukarsa' ); ?></button>
|
||||
<button type="button" class="a11y-btn" id="a11y-speak-stop"><?php esc_html_e( 'Berhenti', 'edukarsa' ); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a11y-group">
|
||||
<span class="a11y-label">Ukuran Teks</span>
|
||||
<span class="a11y-label"><?php esc_html_e( 'Ukuran Teks', 'edukarsa' ); ?></span>
|
||||
<div class="a11y-btn-grid">
|
||||
<button type="button" class="a11y-btn" id="a11y-font-dec">A-</button>
|
||||
<button type="button" class="a11y-btn" id="a11y-font-reset">Normal</button>
|
||||
<button type="button" class="a11y-btn" id="a11y-font-reset"><?php esc_html_e( 'Normal', 'edukarsa' ); ?></button>
|
||||
<button type="button" class="a11y-btn" id="a11y-font-inc">A+</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a11y-group">
|
||||
<span class="a11y-label">Tampilan Visual</span>
|
||||
<span class="a11y-label"><?php esc_html_e( 'Tampilan Visual', 'edukarsa' ); ?></span>
|
||||
<div class="a11y-btn-grid">
|
||||
<button type="button" class="a11y-btn" id="a11y-contrast">Kontras</button>
|
||||
<button type="button" class="a11y-btn" id="a11y-grayscale">Monokrom</button>
|
||||
<button type="button" class="a11y-btn" id="a11y-contrast"><?php esc_html_e( 'Kontras', 'edukarsa' ); ?></button>
|
||||
<button type="button" class="a11y-btn" id="a11y-grayscale"><?php esc_html_e( 'Monokrom', 'edukarsa' ); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="a11y-group">
|
||||
<span class="a11y-label">Navigasi</span>
|
||||
<span class="a11y-label"><?php esc_html_e( 'Navigasi', 'edukarsa' ); ?></span>
|
||||
<div class="a11y-btn-grid">
|
||||
<button type="button" class="a11y-btn" id="a11y-links">Garis Tautan</button>
|
||||
<button type="button" class="a11y-btn a11y-btn-danger" id="a11y-reset-all">Reset</button>
|
||||
<button type="button" class="a11y-btn" id="a11y-links"><?php esc_html_e( 'Garis Tautan', 'edukarsa' ); ?></button>
|
||||
<button type="button" class="a11y-btn a11y-btn-danger" id="a11y-reset-all"><?php esc_html_e( 'Reset', 'edukarsa' ); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -192,7 +160,6 @@ $wa_def_msg = get_option( 'edukarsa_wa_default_msg', 'Halo Admin EduKarsa, say
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- FLOATING WHATSAPP (LABEL & PESAN DINAMIS) -->
|
||||
<?php if ( ! empty( $wa_clean ) ) : ?>
|
||||
<a href="https://wa.me/<?php echo esc_attr( $wa_clean ); ?>?text=<?php echo rawurlencode( $wa_def_msg ); ?>" target="_blank" rel="noopener" class="edukarsa-wa-float" title="<?php echo esc_attr( $wa_btn_label ); ?>">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="#ffffff"><path d="M12.031 6.172c-3.181 0-5.767 2.586-5.768 5.766-.001 1.298.38 2.27 1.019 3.287l-.711 2.598 2.664-.699c.971.53 1.777.82 2.796.82h.005c3.18 0 5.767-2.586 5.768-5.766 0-3.18-2.587-5.806-5.773-5.806zm3.376 8.214c-.149.42-.767.781-1.072.829-.304.048-.687.069-2.203-.559-1.933-.801-3.178-2.775-3.275-2.905-.095-.129-.778-1.036-.778-1.975 0-.94.492-1.401.667-1.593.175-.192.383-.24.512-.24.129 0 .258.006.371.012.12.006.279-.045.436.334.164.397.558 1.365.607 1.465.049.099.082.217.017.348-.065.131-.098.212-.195.328-.098.115-.205.258-.293.346-.098.098-.201.205-.087.401.115.196.512.846 1.099 1.368.756.673 1.393.882 1.59.98.196.098.312.082.426-.049.115-.131.492-.573.623-.77.131-.196.262-.164.442-.098.18.065 1.147.541 1.344.639.196.098.328.147.377.229.049.082.049.475-.1.895z"/></svg>
|
||||
@@ -200,183 +167,7 @@ $wa_def_msg = get_option( 'edukarsa_wa_default_msg', 'Halo Admin EduKarsa, say
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- BACK TO TOP -->
|
||||
<button id="back-to-top" class="back-to-top-btn" aria-label="Kembali ke atas">▲</button>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const toggleBtn = document.getElementById("mobile-menu-toggle");
|
||||
const navMenu = document.getElementById("site-navigation");
|
||||
if (toggleBtn && navMenu) {
|
||||
toggleBtn.addEventListener("click", function() {
|
||||
toggleBtn.classList.toggle("active");
|
||||
navMenu.classList.toggle("active");
|
||||
});
|
||||
}
|
||||
|
||||
const bttBtn = document.getElementById("back-to-top");
|
||||
if (bttBtn) {
|
||||
window.addEventListener("scroll", function() {
|
||||
if (window.scrollY > 350) { bttBtn.classList.add("show"); } else { bttBtn.classList.remove("show"); }
|
||||
});
|
||||
bttBtn.addEventListener("click", function() {
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
});
|
||||
}
|
||||
|
||||
const a11yTrigger = document.getElementById("a11y-trigger");
|
||||
const a11yPanel = document.getElementById("a11y-panel");
|
||||
const a11yClose = document.getElementById("a11y-close");
|
||||
|
||||
if (a11yTrigger && a11yPanel) {
|
||||
a11yTrigger.addEventListener("click", function() {
|
||||
a11yPanel.classList.toggle("active");
|
||||
});
|
||||
if (a11yClose) {
|
||||
a11yClose.addEventListener("click", function() {
|
||||
a11yPanel.classList.remove("active");
|
||||
});
|
||||
}
|
||||
|
||||
const fontLevels = ['', 'a11y-font-lg', 'a11y-font-xl'];
|
||||
let currentFontIdx = parseInt(localStorage.getItem('edukarsa_a11y_font') || '0', 10);
|
||||
|
||||
function applyA11y() {
|
||||
fontLevels.forEach(function(c) {
|
||||
if (c) document.body.classList.remove(c);
|
||||
});
|
||||
if (fontLevels[currentFontIdx]) {
|
||||
document.body.classList.add(fontLevels[currentFontIdx]);
|
||||
}
|
||||
|
||||
if (localStorage.getItem('edukarsa_a11y_contrast') === '1') {
|
||||
document.body.classList.add('a11y-high-contrast');
|
||||
} else {
|
||||
document.body.classList.remove('a11y-high-contrast');
|
||||
}
|
||||
|
||||
if (localStorage.getItem('edukarsa_a11y_grayscale') === '1') {
|
||||
document.body.classList.add('a11y-grayscale');
|
||||
} else {
|
||||
document.body.classList.remove('a11y-grayscale');
|
||||
}
|
||||
|
||||
if (localStorage.getItem('edukarsa_a11y_links') === '1') {
|
||||
document.body.classList.add('a11y-underline-links');
|
||||
} else {
|
||||
document.body.classList.remove('a11y-underline-links');
|
||||
}
|
||||
}
|
||||
|
||||
applyA11y();
|
||||
|
||||
document.getElementById("a11y-font-inc")?.addEventListener("click", function() {
|
||||
if (currentFontIdx < fontLevels.length - 1) currentFontIdx++;
|
||||
localStorage.setItem('edukarsa_a11y_font', currentFontIdx);
|
||||
applyA11y();
|
||||
});
|
||||
|
||||
document.getElementById("a11y-font-dec")?.addEventListener("click", function() {
|
||||
if (currentFontIdx > 0) currentFontIdx--;
|
||||
localStorage.setItem('edukarsa_a11y_font', currentFontIdx);
|
||||
applyA11y();
|
||||
});
|
||||
|
||||
document.getElementById("a11y-font-reset")?.addEventListener("click", function() {
|
||||
currentFontIdx = 0;
|
||||
localStorage.setItem('edukarsa_a11y_font', currentFontIdx);
|
||||
applyA11y();
|
||||
});
|
||||
|
||||
document.getElementById("a11y-contrast")?.addEventListener("click", function() {
|
||||
const active = localStorage.getItem('edukarsa_a11y_contrast') === '1';
|
||||
localStorage.setItem('edukarsa_a11y_contrast', active ? '0' : '1');
|
||||
applyA11y();
|
||||
});
|
||||
|
||||
document.getElementById("a11y-grayscale")?.addEventListener("click", function() {
|
||||
const active = localStorage.getItem('edukarsa_a11y_grayscale') === '1';
|
||||
localStorage.setItem('edukarsa_a11y_grayscale', active ? '0' : '1');
|
||||
applyA11y();
|
||||
});
|
||||
|
||||
document.getElementById("a11y-links")?.addEventListener("click", function() {
|
||||
const active = localStorage.getItem('edukarsa_a11y_links') === '1';
|
||||
localStorage.setItem('edukarsa_a11y_links', active ? '0' : '1');
|
||||
applyA11y();
|
||||
});
|
||||
|
||||
document.getElementById("a11y-reset-all")?.addEventListener("click", function() {
|
||||
currentFontIdx = 0;
|
||||
localStorage.removeItem('edukarsa_a11y_font');
|
||||
localStorage.removeItem('edukarsa_a11y_contrast');
|
||||
localStorage.removeItem('edukarsa_a11y_grayscale');
|
||||
localStorage.removeItem('edukarsa_a11y_links');
|
||||
applyA11y();
|
||||
if ('speechSynthesis' in window) {
|
||||
window.speechSynthesis.cancel();
|
||||
const pBtn = document.getElementById("a11y-speak-play");
|
||||
if (pBtn) { pBtn.classList.remove('speaking'); pBtn.innerText = "🔊 Baca"; }
|
||||
}
|
||||
});
|
||||
|
||||
const speakPlayBtn = document.getElementById("a11y-speak-play");
|
||||
const speakStopBtn = document.getElementById("a11y-speak-stop");
|
||||
|
||||
if ('speechSynthesis' in window && speakPlayBtn) {
|
||||
const synth = window.speechSynthesis;
|
||||
|
||||
speakPlayBtn.addEventListener("click", function() {
|
||||
if (synth.speaking) {
|
||||
synth.cancel();
|
||||
}
|
||||
|
||||
const contentEl = document.querySelector("article .entry-content") || document.getElementById("primary") || document.body;
|
||||
const textToRead = contentEl.innerText.replace(/\s+/g, ' ').trim();
|
||||
if (!textToRead) return;
|
||||
|
||||
const utterance = new SpeechSynthesisUtterance(textToRead);
|
||||
|
||||
const match = document.cookie.match(/googtrans=\/id\/([a-zA-Z\-]+)/i);
|
||||
const activeLang = match ? match[1].toLowerCase() : 'id';
|
||||
|
||||
if (activeLang === 'en') {
|
||||
utterance.lang = 'en-US';
|
||||
} else if (activeLang === 'ar') {
|
||||
utterance.lang = 'ar-SA';
|
||||
} else {
|
||||
utterance.lang = 'id-ID';
|
||||
}
|
||||
|
||||
utterance.rate = 0.95;
|
||||
|
||||
utterance.onstart = function() {
|
||||
speakPlayBtn.classList.add('speaking');
|
||||
speakPlayBtn.innerText = "🔊 Membaca...";
|
||||
};
|
||||
|
||||
utterance.onend = utterance.onerror = function() {
|
||||
speakPlayBtn.classList.remove('speaking');
|
||||
speakPlayBtn.innerText = "🔊 Baca";
|
||||
};
|
||||
|
||||
synth.speak(utterance);
|
||||
});
|
||||
|
||||
speakStopBtn?.addEventListener("click", function() {
|
||||
if (synth.speaking) {
|
||||
synth.cancel();
|
||||
speakPlayBtn.classList.remove('speaking');
|
||||
speakPlayBtn.innerText = "🔊 Baca";
|
||||
}
|
||||
});
|
||||
} else if (speakPlayBtn) {
|
||||
speakPlayBtn.style.display = 'none';
|
||||
if (speakStopBtn) speakStopBtn.style.display = 'none';
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<button id="back-to-top" class="back-to-top-btn" aria-label="<?php esc_attr_e( 'Kembali ke atas', 'edukarsa' ); ?>">⇧</button>
|
||||
|
||||
<?php wp_footer(); ?>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user