// global vars : // serverPreviewParams <= printed with the base fmk // themeServerPreviewParams <= printed from the theme (function (api, $, _ ) { var $_body = $( 'body' ), setting_cbs = api.CZR_preview.prototype.setting_cbs || {}, input_cbs = api.CZR_preview.prototype.input_cbs || {}, _settingsCbsExtend = {}, _inputCbsExtend = {}; _inputCbsExtend = { 'tc_social_links' : { 'social-size' : function( data ) { if ( ! _.isObject( data ) || _.isUndefined( data.value ) || ! $('.social-icon', '.socials').length ) return; $('.social-icon', '.socials').css( 'font-size', data.value + 'px'); }, 'social-color' : function( data ) { if ( ! _.isObject( data ) || _.isUndefined( data.value ) || _.isUndefined( data.input_parent_id ) ) return; if ( ! $('.socials').find('.social-icon[data-model-id=' + data.input_parent_id +']').length ) return; $('.socials').find('.social-icon[data-model-id=' + data.input_parent_id +']').css( 'color', data.value ); } } }; _settingsCbsExtend = { /****************************************** * GLOBAL SETTINGS ******************************************/ 'blogname' : function(to) { $( 'a.navbar-brand-sitename span' ).text( to ); }, 'blogdescription' : function(to) { //do nothing if this setting has partial refresh if ( _customizePartialRefreshExports && ! _.isUndefined( _customizePartialRefreshExports.partials ) && ! _.isUndefined( _customizePartialRefreshExports.partials.blogdescription ) ) return; $( '.header-tagline' ).text( to ); }, 'tc_skin' : function( to ) { if ( serverPreviewParams && serverPreviewParams.themeFolder ) { //add a new link to the live stylesheet instead of replacing the actual skin link => avoid the flash of unstyle content during the skin load var $skin_style_element = ( 0 === $('#live-skin-css').length ) ? $('' , { id : 'live-skin-css' , rel : 'stylesheet'}) : $('#live-skin-css'), skinName = to.replace('.css' , '.min.css'), skinURL = [ serverPreviewParams.themeFolder , '/inc/assets/css/' , skinName ].join(''); //check if the customSkin param is filtered if ( themeServerPreviewParams.customSkin && themeServerPreviewParams.customSkin.skinName && themeServerPreviewParams.customSkin.fullPath ) skinURL = to == themeServerPreviewParams.customSkin.skinName ? themeServerPreviewParams.customSkin.fullPath : skinURL; $skin_style_element.attr('href' , skinURL ); if ( 0 === $('#live-skin-css').length ) $('head').append($skin_style_element); } }, 'tc_fonts' : function( to ) { var font_groups = themeServerPreviewParams.fontPairs; $.each( font_groups , function( key, group ) { if ( group.list[to]) { if ( -1 != to.indexOf('_g_') ) _addGfontLink( group.list[to][1] ); _toStyle( group.list[to][1] ); } }); _.delay( function() { czrapp.$_header.trigger( 'refresh-sticky-header' ); }, 100 ); }, 'tc_body_font_size' : function( to ) { var fontSelectors = themeServerPreviewParams.fontSelectors; var $font_size_style_element = ( 0 === $('#live-font-size-css').length ) ? $('