/**
* Customizer enhancements for a better user experience.
*
* Contains handlers to make Customizer preview reload changes asynchronously.
* Things like site title and description changes.
*/
(function ($) {
function menu_align() {
var headerWrap = $('.site-header');
var navWrap = $('.navbar');
var logoWrap = $('.site-logo');
var containerWrap = $('.container');
var classToAdd = 'header-align-center';
if (headerWrap.hasClass(classToAdd)) {
headerWrap.removeClass(classToAdd);
}
var logoWidth = logoWrap.outerWidth();
var menuWidth = navWrap.outerWidth();
var containerWidth = containerWrap.width();
if (menuWidth + logoWidth > containerWidth) {
headerWrap.addClass(classToAdd);
} else {
if (headerWrap.hasClass(classToAdd)) {
headerWrap.removeClass(classToAdd);
}
}
}
wp.customize('blogdescription', function (value) {
value.bind(function (to) {
$logo= $('.site-header .header-logo ').html();
$('.site-header .site-logo').text('');
$('.site-footer .site-logo').text('');
var text = '';
var text2 = '';
if (($logo !== '') || (to !== '') || (wp.customize.instance('blogname').get() !== '')) {
if ($logo !== '') {
text += '
';
}
text += '';
text += '
' + wp.customize.instance('blogname').get() + '
';
text += '
' + to + '
';
text += '
';
}
if ((wp.customize.instance('mp_artwork_logo_footer').get() !== '') || (to !== '') || (wp.customize.instance('blogname').get() !== '')) {
text2 += '';
if (wp.customize.instance('mp_artwork_logo_footer').get() !== '') {
text2 += '';
}
text2 += '';
text2 += '
' + wp.customize.instance('blogname').get() + '
';
text2 += '
' + to + '
';
text2 += '
';
text2 += '';
}
$('.site-header .site-logo').append(text);
$('.site-footer .site-logo').append(text2);
menu_align();
});
});
wp.customize('blogname', function (value) {
value.bind(function (to) {
$logo= $('.site-header .header-logo ').html();
$('.site-header .site-logo').text('');
$('.site-footer .site-logo').text('');
var text = '';
var text2 = '';
if (($logo !== '') || (wp.customize.instance('blogdescription').get() !== '') || (to !== '')) {
if ($logo !== '') {
text += '';
}
text += '';
}
if ((wp.customize.instance('mp_artwork_logo_footer').get() !== '') || (wp.customize.instance('blogdescription').get() !== '') || (to !== '')) {
text2 += '';
if (wp.customize.instance('mp_artwork_logo_footer').get() !== '') {
text2 += '';
}
text2 += '';
text2 += '
' + to + '
';
if (wp.customize.instance('blogdescription').get() !== '') {
text2 += '
' + wp.customize.instance('blogdescription').get() + '
';
}
text2 += '
';
text2 += '';
}
$('.site-header .site-logo').append(text);
$('.site-footer .site-logo').append(text2);
menu_align();
});
});
wp.customize('header_textcolor', function (value) {
value.bind(function (to) {
$('.main-header .site-title').css('color', to);
});
});
wp.customize('mp_artwork_rss_link', function (value) {
value.bind(function (to) {
$('.site-footer .social-profile').text('');
var text = '';
if (wp.customize.instance('mp_artwork_facebook_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_twitter_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_linkedin_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_google_plus_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_instagram_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_pinterest_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_tumblr_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_youtube_link').get() !== '') {
text += '';
}
if (to !== '') {
text += '';
}
$('.site-footer .social-profile').append(text);
});
});
wp.customize('mp_artwork_facebook_link', function (value) {
value.bind(function (to) {
$('.site-footer .social-profile').text('');
var text = '';
if (to !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_twitter_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_linkedin_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_google_plus_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_instagram_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_pinterest_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_tumblr_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_youtube_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_rss_link').get() !== '') {
text += '';
}
$('.site-footer .social-profile').append(text);
});
});
wp.customize('mp_artwork_twitter_link', function (value) {
value.bind(function (to) {
$('.site-footer .social-profile').text('');
var text = '';
if (wp.customize.instance('mp_artwork_facebook_link').get() !== '') {
text += '';
}
if (to !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_linkedin_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_google_plus_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_instagram_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_pinterest_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_tumblr_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_youtube_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_rss_link').get() !== '') {
text += '';
}
$('.site-footer .social-profile').append(text);
});
});
wp.customize('mp_artwork_linkedin_link', function (value) {
value.bind(function (to) {
$('.site-footer .social-profile').text('');
var text = '';
if (wp.customize.instance('mp_artwork_facebook_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_twitter_link').get() !== '') {
text += '';
}
if (to !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_google_plus_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_instagram_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_pinterest_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_tumblr_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_youtube_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_rss_link').get() !== '') {
text += '';
}
$('.site-footer .social-profile').append(text);
});
});
wp.customize('mp_artwork_google_plus_link', function (value) {
value.bind(function (to) {
$('.site-footer .social-profile').text('');
var text = '';
if (wp.customize.instance('mp_artwork_facebook_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_twitter_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_linkedin_link').get() !== '') {
text += '';
}
if (to !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_instagram_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_pinterest_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_tumblr_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_youtube_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_rss_link').get() !== '') {
text += '';
}
$('.site-footer .social-profile').append(text);
});
});
wp.customize('mp_artwork_instagram_link', function (value) {
value.bind(function (to) {
$('.site-footer .social-profile').text('');
var text = '';
if (wp.customize.instance('mp_artwork_facebook_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_twitter_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_linkedin_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_google_plus_link').get() !== '') {
text += '';
}
if (to !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_pinterest_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_tumblr_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_youtube_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_rss_link').get() !== '') {
text += '';
}
$('.site-footer .social-profile').append(text);
});
});
wp.customize('mp_artwork_pinterest_link', function (value) {
value.bind(function (to) {
$('.site-footer .social-profile').text('');
var text = '';
if (wp.customize.instance('mp_artwork_facebook_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_twitter_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_linkedin_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_google_plus_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_instagram_link').get() !== '') {
text += '';
}
if (to !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_tumblr_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_youtube_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_rss_link').get() !== '') {
text += '';
}
$('.site-footer .social-profile').append(text);
});
});
wp.customize('mp_artwork_tumblr_link', function (value) {
value.bind(function (to) {
$('.site-footer .social-profile').text('');
var text = '';
if (wp.customize.instance('mp_artwork_facebook_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_twitter_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_linkedin_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_google_plus_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_instagram_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_pinterest_link').get() !== '') {
text += '';
}
if (to !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_youtube_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_rss_link').get() !== '') {
text += '';
}
$('.site-footer .social-profile').append(text);
});
});
wp.customize('mp_artwork_youtube_link', function (value) {
value.bind(function (to) {
$('.site-footer .social-profile').text('');
var text = '';
if (wp.customize.instance('mp_artwork_facebook_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_twitter_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_linkedin_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_google_plus_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_instagram_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_pinterest_link').get() !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_tumblr_link').get() !== '') {
text += '';
}
if (to !== '') {
text += '';
}
if (wp.customize.instance('mp_artwork_rss_link').get() !== '') {
text += '';
}
$('.site-footer .social-profile').append(text);
});
});
wp.customize('header_image', function (value) {
value.bind(function (to) {
if (to === '') {
$('.header-image-wrapper').hide();
} else {
$('.header-image-wrapper').show();
$('.header-image-wrapper .header-image').css('background-image', to);
}
});
});
wp.customize('header_textcolor', function (value) {
value.bind(function (to) {
if ('blank' == to) {
$('.site-description').hide();
} else {
$('.site-description').show();
}
});
});
wp.customize('mp_artwork_location_info', function (value) {
value.bind(function (to) {
var text = '';
$('.info-list-address .info-list').remove();
if (to !== '') {
text += '';
}
$('.info-list-address').append(text);
});
});
wp.customize('mp_artwork_location_info_label', function (value) {
value.bind(function (to) {
var text = '';
$('.info-list-address .footer-title').remove();
if (to !== '') {
text += '';
}
$('.info-list-address').prepend(text);
});
});
wp.customize('mp_artwork_hours_info', function (value) {
value.bind(function (to) {
var text = '';
$('.info-list-hours .info-list').remove();
if (to !== '') {
text += '';
}
$('.info-list-hours').append(text);
});
});
wp.customize('mp_artwork_hours_info_label', function (value) {
value.bind(function (to) {
var text = '';
$('.info-list-hours .footer-title').remove();
if (to !== '') {
text += '';
}
$('.info-list-hours').prepend(text);
});
});
wp.customize('mp_artwork_copyright', function (value) {
value.bind(function (to) {
var text = '' + $('.site-footer .copyright-date').text() + '';
$('.site-footer .copyright').text('');
if (to !== '') {
text += to;
}
$('.site-footer .copyright').html(text);
});
});
wp.customize('mp_artwork_about_content', function (value) {
value.bind(function (to) {
var text = '';
$('.content-about-page').text('');
if (to !== '') {
text += to;
}
$('.content-about-page').html(text);
});
});
})(jQuery);