<?php
/**
 * File to define functions and hooks related to preloader
 * 
 * @package PureNote
 */

if ( ! function_exists( 'purenote_preloader_items' ) ) :

	/**
	 * function to manage the requested preloader items
	 * 
	 * @since 1.0.0
	 */
	function purenote_preloader_items() {
		$purenote_preloader_enable = purenote_get_customizer_option_value( 'purenote_preloader_enable' );

		if ( false === $purenote_preloader_enable ) {
			return;
		}

		$purenote_preloader_style = purenote_get_customizer_option_value( 'purenote_preloader_style' );

?>
		<div id="purenote-preloader" class="preloader-background">
			<div class="preloader-wrapper">
				<?php
					switch ( $purenote_preloader_style ) {
						case 'three_bounce':
				?>
							<div class="purenote-three-bounce">
	                            <div class="purenote-child purenote-bounce1"></div>
	                            <div class="purenote-child purenote-bounce2"></div>
	                            <div class="purenote-child purenote-bounce3"></div>
	                        </div>
				<?php
							break;

						case 'wave':
				?>
							<div class="purenote-wave">
	                            <div class="purenote-rect purenote-rect1"></div>
	                            <div class="purenote-rect purenote-rect2"></div>
	                            <div class="purenote-rect purenote-rect3"></div>
	                            <div class="purenote-rect purenote-rect4"></div>
	                            <div class="purenote-rect purenote-rect5"></div>
	                        </div>
				<?php
							break;

						case 'folding_cube':
				?>
							<div class="purenote-folding-cube">
	                            <div class="purenote-cube1 purenote-cube"></div>
	                            <div class="purenote-cube2 purenote-cube"></div>
	                            <div class="purenote-cube4 purenote-cube"></div>
	                            <div class="purenote-cube3 purenote-cube"></div>
	                        </div>
				<?php
							break;
						
						default:
				?>
							<div class="purenote-three-bounce">
	                            <div class="purenote-child purenote-bounce1"></div>
	                            <div class="purenote-child purenote-bounce2"></div>
	                            <div class="purenote-child purenote-bounce3"></div>
	                        </div>
				<?php
							break;
					}
				?>
			</div><!-- .preloader-wrapper -->
		</div><!-- #purenote-preloader -->
<?php
	}

endif;

add_action( 'purenote_before_page', 'purenote_preloader_items', 5 );