first commit

This commit is contained in:
DESKTOP-GBA0BK8\Admin
2023-04-08 12:19:53 -04:00
commit 7c8c8b1c76
4586 changed files with 2050693 additions and 0 deletions
@@ -0,0 +1,90 @@
<?php
/**
* Customizer Control: oceanwp-range.
*
* @package OceanWP WordPress theme
* @subpackage Controls
* @since 1.0
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Range control
*/
class OceanWP_Customizer_Range_Control extends WP_Customize_Control {
/**
* The control type.
*
* @access public
* @var string
*/
public $type = 'oceanwp-range';
/**
* Enqueue control related scripts/styles.
*
* @access public
*/
public function enqueue() {
wp_enqueue_script( 'oceanwp-range', OCEANWP_INC_DIR_URI . 'customizer/assets/min/js/range.min.js', array( 'jquery', 'customize-base' ), false, true );
wp_enqueue_style( 'oceanwp-range', OCEANWP_INC_DIR_URI . 'customizer/assets/min/css/range.min.css', null );
}
/**
* Refresh the parameters passed to the JavaScript via JSON.
*
* @see WP_Customize_Control::to_json()
*/
public function to_json() {
parent::to_json();
if ( isset( $this->default ) ) {
$this->json['default'] = $this->default;
} else {
$this->json['default'] = $this->setting->default;
}
$this->json['value'] = $this->value();
$this->json['choices'] = $this->choices;
$this->json['link'] = $this->get_link();
$this->json['id'] = $this->id;
$this->json['inputAttrs'] = '';
foreach ( $this->input_attrs as $attr => $value ) {
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
}
}
/**
* An Underscore (JS) template for this control's content (but not its container).
*
* Class variables for this control class are available in the `data` JS object;
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
*
* @see WP_Customize_Control::print_template()
*
* @access protected
*/
protected function content_template() {
?>
<label>
<# if ( data.label ) { #>
<span class="customize-control-title">{{{ data.label }}}</span>
<# } #>
<# if ( data.description ) { #>
<span class="description customize-control-description">{{{ data.description }}}</span>
<# } #>
<div class="control-wrap">
<input type="range" {{{ data.inputAttrs }}} value="{{ data.value }}" {{{ data.link }}} data-reset_value="{{ data.default }}" />
<input type="number" {{{ data.inputAttrs }}} class="oceanwp-range-input" value="{{ data.value }}" />
<span class="oceanwp-reset-slider"><span class="dashicons dashicons-image-rotate"></span></span>
</div>
</label>
<?php
}
}
@@ -0,0 +1,19 @@
.customize-control-oceanwp-range .control-wrap { display: -webkit-box; display: -ms-flexbox; display: flex; flex-wrap: wrap; -webkit-align-items: center; align-items: center; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
.customize-control-oceanwp-range input[type=range] { background-color: rgba(0, 0, 0, 0.1); height: 5px; width: 69%; padding: 0; cursor: pointer; -webkit-transition: background .5s; -moz-transition: background .5s; transition: background .5s; -webkit-appearance: none; }
.customize-control-oceanwp-range input[type="range"]:focus { box-shadow: none !important; outline: none !important; }
.customize-control-oceanwp-range input[type="range"]:hover { background-color: rgba(0, 0, 0, 0.15); }
.customize-control-oceanwp-range input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; background-color: #2e86b9; width: 15px; height: 15px; border-radius: 15px; -webkit-border-radius: 15px; }
.customize-control-oceanwp-range input[type="range"]::-moz-range-track { border: inherit; background-color: transparent; }
.customize-control-oceanwp-range input[type="range"]::-ms-track { border: inherit; color: transparent; background-color: transparent; }
.customize-control-oceanwp-range input[type="range"]::-ms-fill-lower,
.customize-control-oceanwp-range input[type="range"]::-ms-fill-upper { background-color: transparent; }
.customize-control-oceanwp-range input[type="range"]::-ms-tooltip { display: none; }
.customize-control-oceanwp-range input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border: none; border-radius: 15px; background-color: #2e86b9; }
.customize-control-oceanwp-range input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border: none; border-radius: 15px; background-color: #2e86b9; }
.customize-control-oceanwp-range input[type="range"]::-ms-thumb { width: 15px; height: 15px; border-radius: 15px; border: 0; background-color: #2e86b9; }
.customize-control-oceanwp-range input.oceanwp-range-input { width: 21%; height: 28px; text-align: center; margin-left: 2%; border-radius: 4px; padding: 3px; font-size: 12px; font-weight: 600; color: #555; -moz-appearance: textfield; }
.customize-control-oceanwp-range input.oceanwp-range-input::-webkit-outer-spin-button,
.customize-control-oceanwp-range input.oceanwp-range-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.customize-control-oceanwp-range span.oceanwp-reset-slider { display: inline-block; position: relative; width: 6%; margin-left: 2%; line-height: 1; color: rgba(0, 0, 0, 0.2); cursor: pointer; text-align: center; transition: all .3s ease; -webkit-transition: all .3s ease; -moz-transition: all .3s ease; -o-transition: all .3s ease; -ms-transition: all .3s ease; }
.customize-control-oceanwp-range span.oceanwp-reset-slider:hover { color: #fe5252; }
.customize-control-oceanwp-range span.oceanwp-reset-slider span { width: 16px; height: 16px; font-size: 16px; line-height: 1; }
@@ -0,0 +1,109 @@
wp.customize.controlConstructor['oceanwp-range'] = wp.customize.Control.extend({
ready: function() {
'use strict';
var control = this,
range,
range_input,
value,
this_input,
input_default,
changeAction,
oceanwp_range_input_number_timeout;
// Update the text value
jQuery( 'input[type=range]' ).on( 'mousedown', function() {
range = jQuery( this );
range_input = range.parent().children( '.oceanwp-range-input' );
value = range.attr( 'value' );
range_input.val( value );
range.mousemove( function() {
value = range.attr( 'value' );
range_input.val( value );
} );
} );
// Auto correct the number input
function oceanwp_autocorrect_range_input_number( input_number, timeout ) {
var range_input = input_number,
range = range_input.parent().find( 'input[type="range"]' ),
value = parseFloat( range_input.val() ),
reset = parseFloat( range.attr( 'data-reset_value' ) ),
step = parseFloat( range_input.attr( 'step' ) ),
min = parseFloat( range_input.attr( 'min') ),
max = parseFloat( range_input.attr( 'max') );
clearTimeout( oceanwp_range_input_number_timeout );
oceanwp_range_input_number_timeout = setTimeout( function() {
if ( isNaN( value ) ) {
range_input.val( reset );
range.val( reset ).trigger( 'change' );
return;
}
if ( step >= 1 && value % 1 !== 0 ) {
value = Math.round( value );
range_input.val( value );
range.val( value );
}
if ( value > max ) {
range_input.val( max );
range.val( max ).trigger( 'change' );
}
if ( value < min ) {
range_input.val( min );
range.val( min ).trigger( 'change' );
}
}, timeout );
range.val( value ).trigger( 'change' );
}
// Change the text value
jQuery( 'input.oceanwp-range-input' ).on( 'change keyup', function() {
oceanwp_autocorrect_range_input_number( jQuery( this ), 1000);
} ).on( 'focusout', function() {
oceanwp_autocorrect_range_input_number( jQuery( this ), 0);
} );
// Handle the reset button
jQuery( '.oceanwp-reset-slider' ).on('click', function() {
this_input = jQuery( this ).closest( 'label' ).find( 'input' );
input_default = this_input.data( 'reset_value' );
this_input.val( input_default );
this_input.change();
} );
if ( 'postMessage' === control.setting.transport ) {
changeAction = 'mousemove change';
} else {
changeAction = 'change';
}
// Change the value
this.container.on( changeAction, 'input', function() {
control.setting.set( jQuery( this ).val() );
});
}
});