| Server IP : 3.147.158.171 / Your IP : 216.73.216.216 Web Server : Apache/2.4.67 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-2-178.us-east-2.compute.internal 6.1.172-216.329.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Wed May 20 06:31:34 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.21 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /tsai/repo/sites/tsai.ai/wp-content/themes/twentytwentyfive-tsai/assets/js/ |
Upload File : |
(function () {
if (window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
return;
}
var selector = 'body.single .wp-block-post-featured-image, body.single .wp-block-post-content .wp-block-image';
var ICON_ON = '<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path fill="currentColor" d="M10 2a8 8 0 1 1-5.29 14.01l-3.35 3.35a1 1 0 0 1-1.42-1.42l3.35-3.35A8 8 0 0 1 10 2zm0 2a6 6 0 1 0 0 12 6 6 0 0 0 0-12zm-1 3h2v2h2v2h-2v2H9v-2H7V9h2V7z"/></svg>';
var ICON_OFF = '<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path fill="currentColor" d="M10 2a8 8 0 1 1-5.29 14.01l-3.35 3.35a1 1 0 0 1-1.42-1.42l3.35-3.35A8 8 0 0 1 10 2zm0 2a6 6 0 1 0 0 12 6 6 0 0 0 0-12zM7 9h6v2H7V9z"/></svg>';
function bind(wrapper) {
var img = wrapper.querySelector('img');
if (!img) return;
if (wrapper.dataset.tsaiMagnify === 'bound') return;
wrapper.dataset.tsaiMagnify = 'bound';
var computed = window.getComputedStyle(wrapper);
if (computed.position === 'static') {
wrapper.style.position = 'relative';
}
var btn = document.createElement('button');
btn.type = 'button';
btn.className = 'tsai-magnify-toggle';
btn.setAttribute('aria-pressed', 'false');
btn.setAttribute('aria-label', 'Enable image magnify');
btn.innerHTML = ICON_OFF;
btn.addEventListener('click', function (e) {
e.preventDefault();
e.stopPropagation();
var active = wrapper.classList.toggle('is-magnify-active');
btn.setAttribute('aria-pressed', active ? 'true' : 'false');
btn.setAttribute('aria-label', active ? 'Disable image magnify' : 'Enable image magnify');
btn.innerHTML = active ? ICON_ON : ICON_OFF;
if (!active) {
img.style.transformOrigin = 'center center';
}
});
wrapper.appendChild(btn);
wrapper.addEventListener('mousemove', function (e) {
if (!wrapper.classList.contains('is-magnify-active')) return;
var rect = wrapper.getBoundingClientRect();
if (rect.width === 0 || rect.height === 0) return;
var x = ((e.clientX - rect.left) / rect.width) * 100;
var y = ((e.clientY - rect.top) / rect.height) * 100;
img.style.transformOrigin = x + '% ' + y + '%';
});
wrapper.addEventListener('mouseleave', function () {
img.style.transformOrigin = 'center center';
});
}
function init() {
document.querySelectorAll(selector).forEach(bind);
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();