/** * WP Modern Blog — Okuma İlerleme Çubuğu * * Scroll pozisyonuna göre #reading-progress div'indeki * --progress CSS değişkenini günceller. */ ( function () { 'use strict'; function init() { const bar = document.getElementById( 'reading-progress' ); if ( ! bar ) return; let ticking = false; function update() { const scrollTop = window.pageYOffset || document.documentElement.scrollTop; const docHeight = document.documentElement.scrollHeight - window.innerHeight; const progress = docHeight > 0 ? Math.min( 100, ( scrollTop / docHeight ) * 100 ) : 0; bar.style.setProperty( '--progress', progress + '%' ); ticking = false; } window.addEventListener( 'scroll', function () { if ( ! ticking ) { requestAnimationFrame( update ); ticking = true; } }, { passive: true } ); // İlk render update(); } if ( document.readyState !== 'loading' ) init(); else document.addEventListener( 'DOMContentLoaded', init ); } )();