HEX
Server: LiteSpeed
System: Linux premium221.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User: madepabj (2566)
PHP: 8.3.26
Disabled: NONE
Upload Files
File: /home/madepabj/hc-cosmetics.com/wp-content/themes/dbea/framework/meta-box/sns-metabox.js
(function ($) {
	"use strict";
	$(document).ready(function($){
		if( $('#dbea_layouttype').length > 0 ){
			var selector = document.getElementById('dbea_layouttype');
			var imgLayoutHTML = '';
		    for(var i = 1; i < selector.options.length; i++){
		    	if( selector.options[i].value ){
		    		imgLayoutHTML = imgLayoutHTML + '<span class="img-layout '+selector.options[i].value+'" data-value="'+selector.options[i].value+'" title="'+selector.options[i].text+'"></span>';
		    	}
		    }
		    $('#dbea_layouttype').parent().append(imgLayoutHTML); $('#dbea_layouttype').css('display', 'none');
		}
		$('.img-layout').each(function(){
			// Add active class
			if($(this).attr('data-value') == $('#dbea_layouttype').attr('data-selected')){
				$(this).addClass('active');
			}
			showHideDependLayout($('#dbea_layouttype').attr('data-selected'));
			// Click img select
			$(this).on('click', function() {
				// Change active class
				var $val = $(this).attr('data-value'); $('.img-layout').removeClass('active'); $(this).addClass('active');
				// Set value for select
				$('#wpbody #dbea_layouttype').val($val);
				if( typeof $('#wpbody #dbea_layouttype').attr('data-selected') != 'undefined' ){
					$('#wpbody #dbea_layouttype').attr('data-selected', $val);
				}
				// Hide or show field codition
				showHideDependLayout($val);
			});
		});
		//
		if ( $('#page_template').val() == 'fullwidth.php' || $('#page_template').val() == 'sidepage.php' ){
			$('#sns_layout').fadeOut(500);
		}else{
			$('#sns_layout').fadeIn(500);
		}
		
		$('#page_template').change(function(){
			if( $(this).val() == 'fullwidth.php' || $('#page_template').val() == 'sidepage.php' ){
				$('#sns_layout').fadeOut(500);
			}else{
				$('#sns_layout').fadeIn(500);
			}
		})
		function showHideDependLayout($val){
			if( $val == 'm' ){
				$('#wpbody #dbea_leftsidebar').parents('.rwmb-select-wrapper').stop(true,true).fadeOut(500);
				$('#wpbody #dbea_rightsidebar').parents('.rwmb-select-wrapper').stop(true,true).fadeOut(500);
			}else if( $val == 'l-m' ){
				$('#wpbody #dbea_leftsidebar').parents('.rwmb-select-wrapper').stop(true,true).fadeIn(500);
				$('#wpbody #dbea_rightsidebar').parents('.rwmb-select-wrapper').stop(true,true).fadeOut(500);
			}else if( $val == 'm-r' ){
				$('#wpbody #dbea_rightsidebar').parents('.rwmb-select-wrapper').stop(true,true).fadeIn(500);
				$('#wpbody #dbea_leftsidebar').parents('.rwmb-select-wrapper').stop(true,true).fadeOut(500);
			}
		}
		// Enable layout config
		$('#wpbody input[name="dbea_enablelayoutconfig"]').each(function(){
			if( $(this).attr('checked') == 'checked' ) enableLayoutConfig( $(this).val() );
			$(this).change(function(){
				enableLayoutConfig( $(this).val() );console.log($(this).val());
			})
		})
		function enableLayoutConfig($val){
			if( $val == '1' ){
				$('#wpbody #dbea_layouttype').parents('.rwmb-layouttype-wrapper').stop(true,true).fadeIn(500);
				showHideDependLayout($('#dbea_layouttype').val());
			}else{
				$('#wpbody #dbea_leftsidebar').parents('.rwmb-select-wrapper').stop(true,true).fadeOut(500);
				$('#wpbody #dbea_rightsidebar').parents('.rwmb-select-wrapper').stop(true,true).fadeOut(500);
				$('#wpbody #dbea_layouttype').parents('.rwmb-layouttype-wrapper').stop(true,true).fadeOut(500);
			}
		}

		// Breadcumb
		$('#wpbody select[name=dbea_showbreadcrump]').each(function(){
			if ( $(this).val() == '1' ) {
				$('#wpbody input[name=dbea_breadcrumbbg]').parents('.rwmb-image_advanced-wrapper').stop(true,true).fadeIn(500);
			}else {
				$('#wpbody input[name=dbea_breadcrumbbg]').parents('.rwmb-image_advanced-wrapper').stop(true,true).fadeOut(500);
			}
			$(this).change(function(){
				if ( $(this).val() == '1' ) {
					$('#wpbody input[name=dbea_breadcrumbbg]').parents('.rwmb-image_advanced-wrapper').stop(true,true).fadeIn(500);
				}else {
					$('#wpbody input[name=dbea_breadcrumbbg]').parents('.rwmb-image_advanced-wrapper').stop(true,true).fadeOut(500);
				}
			})
		});
		// Revolution
		$('#wpbody input[name=dbea_useslideshow]').each(function(){
			if( $(this).attr('checked') == 'checked' ){
				if ( $(this).val() == '1' ) {
					$('#wpbody select#dbea_revolutionslider').parents('.rwmb-select-wrapper').stop(true,true).fadeIn(500);
				}else {
					$('#wpbody select#dbea_revolutionslider').parents('.rwmb-select-wrapper').stop(true,true).fadeOut(500);
				}
			}
			$(this).change(function(){
				if ( $(this).val() == '1' ) {
					$('#wpbody select#dbea_revolutionslider').parents('.rwmb-select-wrapper').stop(true,true).fadeIn(500);
				}else {
					$('#wpbody select#dbea_revolutionslider').parents('.rwmb-select-wrapper').stop(true,true).fadeOut(500);
				}
			})
		});
		// Theme color
		$('#wpbody input[name=dbea_page_themecolor]').each(function(){
			if( $(this).attr('checked') == 'checked' ){
				if ( $(this).val() == '1' ) {
					$('#wpbody input#dbea_theme_color').parents('.rwmb-color-wrapper').stop(true,true).fadeIn(500);
				}else {
					$('#wpbody input#dbea_theme_color').parents('.rwmb-color-wrapper').stop(true,true).fadeOut(500);
				}
			}
			$(this).change(function(){
				if ( $(this).val() == '1' ) {
					$('#wpbody input#dbea_theme_color').parents('.rwmb-color-wrapper').stop(true,true).fadeIn(500);
				}else {
					$('#wpbody input#dbea_theme_color').parents('.rwmb-color-wrapper').stop(true,true).fadeOut(500);
				}
			})
		});
		// Post format
		if ( wp &&
			wp.data && 
			wp.data.select( 'core/editor' )!= null ) {
			wp.data.subscribe( function () {
				var newFormat = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'format' );
				if( newFormat !== '' ) {
					$('#sns-post-gallery, #sns-post-video, #sns-post-audio, #sns-post-quote, #sns-post-link').each(function(){
						$(this).hide();
					});
					if ( newFormat !== 'standard' ) $('#sns-post-' + newFormat).show();
				}
				return;
			});
		}
	});
})(jQuery);