mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-19 06:33:50 +09:00
Mobile work and profile settings
This commit is contained in:
+1569
-1
File diff suppressed because one or more lines are too long
+101
-19
@@ -1,11 +1,3 @@
|
||||
function initCrop_UM() {
|
||||
|
||||
jQuery('.um-single-image-preview.crop img').imgAreaSelect({
|
||||
handles: true,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function initImageUpload_UM( trigger ) {
|
||||
|
||||
if (trigger.data('upload_help_text')){
|
||||
@@ -43,7 +35,7 @@ function initImageUpload_UM( trigger ) {
|
||||
showAbort: false,
|
||||
showDone: false,
|
||||
showFileCounter: false,
|
||||
showStatusAfterSuccess: false,
|
||||
showStatusAfterSuccess: true,
|
||||
onSubmit:function(files){
|
||||
|
||||
trigger.parents('.um-modal-body').find('.um-error-block').remove();
|
||||
@@ -57,24 +49,114 @@ function initImageUpload_UM( trigger ) {
|
||||
if (data.error && data.error != '') {
|
||||
|
||||
trigger.parents('.um-modal-body').append('<div class="um-error-block">'+data.error+'</div>');
|
||||
trigger.parents('.um-modal-body').find('.upload-statusbar').hide(0);
|
||||
um_modal_responsive();
|
||||
|
||||
} else {
|
||||
|
||||
jQuery.each( data, function(key, value) {
|
||||
trigger.parents('.um-modal-body').find('.um-single-image-preview img').attr('src', value);
|
||||
|
||||
var img_id = trigger.parents('.um-modal-body').find('.um-single-image-preview img');
|
||||
var img_id_h = trigger.parents('.um-modal-body').find('.um-single-image-preview');
|
||||
|
||||
img_id.attr("src", value);
|
||||
img_id.load(function(){
|
||||
|
||||
trigger.parents('.um-modal-body').find('.um-modal-btn.um-finish-upload.disabled').removeClass('disabled');
|
||||
trigger.parents('.um-modal-body').find('.ajax-upload-dragdrop,.upload-statusbar').hide(0);
|
||||
img_id_h.show(0);
|
||||
um_modal_responsive();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
trigger.parents('.um-modal-body').find('.ajax-upload-dragdrop').fadeOut( function () {
|
||||
trigger.parents('.um-modal-body').find('.um-single-image-preview').show();
|
||||
trigger.parents('.um-modal-body').find('.um-modal-btn.um-finish-upload.disabled').removeClass('disabled');
|
||||
um_modal_responsive();
|
||||
} );
|
||||
|
||||
initCrop_UM();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function initFileUpload_UM( trigger ) {
|
||||
|
||||
if (trigger.data('upload_help_text')){
|
||||
upload_help_text = '<span class="help">' + trigger.data('upload_help_text') + '</span>';
|
||||
} else {
|
||||
upload_help_text = '';
|
||||
}
|
||||
|
||||
if ( trigger.data('icon') ) {
|
||||
icon = '<span class="icon"><i class="'+ trigger.data('icon') + '"></i></span>';
|
||||
} else {
|
||||
icon = '';
|
||||
}
|
||||
|
||||
if ( trigger.data('upload_text') ) {
|
||||
upload_text = '<span class="str">' + trigger.data('upload_text') + '</span>';
|
||||
} else {
|
||||
upload_text = '';
|
||||
}
|
||||
|
||||
trigger.uploadFile({
|
||||
url: ultimatemember_file_upload_url,
|
||||
method: "POST",
|
||||
multiple: false,
|
||||
formData: {key: trigger.data('key'), set_id: trigger.data('set_id'), set_mode: trigger.data('set_mode') },
|
||||
fileName: trigger.data('key'),
|
||||
allowedTypes: trigger.data('allowed_types'),
|
||||
maxFileSize: trigger.data('max_size'),
|
||||
dragDropStr: icon + upload_text + upload_help_text,
|
||||
sizeErrorStr: trigger.data('max_size_error'),
|
||||
extErrorStr: trigger.data('extension_error'),
|
||||
maxFileCountErrorStr: trigger.data('max_files_error'),
|
||||
maxFileCount: 1,
|
||||
showDelete: false,
|
||||
showAbort: false,
|
||||
showDone: false,
|
||||
showFileCounter: false,
|
||||
showStatusAfterSuccess: true,
|
||||
onSubmit:function(files){
|
||||
|
||||
trigger.parents('.um-modal-body').find('.um-error-block').remove();
|
||||
|
||||
},
|
||||
onSuccess:function(files,data,xhr){
|
||||
|
||||
trigger.selectedFiles = 0;
|
||||
|
||||
data = jQuery.parseJSON(data);
|
||||
if (data.error && data.error != '') {
|
||||
|
||||
trigger.parents('.um-modal-body').append('<div class="um-error-block">'+data.error+'</div>');
|
||||
trigger.parents('.um-modal-body').find('.upload-statusbar').hide(0);
|
||||
um_modal_responsive();
|
||||
|
||||
} else {
|
||||
|
||||
jQuery.each( data, function(key, value) {
|
||||
|
||||
trigger.parents('.um-modal-body').find('.um-modal-btn.um-finish-upload.disabled').removeClass('disabled');
|
||||
trigger.parents('.um-modal-body').find('.ajax-upload-dragdrop,.upload-statusbar').hide(0);
|
||||
trigger.parents('.um-modal-body').find('.um-single-file-preview').show(0);
|
||||
|
||||
if (key == 'icon') {
|
||||
trigger.parents('.um-modal-body').find('.um-single-fileinfo i').removeClass().addClass(value);
|
||||
} else if ( key == 'icon_bg' ) {
|
||||
trigger.parents('.um-modal-body').find('.um-single-fileinfo span.icon').css({'background-color' : value } );
|
||||
} else if ( key == 'filename' ) {
|
||||
trigger.parents('.um-modal-body').find('.um-single-fileinfo span.filename').html(value);
|
||||
} else {
|
||||
trigger.parents('.um-modal-body').find('.um-single-fileinfo a').attr('href', value);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
um_modal_responsive();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
+217
-15
@@ -1,10 +1,103 @@
|
||||
function initCrop_UM() {
|
||||
|
||||
// only when a crop image is in view
|
||||
var target_img = jQuery('.um-modal:visible .um-single-image-preview.crop img');
|
||||
var target_img_parent = jQuery('.um-modal:visible .um-single-image-preview.crop');
|
||||
|
||||
var crop_data = target_img.parent().attr('data-crop');
|
||||
var min_width = target_img.parent().attr('data-min_width');
|
||||
var min_height = target_img.parent().attr('data-min_height');
|
||||
var ratio = target_img.parent().attr('data-ratio');
|
||||
|
||||
// custom defined ratio maybe
|
||||
if ( jQuery('.um-modal').find('#um_upload_single').attr('data-ratio') ) {
|
||||
var ratio = jQuery('.um-modal').find('#um_upload_single').attr('data-ratio');
|
||||
var ratio_split = ratio.split(':');
|
||||
var ratio = ratio_split[0];
|
||||
}
|
||||
|
||||
if ( target_img.length ) {
|
||||
|
||||
if ( target_img.attr('src') != '' ) {
|
||||
|
||||
var max_height = jQuery(window).height() - ( jQuery('.um-modal-footer a').height() + 20 ) - 50 - ( jQuery('.um-modal-header:visible').height() );
|
||||
|
||||
target_img.css({'height' : 'auto'});
|
||||
target_img_parent.css({'height' : 'auto'});
|
||||
|
||||
if ( jQuery(window).height() <= 400 ) {
|
||||
target_img_parent.css({ 'height': max_height +'px', 'max-height' : max_height + 'px' });
|
||||
target_img.css({ 'height' : 'auto' });
|
||||
} else {
|
||||
target_img.css({ 'height': 'auto', 'max-height' : max_height + 'px' });
|
||||
target_img_parent.css({ 'height': target_img.height(), 'max-height' : max_height + 'px' });
|
||||
}
|
||||
|
||||
if ( crop_data == 'square' ) {
|
||||
|
||||
var opts = {
|
||||
minWidth: min_width,
|
||||
minHeight: min_height,
|
||||
dragCrop: false,
|
||||
aspectRatio: 1.0,
|
||||
zoomable: false,
|
||||
rotatable: false,
|
||||
dashed: false,
|
||||
done: function(data) {
|
||||
target_img.parent().attr('data-coord', Math.round(data.x) + ',' + Math.round(data.y) + ',' + Math.round(data.width) + ',' + Math.round(data.height) );
|
||||
}
|
||||
};
|
||||
|
||||
} else if ( crop_data == 'cover' ) {
|
||||
|
||||
var opts = {
|
||||
minWidth: min_width,
|
||||
minHeight: Math.round( min_width / ratio ),
|
||||
dragCrop: false,
|
||||
aspectRatio: ratio,
|
||||
zoomable: false,
|
||||
rotatable: false,
|
||||
dashed: false,
|
||||
done: function(data) {
|
||||
target_img.parent().attr('data-coord', Math.round(data.x) + ',' + Math.round(data.y) + ',' + Math.round(data.width) + ',' + Math.round(data.height) );
|
||||
}
|
||||
};
|
||||
|
||||
} else {
|
||||
|
||||
var opts = {
|
||||
dragCrop: true,
|
||||
aspectRatio: "auto",
|
||||
zoomable: false,
|
||||
rotatable: false,
|
||||
dashed: false,
|
||||
done: function(data) {
|
||||
target_img.parent().attr('data-coord', Math.round(data.x) + ',' + Math.round(data.y) + ',' + Math.round(data.width) + ',' + Math.round(data.height) );
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
target_img.cropper( opts );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function um_new_modal( id, size ){
|
||||
|
||||
var modal = jQuery('body').find('.um-modal-overlay');
|
||||
|
||||
jQuery('.tipsy').hide();
|
||||
|
||||
jQuery('.um-dropdown').hide();
|
||||
|
||||
jQuery('body,html').css("overflow", "hidden");
|
||||
|
||||
jQuery(document).bind("touchmove", function(e){e.preventDefault();});
|
||||
jQuery('.um-modal').on('touchmove', function(e){e.stopPropagation();});
|
||||
|
||||
jQuery('body').append('<div class="um-modal-overlay" /><div class="um-modal" />');
|
||||
|
||||
jQuery('#' + id).prependTo('.um-modal');
|
||||
@@ -14,6 +107,8 @@ function um_new_modal( id, size ){
|
||||
um_modal_size( size );
|
||||
|
||||
initImageUpload_UM( jQuery('.um-modal:visible').find('.um-single-image-upload') );
|
||||
|
||||
initFileUpload_UM( jQuery('.um-modal:visible').find('.um-single-file-upload') );
|
||||
|
||||
um_modal_responsive();
|
||||
|
||||
@@ -22,13 +117,9 @@ function um_new_modal( id, size ){
|
||||
function um_modal_responsive() {
|
||||
|
||||
var modal = jQuery('.um-modal:visible');
|
||||
|
||||
|
||||
if ( modal.length ) {
|
||||
|
||||
var window_height_diff = jQuery(window).height() - modal.innerHeight();
|
||||
|
||||
var half_gap = window_height_diff / 2 + 'px';
|
||||
|
||||
|
||||
var element_width = jQuery(window).width();
|
||||
|
||||
modal.removeClass('uimob340');
|
||||
@@ -37,35 +128,49 @@ function um_modal_responsive() {
|
||||
if ( element_width <= 340 ) {
|
||||
|
||||
modal.addClass('uimob340');
|
||||
initCrop_UM();
|
||||
modal.animate({ 'bottom' : 0 }, 300);
|
||||
|
||||
} else if ( element_width <= 500 ) {
|
||||
|
||||
modal.addClass('uimob500');
|
||||
initCrop_UM();
|
||||
modal.animate({ 'bottom' : 0 }, 300);
|
||||
|
||||
} else if ( element_width <= 800 ) {
|
||||
|
||||
initCrop_UM();
|
||||
var half_gap = ( jQuery(window).height() - modal.innerHeight() ) / 2 + 'px';
|
||||
modal.animate({ 'bottom' : half_gap }, 300);
|
||||
|
||||
} else if ( element_width <= 960 ) {
|
||||
|
||||
initCrop_UM();
|
||||
var half_gap = ( jQuery(window).height() - modal.innerHeight() ) / 2 + 'px';
|
||||
modal.animate({ 'bottom' : half_gap }, 300);
|
||||
|
||||
} else if ( element_width > 960 ) {
|
||||
|
||||
initCrop_UM();
|
||||
var half_gap = ( jQuery(window).height() - modal.innerHeight() ) / 2 + 'px';
|
||||
modal.animate({ 'bottom' : half_gap }, 300);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function um_remove_modal(){
|
||||
jQuery('.um-single-image-preview.crop img').imgAreaSelect({ hide: true });
|
||||
|
||||
jQuery('.um-single-image-preview img').cropper("destroy");
|
||||
|
||||
jQuery('body,html').css("overflow", "auto");
|
||||
|
||||
jQuery(document).unbind('touchmove');
|
||||
|
||||
jQuery('.um-modal div[id^="um_"]').hide().appendTo('body');
|
||||
jQuery('.um-modal,.um-modal-overlay').remove();
|
||||
|
||||
}
|
||||
|
||||
function um_modal_size( aclass ) {
|
||||
@@ -97,6 +202,25 @@ jQuery(document).ready(function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
remove uploaded file
|
||||
**/
|
||||
jQuery(document).on('click', '.um-modal .um-single-file-preview a.cancel', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
var parent = jQuery(this).parents('.um-modal-body');
|
||||
|
||||
parent.find('.um-single-file-preview').hide();
|
||||
|
||||
parent.find('.ajax-upload-dragdrop').show();
|
||||
|
||||
parent.find('.um-modal-btn.um-finish-upload').addClass('disabled');
|
||||
|
||||
um_modal_responsive();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
remove uploaded image
|
||||
**/
|
||||
@@ -105,6 +229,10 @@ jQuery(document).ready(function() {
|
||||
|
||||
var parent = jQuery(this).parents('.um-modal-body');
|
||||
|
||||
parent.find('.um-single-image-preview img').cropper("destroy");
|
||||
|
||||
parent.find('.um-single-image-preview img').attr('src', '');
|
||||
|
||||
parent.find('.um-single-image-preview').hide();
|
||||
|
||||
parent.find('.ajax-upload-dragdrop').show();
|
||||
@@ -117,19 +245,80 @@ jQuery(document).ready(function() {
|
||||
});
|
||||
|
||||
/**
|
||||
finish upload
|
||||
finish file upload
|
||||
**/
|
||||
jQuery(document).on('click', '.um-finish-upload', function(){
|
||||
jQuery(document).on('click', '.um-finish-upload.file', function(){
|
||||
|
||||
var key = jQuery(this).attr('data-key');
|
||||
|
||||
var src = jQuery(this).parents('.um-modal-body').find('.um-single-image-preview img').attr('src');
|
||||
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').fadeIn().find('img').attr('src', src);
|
||||
var preview = jQuery(this).parents('.um-modal-body').find('.um-single-file-preview').html();
|
||||
|
||||
um_remove_modal();
|
||||
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('.um-btn-auto-width').html('Change/Modify Photo');
|
||||
jQuery('.um-single-file-preview[data-key='+key+']').fadeIn().html( preview );
|
||||
|
||||
jQuery('.um-single-file-preview[data-key='+key+']').parents('.um-field').find('.um-btn-auto-width').html( jQuery(this).attr('data-change') );
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
finish image upload
|
||||
**/
|
||||
jQuery(document).on('click', '.um-finish-upload.image', function(){
|
||||
|
||||
var elem = jQuery(this);
|
||||
var key = jQuery(this).attr('data-key');
|
||||
var img_c = jQuery(this).parents('.um-modal-body').find('.um-single-image-preview');
|
||||
var src = img_c.find('img').attr('src');
|
||||
var coord = img_c.attr('data-coord');
|
||||
|
||||
if ( jQuery(this).parents('#um_upload_single').attr('data-user_id') ) {
|
||||
var user_id = jQuery(this).parents('#um_upload_single').attr('data-user_id');
|
||||
} else {
|
||||
var user_id = 0;
|
||||
}
|
||||
|
||||
if ( coord ) { // crop image first before processing
|
||||
|
||||
jQuery(this).html( jQuery(this).attr('data-processing') ).addClass('disabled');
|
||||
|
||||
jQuery.ajax({
|
||||
url: ultimatemember_ajax_url,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'ultimatemember_resize_image',
|
||||
src : src,
|
||||
coord : coord,
|
||||
user_id : user_id,
|
||||
key: key,
|
||||
},
|
||||
success: function(data){
|
||||
|
||||
d = new Date();
|
||||
|
||||
if ( key == 'profile_photo') {
|
||||
jQuery('.um-profile-photo-img img').attr('src', data + "?"+d.getTime());
|
||||
}
|
||||
|
||||
if ( key == 'cover_photo') {
|
||||
jQuery('.um-cover-e').empty().html('<a href="#"><img src="' + data + "?"+d.getTime() + '" alt="" /></a>');
|
||||
jQuery('.um-cover-overlay').show();
|
||||
}
|
||||
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').fadeIn().find('img').attr('src', data + "?"+d.getTime());
|
||||
um_remove_modal();
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('.um-btn-auto-width').html( elem.attr('data-change') );
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
d = new Date();
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').fadeIn().find('img').attr('src', src + "?"+d.getTime());
|
||||
um_remove_modal();
|
||||
jQuery('.um-single-image-preview[data-key='+key+']').parents('.um-field').find('.um-btn-auto-width').html( elem.attr('data-change') );
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -148,6 +337,19 @@ jQuery(document).ready(function() {
|
||||
|
||||
if ( jQuery(this).data('modal-copy') ) {
|
||||
jQuery('#' + modal_id).html( jQuery(this).parents('.um-field').find('.um-modal-hidden-content').html() );
|
||||
|
||||
if ( jQuery(this).parents('.um-profile-photo').attr('data-user_id') ) {
|
||||
jQuery('#' + modal_id).attr('data-user_id', jQuery(this).parents('.um-profile-photo').attr('data-user_id') );
|
||||
}
|
||||
|
||||
if ( jQuery(this).parents('.um-cover').attr('data-ratio') ) {
|
||||
jQuery('#' + modal_id).attr('data-ratio', jQuery(this).parents('.um-cover').attr('data-ratio') );
|
||||
}
|
||||
|
||||
if ( jQuery(this).parents('.um-cover').attr('data-user_id') ) {
|
||||
jQuery('#' + modal_id).attr('data-user_id', jQuery(this).parents('.um-cover').attr('data-user_id') );
|
||||
}
|
||||
|
||||
um_new_modal( modal_id, size );
|
||||
} else {
|
||||
um_new_modal( modal_id, size );
|
||||
|
||||
@@ -8,5 +8,57 @@ jQuery(document).ready(function() {
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
/* No need to allow # */
|
||||
jQuery(document).on('click', '.um-cover a', function(e){
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
/* Reset profile photo */
|
||||
jQuery(document).on('click', '.um-reset-profile-photo', function(e){
|
||||
|
||||
jQuery('.um-profile-photo-img img').attr('src', jQuery(this).attr('data-default_src') );
|
||||
|
||||
user_id = jQuery(this).attr('data-user_id');
|
||||
metakey = 'profile_photo';
|
||||
|
||||
jQuery.ajax({
|
||||
url: ultimatemember_ajax_url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'ultimatemember_delete_profile_photo',
|
||||
metakey: metakey,
|
||||
user_id: user_id
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/* Reset cover photo */
|
||||
jQuery(document).on('click', '.um-reset-cover-photo', function(e){
|
||||
|
||||
jQuery('.um-cover-overlay').hide();
|
||||
|
||||
jQuery('.um-cover-e').html('<a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus-add um-tip-n" title="Upload a cover photo"></i></span></a>');
|
||||
|
||||
jQuery('.um-dropdown').hide();
|
||||
|
||||
um_responsive();
|
||||
|
||||
user_id = jQuery(this).attr('data-user_id');
|
||||
metakey = 'cover_photo';
|
||||
|
||||
jQuery.ajax({
|
||||
url: ultimatemember_ajax_url,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'ultimatemember_delete_cover_photo',
|
||||
metakey: metakey,
|
||||
user_id: user_id
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,5 +1,57 @@
|
||||
function um_responsive(){
|
||||
function UM_domenus(){
|
||||
|
||||
jQuery('.um-dropdown').each(function(){
|
||||
|
||||
var menu = jQuery(this);
|
||||
var element = jQuery(this).attr('data-element');
|
||||
var position = jQuery(this).attr('data-position');
|
||||
|
||||
jQuery(element).addClass('um-trigger-menu-on-'+menu.attr('data-trigger'));
|
||||
|
||||
if ( position == 'bc' ){
|
||||
|
||||
if ( 200 > jQuery(element).find('img').width() ) {
|
||||
left_p = ( ( jQuery(element).width() - jQuery(element).find('img').width() ) / 2 ) + ( ( jQuery(element).find('img').width() - 200 ) / 2 );
|
||||
} else {
|
||||
left_p = ( ( jQuery(element).width() - jQuery(element).find('img').width() ) / 2 );
|
||||
}
|
||||
|
||||
top_ = parseInt( jQuery(element).find('a').css('top') );
|
||||
|
||||
if ( top_ ) {
|
||||
top_p = jQuery(element).find('img').height() + 4 + top_;
|
||||
left_gap = 4;
|
||||
} else {
|
||||
top_p = jQuery(element).find('img').height() + 4;
|
||||
left_gap = 0;
|
||||
}
|
||||
|
||||
if ( top_p == 4 && element == 'div.um-cover' ) {
|
||||
top_p = jQuery(element).height() / 2 + ( menu.height() / 2 );
|
||||
}
|
||||
|
||||
menu.css({
|
||||
'top' : top_p,
|
||||
'width': 200,
|
||||
'left': left_p + left_gap,
|
||||
'text-align' : 'center',
|
||||
});
|
||||
|
||||
menu.find('.um-dropdown-arr').find('i').addClass('um-icon-arrow-sans-up');
|
||||
|
||||
menu.find('.um-dropdown-arr').css({
|
||||
'top' : '-18px',
|
||||
'left' : ( menu.width() / 2 ) - 12,
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function um_responsive(){
|
||||
|
||||
// responsive um shortcode
|
||||
jQuery('.um').each(function(){
|
||||
|
||||
element_width = jQuery(this).width();
|
||||
@@ -48,19 +100,39 @@ function um_responsive(){
|
||||
jQuery(this).removeClass('uimob960');
|
||||
|
||||
}
|
||||
|
||||
jQuery('.um-members').each(function(){
|
||||
UM_Member_Grid( jQuery(this) );
|
||||
});
|
||||
|
||||
// account nav
|
||||
if ( jQuery('.um-account-nav').length > 0 && jQuery('.um-account-side').is(':visible') && jQuery('.um-account-tab:visible').length == 0 ) {
|
||||
jQuery('.um-account-side li a.current').trigger('click');
|
||||
}
|
||||
|
||||
// show
|
||||
jQuery(this).css('opacity',1);
|
||||
|
||||
});
|
||||
|
||||
// responsive cover
|
||||
jQuery('.um-cover, .um-member-cover').each(function(){
|
||||
|
||||
var elem = jQuery(this);
|
||||
var ratio = elem.data('ratio');
|
||||
var width = elem.width();
|
||||
var ratios = ratio.split(':');
|
||||
|
||||
calcHeight = Math.round( width / ratios[0] ) + 'px';
|
||||
elem.height( calcHeight );
|
||||
elem.find('.um-cover-add').height( calcHeight );
|
||||
|
||||
});
|
||||
|
||||
// members directory
|
||||
jQuery('.um-members').each(function(){
|
||||
UM_Member_Grid( jQuery(this) );
|
||||
});
|
||||
|
||||
// menus
|
||||
UM_domenus();
|
||||
|
||||
}
|
||||
|
||||
/* Run only when window is loaded */
|
||||
@@ -74,6 +146,8 @@ jQuery(window).load(function() {
|
||||
/* Run only when window is resized */
|
||||
jQuery(window).resize(function() {
|
||||
|
||||
jQuery('.um-single-image-preview.crop:visible img').cropper("destroy");
|
||||
|
||||
um_responsive();
|
||||
um_modal_responsive();
|
||||
|
||||
|
||||
+38
-100
@@ -1,12 +1,40 @@
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
/* Tooltips */
|
||||
/* dropdown menu links */
|
||||
jQuery(document).on('click', '.um-dropdown a', function(e){
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
/* trigger dropdown on click */
|
||||
jQuery(document).on('click', '.um-trigger-menu-on-click', function(e){
|
||||
e.preventDefault();
|
||||
jQuery('.um-dropdown').hide();
|
||||
menu = jQuery(this).find('.um-dropdown');
|
||||
menu.show();
|
||||
return false;
|
||||
});
|
||||
|
||||
/* hide dropdown */
|
||||
jQuery(document).on('click', '.um-dropdown-hide', function(e){
|
||||
menu = jQuery(this).parents('.um-dropdown');
|
||||
menu.hide();
|
||||
});
|
||||
|
||||
/* manual triggers */
|
||||
jQuery(document).on('click', 'a.um-manual-trigger', function(){
|
||||
var child = jQuery(this).attr('data-child');
|
||||
var parent = jQuery(this).attr('data-parent');
|
||||
jQuery(this).parents( parent ).find( child ).trigger('click');
|
||||
});
|
||||
|
||||
/* tooltips */
|
||||
jQuery('.um-tip-n').tipsy({gravity: 'n', opacity: 1, live: true, offset: 3 });
|
||||
jQuery('.um-tip-w').tipsy({gravity: 'w', opacity: 1, live: true, offset: 3 });
|
||||
jQuery('.um-tip-e').tipsy({gravity: 'e', opacity: 1, live: true, offset: 3 });
|
||||
jQuery('.um-tip-s').tipsy({gravity: 's', opacity: 1, live: true, offset: 3 });
|
||||
|
||||
/* Custom Radio Buttons */
|
||||
/* custom radio buttons */
|
||||
jQuery('.um-field-radio').mouseenter(function(){
|
||||
if (!jQuery(this).hasClass('active')) {
|
||||
jQuery(this).find('i').removeClass().addClass('um-icon-check-3');
|
||||
@@ -26,7 +54,7 @@ jQuery(document).ready(function() {
|
||||
this_field.find('i').removeClass('um-icon-blank').addClass('um-icon-check-3');
|
||||
});
|
||||
|
||||
/* Custom Checkbox Buttons */
|
||||
/* custom checkbox buttons */
|
||||
jQuery('.um-field-checkbox').mouseenter(function(){
|
||||
if (!jQuery(this).hasClass('active')) {
|
||||
jQuery(this).find('i').removeClass().addClass('um-icon-cross');
|
||||
@@ -51,7 +79,7 @@ jQuery(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
/* Date picker */
|
||||
/* datepicker */
|
||||
jQuery('.um-datepicker').pickadate({
|
||||
min: [1900,1,1],
|
||||
max: true,
|
||||
@@ -60,7 +88,7 @@ jQuery(document).ready(function() {
|
||||
hiddenSuffix: '__true'
|
||||
});
|
||||
|
||||
/* Time picker */
|
||||
/* timepicker */
|
||||
jQuery('.um-timepicker').pickatime({
|
||||
formatSubmit: 'HH:i',
|
||||
hiddenSuffix: '__true'
|
||||
@@ -95,108 +123,18 @@ jQuery(document).ready(function() {
|
||||
/* remove uploaded image */
|
||||
jQuery(document).on('click', '.um .um-single-image-preview a.cancel', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
var parent = jQuery(this).parents('.um-field');
|
||||
|
||||
parent.find('.um-single-image-preview').hide();
|
||||
|
||||
parent.find('.um-btn-auto-width').html('Upload');
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
/* File Upload */
|
||||
jQuery(".um-single-file-upload").each(function(){
|
||||
|
||||
var trigger = jQuery(this);
|
||||
|
||||
if (trigger.data('upload_help_text')){
|
||||
upload_help_text = '<span class="help">' + trigger.data('upload_help_text') + '</span>';
|
||||
} else {
|
||||
upload_help_text = '';
|
||||
}
|
||||
|
||||
if ( trigger.data('icon') ) {
|
||||
icon = '<span class="icon"><i class="'+ trigger.data('icon') + '"></i></span>';
|
||||
} else {
|
||||
icon = '';
|
||||
}
|
||||
|
||||
if ( trigger.data('upload_text') ) {
|
||||
upload_text = '<span class="str">' + trigger.data('upload_text') + '</span>';
|
||||
} else {
|
||||
upload_text = '';
|
||||
}
|
||||
|
||||
trigger.uploadFile({
|
||||
url: ultimatemember_file_upload_url,
|
||||
method: "POST",
|
||||
multiple: false,
|
||||
formData: {key: trigger.data('key'), set_id: trigger.data('set_id'), set_mode: trigger.data('set_mode') },
|
||||
fileName: trigger.data('key'),
|
||||
allowedTypes: trigger.data('allowed_types'),
|
||||
maxFileSize: trigger.data('max_size'),
|
||||
dragDropStr: icon + upload_text + upload_help_text,
|
||||
sizeErrorStr: trigger.data('max_size_error'),
|
||||
extErrorStr: trigger.data('extension_error'),
|
||||
maxFileCountErrorStr: trigger.data('max_files_error'),
|
||||
maxFileCount: 1,
|
||||
showDelete: false,
|
||||
showAbort: false,
|
||||
showDone: false,
|
||||
showFileCounter: false,
|
||||
showStatusAfterSuccess: false,
|
||||
onSubmit:function(files){
|
||||
|
||||
trigger.parents('.um-field').find('.um-error-block').remove();
|
||||
|
||||
},
|
||||
onSuccess:function(files,data,xhr){
|
||||
|
||||
trigger.selectedFiles = 0;
|
||||
|
||||
data = jQuery.parseJSON(data);
|
||||
if (data.error && data.error != '') {
|
||||
|
||||
trigger.parents('.um-field').append('<div class="um-error-block">'+data.error+'</div>');
|
||||
|
||||
} else {
|
||||
|
||||
trigger.parents('.um-field').find('.ajax-upload-dragdrop').fadeOut( function() {
|
||||
trigger.parents('.um-field').find('.um-single-file-preview').fadeIn();
|
||||
});
|
||||
|
||||
jQuery.each( data, function(key, value) {
|
||||
|
||||
if (key == 'icon') {
|
||||
trigger.parents('.um-field').find('.um-single-fileinfo i').removeClass().addClass(value);
|
||||
} else if ( key == 'icon_bg' ) {
|
||||
trigger.parents('.um-field').find('.um-single-fileinfo span.icon').css({'background-color' : value } );
|
||||
} else if ( key == 'filename' ) {
|
||||
trigger.parents('.um-field').find('.um-single-fileinfo span.filename').html(value);
|
||||
} else {
|
||||
trigger.parents('.um-field').find('.um-single-fileinfo a').attr('href', value);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/* Remove a single file upload */
|
||||
jQuery(document).on('click', '.um-single-file-preview a.cancel', function(e){
|
||||
/* remove uploaded file */
|
||||
jQuery(document).on('click', '.um .um-single-file-preview a.cancel', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
var trigger = jQuery(this).parents('.um-field').find('.um-single-file-upload');
|
||||
|
||||
trigger.parents('.um-field').find('.um-single-file-preview').fadeOut(function(){
|
||||
trigger.parents('.um-field').find('.ajax-upload-dragdrop').fadeIn();
|
||||
});
|
||||
|
||||
var parent = jQuery(this).parents('.um-field');
|
||||
parent.find('.um-single-file-preview').hide();
|
||||
parent.find('.um-btn-auto-width').html('Upload');
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user