mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-19 06:33:50 +09:00
- fixed the issues with more than 1 modal windows on 1 page (e.g. Image field in profile & Messaging Login popup);
This commit is contained in:
+44
-52
@@ -591,74 +591,62 @@ function initCrop_UM() {
|
||||
|
||||
}
|
||||
|
||||
function um_new_modal( id, size, isPhoto, source ){
|
||||
|
||||
var modal = jQuery('body').find('.um-modal-overlay');
|
||||
|
||||
if ( modal.length == 0 ) {
|
||||
function um_new_modal( id, size, isPhoto, source ) {
|
||||
var modalOverlay = jQuery('.um-modal-overlay');
|
||||
if ( modalOverlay.length !== 0 ) {
|
||||
modalOverlay.hide();
|
||||
modalOverlay.next('.um-modal').hide();
|
||||
}
|
||||
|
||||
jQuery('.tipsy').hide();
|
||||
|
||||
UM.dropdown.hideAll();
|
||||
|
||||
jQuery('body,html,textarea').css("overflow", "hidden");
|
||||
jQuery( 'body,html,textarea' ).css( 'overflow', 'hidden' );
|
||||
|
||||
jQuery(document).bind("touchmove", function(e){e.preventDefault();});
|
||||
jQuery('.um-modal').on('touchmove', function(e){e.stopPropagation();});
|
||||
jQuery( document ).bind( "touchmove", function(e){e.preventDefault();});
|
||||
jQuery( '.um-modal' ).on('touchmove', function(e){e.stopPropagation();});
|
||||
|
||||
var $tpl = jQuery( '<div class="um-modal-overlay"></div><div class="um-modal"></div>' );
|
||||
var $modal = $tpl.filter('.um-modal');
|
||||
$modal.append( jQuery( '#' + id ) );
|
||||
|
||||
jQuery('body').append( $tpl );
|
||||
|
||||
if ( isPhoto ) {
|
||||
jQuery('body').append('<div class="um-modal-overlay"></div><div class="um-modal is-photo"></div>');
|
||||
} else {
|
||||
jQuery('body').append('<div class="um-modal-overlay"></div><div class="um-modal no-photo"></div>');
|
||||
}
|
||||
var photo_ = jQuery('<img src="' + source + '" />'),
|
||||
photo_maxw = jQuery(window).width() - 60,
|
||||
photo_maxh = jQuery(window).height() - jQuery(window).height() * 0.25;
|
||||
|
||||
jQuery('#' + id).prependTo('.um-modal');
|
||||
|
||||
if ( isPhoto ) {
|
||||
|
||||
jQuery('.um-modal').find('.um-modal-photo').html('<img />');
|
||||
|
||||
var photo_ = jQuery('.um-modal-photo img');
|
||||
var photo_maxw = jQuery(window).width() - 60;
|
||||
var photo_maxh = jQuery(window).height() - ( jQuery(window).height() * 0.25 );
|
||||
|
||||
photo_.attr("src", source);
|
||||
photo_.on( 'load', function() {
|
||||
$modal.find('.um-modal-photo').html( photo_ );
|
||||
|
||||
jQuery('#' + id).show();
|
||||
jQuery('.um-modal').show();
|
||||
|
||||
photo_.css({'opacity': 0});
|
||||
photo_.css({'max-width': photo_maxw });
|
||||
photo_.css({'max-height': photo_maxh });
|
||||
|
||||
jQuery('.um-modal').css({
|
||||
$modal.addClass('is-photo').css({
|
||||
'width': photo_.width(),
|
||||
'margin-left': '-' + photo_.width() / 2 + 'px'
|
||||
});
|
||||
}).show().children().show();
|
||||
|
||||
photo_.animate({'opacity' : 1}, 1000);
|
||||
photo_.css({
|
||||
'opacity': 0,
|
||||
'max-width': photo_maxw,
|
||||
'max-height': photo_maxh
|
||||
}).animate({'opacity' : 1}, 1000);
|
||||
|
||||
um_modal_responsive();
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
jQuery('#' + id).show();
|
||||
jQuery('.um-modal').show();
|
||||
$modal.addClass('no-photo').show().children().show();
|
||||
|
||||
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') );
|
||||
initImageUpload_UM( jQuery('.um-modal:visible .um-single-image-upload') );
|
||||
initFileUpload_UM( jQuery('.um-modal:visible .um-single-file-upload') );
|
||||
|
||||
um_modal_responsive();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function um_modal_responsive() {
|
||||
@@ -671,8 +659,8 @@ function um_modal_responsive() {
|
||||
|| document.documentElement.clientHeight
|
||||
|| document.body.clientHeight;
|
||||
|
||||
var modal = jQuery('.um-modal:visible');
|
||||
var photo_modal = jQuery('.um-modal-body.photo:visible');
|
||||
var modal = jQuery('.um-modal:visible').not('.um-modal-hidden');
|
||||
var photo_modal = modal.find('.um-modal-body.photo:visible');
|
||||
|
||||
if ( photo_modal.length ) {
|
||||
|
||||
@@ -687,7 +675,7 @@ function um_modal_responsive() {
|
||||
photo_.css({'max-width': photo_maxw });
|
||||
photo_.css({'max-height': photo_maxh });
|
||||
|
||||
jQuery('.um-modal').css({
|
||||
modal.css({
|
||||
'width': photo_.width(),
|
||||
'margin-left': '-' + photo_.width() / 2 + 'px'
|
||||
});
|
||||
@@ -745,21 +733,25 @@ function um_remove_modal() {
|
||||
|
||||
jQuery(document).unbind('touchmove');
|
||||
|
||||
jQuery('.um-modal div[id^="um_"]').hide().appendTo('body');
|
||||
jQuery('.um-modal,.um-modal-overlay').remove();
|
||||
jQuery('body > .um-modal div[id^="um_"]').hide().appendTo('body');
|
||||
jQuery('body > .um-modal, body > .um-modal-overlay').remove();
|
||||
|
||||
}
|
||||
|
||||
function um_modal_size( aclass ) {
|
||||
|
||||
jQuery('.um-modal:visible').addClass(aclass);
|
||||
|
||||
jQuery('.um-modal:visible').not('.um-modal-hidden').addClass( aclass );
|
||||
}
|
||||
|
||||
/**
|
||||
* Maybe deprecated
|
||||
*
|
||||
* @deprecated since 2.1.16
|
||||
*
|
||||
* @param id
|
||||
* @param value
|
||||
*/
|
||||
function um_modal_add_attr( id, value ) {
|
||||
|
||||
jQuery('.um-modal:visible').data( id, value );
|
||||
|
||||
jQuery('.um-modal:visible').not('.um-modal-hidden').data( id, value );
|
||||
}
|
||||
|
||||
function prepare_Modal() {
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -180,7 +180,7 @@ jQuery(document).ready(function() {
|
||||
var size = 'normal';
|
||||
|
||||
if ( jQuery(this).data('modal-size') ) {
|
||||
var size = jQuery(this).data('modal-size');
|
||||
size = jQuery(this).data('modal-size');
|
||||
}
|
||||
|
||||
if ( jQuery(this).data('modal-copy') ) {
|
||||
@@ -199,17 +199,13 @@ jQuery(document).ready(function() {
|
||||
jQuery('#' + modal_id).attr('data-user_id', jQuery(this).parents('.um-cover').attr('data-user_id') );
|
||||
}
|
||||
|
||||
if( jQuery("input[type=hidden][name='user_id']").length > 0 ){
|
||||
jQuery('#' + modal_id).attr('data-user_id', jQuery("input[type=hidden][name='user_id']").val() );
|
||||
if ( jQuery('input[type="hidden"][name="user_id"]').length > 0 ) {
|
||||
jQuery('#' + modal_id).attr( 'data-user_id', jQuery('input[type="hidden"][name="user_id"]').val() );
|
||||
}
|
||||
|
||||
um_new_modal( modal_id, size );
|
||||
|
||||
} else {
|
||||
|
||||
um_new_modal( modal_id, size );
|
||||
|
||||
}
|
||||
|
||||
um_new_modal( modal_id, size );
|
||||
});
|
||||
|
||||
});
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user