mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
- change js for timepicker
This commit is contained in:
+37
-10
@@ -158,6 +158,17 @@ function um_get_current_page( directory ) {
|
||||
return page;
|
||||
}
|
||||
|
||||
function um_time_convert( time, range ) {
|
||||
var hours = Math.floor( time / 60 );
|
||||
var minutes = time % 60;
|
||||
if ( range == 'to' ) {
|
||||
minutes = minutes + 1;
|
||||
}
|
||||
if ( minutes < 10 ) {
|
||||
minutes = '0' + minutes;
|
||||
}
|
||||
return hours + ":" + minutes;
|
||||
}
|
||||
|
||||
function um_ajax_get_members( directory, args ) {
|
||||
|
||||
@@ -955,6 +966,7 @@ jQuery(document.body).ready( function() {
|
||||
|
||||
|
||||
jQuery( document.body ).on( 'click', '.um-directory .um-clear-filters-a', function() {
|
||||
jQuery('.um-search-filter input').val('');
|
||||
var directory = jQuery(this).parents('.um-directory');
|
||||
if ( um_is_directory_busy( directory ) ) {
|
||||
return;
|
||||
@@ -1211,11 +1223,14 @@ jQuery(document.body).ready( function() {
|
||||
//timepicker filter
|
||||
directory.find('.um-timepicker-filter').each( function() {
|
||||
var elem = jQuery(this);
|
||||
var elemWrap = elem.parent();
|
||||
var elemID = elem.attr('id');
|
||||
|
||||
//using arrays formatted as [HOUR,MINUTE]
|
||||
|
||||
var min = elem.data('min');
|
||||
var max = elem.data('max');
|
||||
var min = elem.attr('data-min');
|
||||
var max = elem.attr('data-max');
|
||||
|
||||
var picker_min = min.split(':');
|
||||
var picker_max = max.split(':');
|
||||
|
||||
@@ -1229,6 +1244,7 @@ jQuery(document.body).ready( function() {
|
||||
onOpen: function() { elem.blur(); },
|
||||
onClose: function() { elem.blur(); },
|
||||
onSet: function( context ) {
|
||||
|
||||
var directory = elem.parents('.um-directory');
|
||||
|
||||
if ( um_is_directory_busy( directory ) ) {
|
||||
@@ -1246,27 +1262,36 @@ jQuery(document.body).ready( function() {
|
||||
current_value_from = min;
|
||||
}
|
||||
if ( typeof current_value_to === "undefined" ) {
|
||||
current_value_to = max;
|
||||
max = max.split(':');
|
||||
var minutes = Math.ceil( max[1] ) + 1;
|
||||
current_value_to = max[0] + ':' + minutes;
|
||||
}
|
||||
|
||||
if ( typeof context.select !== 'undefined' ) {
|
||||
var select_val = context.select / 60;
|
||||
var change_val = elem.val();
|
||||
if( select_val < 10 ){
|
||||
select_val = '0' + select_val;
|
||||
}
|
||||
var select_val = um_time_convert( context.select, range );
|
||||
|
||||
if ( range === 'from' ) {
|
||||
current_value_from = select_val + ':00';
|
||||
current_value_from = select_val;
|
||||
} else if ( range === 'to' ) {
|
||||
current_value_to = select_val + ':00';
|
||||
current_value_to = select_val;
|
||||
}
|
||||
} else {
|
||||
if ( range === 'from' ) {
|
||||
current_value_from = min;
|
||||
} else if ( range === 'to' ) {
|
||||
current_value_to = max;
|
||||
max = max.split(':');
|
||||
var minutes = Math.ceil( max[1] ) + 1;
|
||||
current_value_to = max[0] + ':' + minutes;
|
||||
}
|
||||
}
|
||||
// var time = jQuery('#'+elemID).val();
|
||||
// console.log(elemID)
|
||||
// if ( elem.data('range') == 'from' ) {
|
||||
// elemWrap.find('input[data-range="to"]').attr('data-min', time);
|
||||
// } else {
|
||||
// elemWrap.find('input').attr('data-max', time);
|
||||
// }
|
||||
|
||||
um_set_url_from_data( directory, 'filter_' + filter_name + '_from', current_value_from );
|
||||
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', current_value_to );
|
||||
@@ -1282,6 +1307,7 @@ jQuery(document.body).ready( function() {
|
||||
directory.data( 'searched', 1 );
|
||||
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
||||
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1296,6 +1322,7 @@ jQuery(document.body).ready( function() {
|
||||
var arr = query_value.split(':');
|
||||
$picker.set( 'select', arr[0]*60 );
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
um_change_tag( directory );
|
||||
|
||||
Reference in New Issue
Block a user