| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.3/wp-content/plugins/Ultimate_VC_Addons/admin/vc_extend/js/ |
Upload File : |
// JavaScript Document
$ult = jQuery.noConflict();
$ult( '.ultimate-responsive-wrapper' ).each( function ( index, element ) {
const t = $ult( element );
get_responsive_values_in_input( t );
set_responsive_values_in_hidden( t );
} );
/*
* Get hidden field values
*---------------------------------------------------*/
function get_responsive_values_in_input( t ) {
const mv = t.find( '.ultimate-responsive-value' ).val();
/* TOGGLE */
const toggleMedia = new Object();
if ( mv != '' ) {
const vals = mv.split( ';' );
$ult.each( vals, function ( i, vl ) {
if ( vl != '' ) {
t.find( '.ult-responsive-input' ).each( function (
input_index,
elem
) {
const splitval = vl.split( ':' );
const dataid = $ult( elem ).attr( 'data-id' );
if ( dataid == splitval[ 0 ] ) {
const unit = $ult( elem ).attr( 'data-unit' );
mval = splitval[ 1 ].split( unit );
$ult( elem ).val( mval[ 0 ] );
/* TOGGLE */
toggleMedia[ dataid ] = mval[ 0 ];
}
} );
}
} );
/* TOGGLE */
Object.size = function ( obj ) {
let size = 0,
key;
for ( key in obj ) {
if ( obj.hasOwnProperty( key ) ) size++;
}
return size;
};
const size = Object.size( toggleMedia );
if ( size >= 2 ) {
// set toggle data attributes
t.find( '.simplify' ).attr( 'ult-toggle', 'expand' );
t.find(
'.ult-responsive-item.optional, .ultimate-unit-section'
).show();
} else {
t.find( '.simplify' ).attr( 'ult-toggle', 'collapse' );
t.find(
'.ult-responsive-item.optional, .ultimate-unit-section'
).hide();
}
} else {
let i = 0; // set default - Values
t.find( '.ult-responsive-input' ).each( function ( input_index, elem ) {
const d = $ult( elem ).attr( 'data-default' );
if ( d != '' ) {
$ult( elem ).val( d );
i = i + 1;
}
} );
if ( i <= 1 ) {
// set default - Collapse
t.find( '.simplify' ).attr( 'ult-toggle', 'collapse' );
t.find(
'.ult-responsive-item.optional, .ultimate-unit-section'
).hide();
}
}
}
/* TOGGLE CLICK */
$ult( '.simplify' ).on( 'click', function ( e ) {
const t = $ult( this ).closest( '.ultimate-responsive-wrapper' ),
status = $ult( this ).attr( 'ult-toggle' );
switch ( status ) {
case 'expand':
t.find( '.simplify' ).attr( 'ult-toggle', 'collapse' );
t.find(
'.ult-responsive-item.optional, .ultimate-unit-section'
).hide();
break;
case 'collapse':
t.find( '.simplify' ).attr( 'ult-toggle', 'expand' );
t.find(
'.ult-responsive-item.optional, .ultimate-unit-section'
).show();
break;
default:
t.find( '.simplify' ).attr( 'ult-toggle', 'collapse' );
t.find(
'.ult-responsive-item.optional, .ultimate-unit-section'
).hide();
break;
}
} );
/*
* Set hidden field values
*---------------------------------------------------*/
// On change - input / select
$ult( '.ult-responsive-input' ).on( 'change', function ( e ) {
const t = $ult( this ).closest( '.ultimate-responsive-wrapper' );
//alert(t.attr("id"));
set_responsive_values_in_hidden( t );
} );
function set_responsive_values_in_hidden( t ) {
let nval = '';
// add all spacing widths, margins, paddings
t.find( '.ult-responsive-input' ).each( function ( index, elm ) {
const unit = $ult( elm ).attr( 'data-unit' );
const ival = $ult( elm ).val();
if ( $ult.isNumeric( ival ) ) {
if ( ival.match( /^[0-9]+$/ ) )
var item =
$ult( elm ).attr( 'data-id' ) +
':' +
$ult( elm ).val() +
unit +
';';
nval += item;
}
} );
t.find( '.ultimate-responsive-value' ).val( nval );
}