mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-20 07:04:06 +09:00
- wp-admin assets refactoring (in process);
- partially frontend scripts review related to the form builder preview;
This commit is contained in:
+114
-11
@@ -9,8 +9,111 @@ if ( typeof (window.UM.admin) !== 'object' ) {
|
||||
UM.admin.builder = {
|
||||
deleteProcess: [],
|
||||
fieldsToDelete: [],
|
||||
fieldConditions: {
|
||||
refresh: function() {
|
||||
let $conditionalRows = jQuery('.um-adm-conditional');
|
||||
if ( $conditionalRows.length > 0 ) {
|
||||
$conditionalRows.each( function() {
|
||||
jQuery(this).trigger('change');
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
tinyMCE: {
|
||||
editor: {},
|
||||
init: function ( id, content ) {
|
||||
var object = jQuery('#' + id);
|
||||
|
||||
if ( typeof( tinyMCE ) === 'object' && tinyMCE.get( id ) !== null ) {
|
||||
tinyMCE.triggerSave();
|
||||
tinyMCE.EditorManager.execCommand( 'mceRemoveEditor', true, id );
|
||||
"4" === tinyMCE.majorVersion ? window.tinyMCE.execCommand( "mceRemoveEditor", !0, id ) : window.tinyMCE.execCommand( "mceRemoveControl", !0, id );
|
||||
UM.admin.builder.tinyMCE.editor = jQuery('<div>').append( object.parents( '#wp-' + id + '-wrap' ).clone() );
|
||||
object.parents('#wp-' + id + '-wrap').replaceWith('<div class="um_tiny_placeholder"></div>');
|
||||
jQuery('.um-admin-editor:visible').html( jQuery( UM.admin.builder.tinyMCE.editor ).html() );
|
||||
|
||||
var init;
|
||||
if( typeof tinyMCEPreInit.mceInit[ id ] == 'undefined' ){
|
||||
init = tinyMCEPreInit.mceInit[ id ] = tinyMCE.extend( {}, tinyMCEPreInit.mceInit[ id ] );
|
||||
} else {
|
||||
init = tinyMCEPreInit.mceInit[ id ];
|
||||
}
|
||||
if ( typeof(QTags) == 'function' ) {
|
||||
QTags( tinyMCEPreInit.qtInit[ id ] );
|
||||
QTags._buttonsInit();
|
||||
}
|
||||
if ( typeof( window.switchEditors ) === 'object' ) {
|
||||
window.switchEditors.go( id );
|
||||
}
|
||||
tinyMCE.init( init );
|
||||
tinyMCE.get( id ).setContent( content );
|
||||
object.html( content );
|
||||
} else {
|
||||
UM.admin.builder.tinyMCE.editor = jQuery('<div>').append( object.parents('#wp-' + id + '-wrap').clone() );
|
||||
object.parents('#wp-' + id + '-wrap').replaceWith('<div class="um_tiny_placeholder"></div>');
|
||||
|
||||
jQuery('.um-admin-editor:visible').html( jQuery( UM.admin.builder.tinyMCE.editor ).html() );
|
||||
|
||||
if ( typeof(QTags) == 'function' ) {
|
||||
QTags( tinyMCEPreInit.qtInit[ id ] );
|
||||
QTags._buttonsInit();
|
||||
}
|
||||
|
||||
//use duplicate because it's new element
|
||||
jQuery('#' + id).html( content );
|
||||
}
|
||||
|
||||
jQuery( 'body' ).on( 'click', '.wp-switch-editor', function() {
|
||||
var target = jQuery(this);
|
||||
|
||||
if ( target.hasClass( 'wp-switch-editor' ) && typeof( window.switchEditors ) === 'object' ) {
|
||||
var mode = target.hasClass( 'switch-tmce' ) ? 'tmce' : 'html';
|
||||
window.switchEditors.go( id, mode );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wp.hooks.addAction( 'um_admin_modal_success_result', 'um_admin_builder', function( $adminModal, act_id ) {
|
||||
UM.admin.builder.fieldConditions.refresh();
|
||||
|
||||
jQuery( "#_custom_dropdown_options_source" ).trigger('blur');
|
||||
|
||||
if ( jQuery('.um-admin-editor:visible').length > 0 ) {
|
||||
|
||||
if ( 'um_admin_edit_field_popup' === act_id ) {
|
||||
UM.admin.builder.tinyMCE.init( 'um_editor_edit', jQuery('.um-admin-modal:visible .dynamic-mce-content').html() );
|
||||
} else {
|
||||
UM.admin.builder.tinyMCE.init( 'um_editor_new', '' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( 'um_admin_preview_form' === act_id ) {
|
||||
// Fix for overlay in scrollable preview modal.
|
||||
let $previewOverlay = jQuery('.um-admin-preview-overlay');
|
||||
$previewOverlay.css('height', $previewOverlay.siblings('.um').outerHeight(true)*1 + 20 + 'px' );
|
||||
}
|
||||
|
||||
UM.admin.colorPicker.init();
|
||||
UM.common.datetimePicker.init();
|
||||
});
|
||||
|
||||
wp.hooks.addAction( 'um_admin_modal_remove', 'um_admin_builder', function() {
|
||||
if ( jQuery('.um-admin-editor:visible').length > 0 ) {
|
||||
tinyMCE.triggerSave();
|
||||
|
||||
if ( jQuery('.um-admin-modal:visible').find('form').parent().attr('id') == 'UM_edit_field' ) {
|
||||
jQuery('#wp-um_editor_edit-wrap').remove();
|
||||
} else {
|
||||
jQuery('#wp-um_editor_new-wrap').remove();
|
||||
}
|
||||
|
||||
jQuery('.um_tiny_placeholder').replaceWith( jQuery( UM.admin.builder.tinyMCE.editor ).html() );
|
||||
}
|
||||
});
|
||||
|
||||
function UM_Drag_and_Drop() {
|
||||
jQuery('.um-admin-drag-col,.um-admin-drag-group').sortable({
|
||||
items: '.um-admin-drag-fld',
|
||||
@@ -467,7 +570,7 @@ jQuery( document ).ready( function() {
|
||||
in_group = demon_settings.data('in_group');
|
||||
}
|
||||
|
||||
um_admin_remove_modal();
|
||||
UM.admin.modal.remove();
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
type: 'POST',
|
||||
@@ -484,7 +587,7 @@ jQuery( document ).ready( function() {
|
||||
},
|
||||
success: function( data ) {
|
||||
demon_settings.data('in_row', '').data('in_sub_row', '').data('in_column', '').data('in_group', '');
|
||||
um_admin_modal_responsive();
|
||||
UM.admin.modal.resize();
|
||||
um_admin_update_builder();
|
||||
},
|
||||
error: function( data ) {
|
||||
@@ -583,11 +686,11 @@ jQuery( document ).ready( function() {
|
||||
}
|
||||
});
|
||||
|
||||
um_admin_modal_responsive();
|
||||
UM.admin.modal.resize();
|
||||
} else {
|
||||
jQuery('.um-col-demon-settings').data('in_row', '').data('in_sub_row', '').data('in_column', '').data('in_group', '');
|
||||
UM.common.tipsy.hide();
|
||||
um_admin_remove_modal();
|
||||
UM.admin.modal.remove();
|
||||
um_admin_update_builder();
|
||||
}
|
||||
} else {
|
||||
@@ -624,7 +727,7 @@ jQuery( document ).ready( function() {
|
||||
link.find('i').removeClass().addClass('um-icon-plus');
|
||||
link.removeClass('active');
|
||||
}
|
||||
um_admin_modal_responsive();
|
||||
UM.admin.modal.resize();
|
||||
});
|
||||
|
||||
|
||||
@@ -651,8 +754,8 @@ jQuery( document ).ready( function() {
|
||||
jQuery(template).removeClass("um-admin-cur-condition-template");
|
||||
jQuery(template).addClass("um-admin-cur-condition");
|
||||
|
||||
um_admin_live_update_scripts();
|
||||
um_admin_modal_responsive();
|
||||
UM.admin.builder.fieldConditions.refresh();
|
||||
UM.admin.modal.resize();
|
||||
} else {
|
||||
jQuery(this).addClass('disabled');
|
||||
alert( 'You already have 5 rules' );
|
||||
@@ -682,8 +785,8 @@ jQuery( document ).ready( function() {
|
||||
content.find('input[type=text]').val('');
|
||||
content.find('select').val('');
|
||||
jQuery('.um-admin-new-condition').removeClass('disabled');
|
||||
um_admin_live_update_scripts();
|
||||
um_admin_modal_responsive();
|
||||
UM.admin.builder.fieldConditions.refresh();
|
||||
UM.admin.modal.resize();
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -707,8 +810,8 @@ jQuery( document ).ready( function() {
|
||||
jQuery( this ).find('[id^="_conditional_value"]').attr('name', '_conditional_value' + id);
|
||||
jQuery( this ).find('[id^="_conditional_value"]').attr('id', '_conditional_value' + id);
|
||||
} );
|
||||
um_admin_live_update_scripts();
|
||||
um_admin_modal_responsive();
|
||||
UM.admin.builder.fieldConditions.refresh();
|
||||
UM.admin.modal.resize();
|
||||
});
|
||||
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -33,91 +33,10 @@ UM.admin = {
|
||||
$colorPicker.wpColorPicker();
|
||||
}
|
||||
}
|
||||
},
|
||||
datetimePicker: {
|
||||
init: function () {
|
||||
jQuery('.um-datepicker:not(.picker__input)').each(function(){
|
||||
elem = jQuery(this);
|
||||
|
||||
if ( typeof elem.attr('data-disabled_weekdays') != 'undefined' && elem.attr('data-disabled_weekdays') != '' ) {
|
||||
var disable = JSON.parse( elem.attr('data-disabled_weekdays') );
|
||||
} else {
|
||||
var disable = false;
|
||||
}
|
||||
|
||||
var years_n = null;
|
||||
if ( typeof elem.attr('data-years') != 'undefined' ) {
|
||||
years_n = elem.attr('data-years');
|
||||
}
|
||||
|
||||
var minRange = elem.attr('data-date_min');
|
||||
var maxRange = elem.attr('data-date_max');
|
||||
|
||||
var minSplit = [], maxSplit = [];
|
||||
if ( typeof minRange != 'undefined' ) {
|
||||
minSplit = minRange.split(",");
|
||||
}
|
||||
if ( typeof maxRange != 'undefined' ) {
|
||||
maxSplit = maxRange.split(",");
|
||||
}
|
||||
|
||||
var min = minSplit.length ? new Date(minSplit) : null;
|
||||
var max = minSplit.length ? new Date(maxSplit) : null;
|
||||
|
||||
// fix min date for safari
|
||||
if ( min && min.toString() == 'Invalid Date' && minSplit.length == 3 ) {
|
||||
var minDateString = minSplit[1] + '/' + minSplit[2] + '/' + minSplit[0];
|
||||
min = new Date(Date.parse(minDateString));
|
||||
}
|
||||
|
||||
// fix max date for safari
|
||||
if ( max && max.toString() == 'Invalid Date' && maxSplit.length == 3 ) {
|
||||
var maxDateString = maxSplit[1] + '/' + maxSplit[2] + '/' + maxSplit[0];
|
||||
max = new Date(Date.parse(maxDateString));
|
||||
}
|
||||
|
||||
var data = {
|
||||
disable: disable,
|
||||
format: elem.attr( 'data-format' ),
|
||||
formatSubmit: 'yyyy/mm/dd',
|
||||
hiddenName: true,
|
||||
onOpen: function() { elem.blur(); },
|
||||
onClose: function() { elem.blur(); }
|
||||
};
|
||||
|
||||
if ( years_n !== null ) {
|
||||
data.selectYears = years_n;
|
||||
}
|
||||
|
||||
if ( min !== null ) {
|
||||
data.min = min;
|
||||
}
|
||||
|
||||
if ( max !== null ) {
|
||||
data.max = max;
|
||||
}
|
||||
|
||||
elem.pickadate( data );
|
||||
});
|
||||
|
||||
jQuery('.um-timepicker:not(.picker__input)').each(function(){
|
||||
elem = jQuery(this);
|
||||
|
||||
elem.pickatime({
|
||||
format: elem.attr('data-format'),
|
||||
interval: parseInt( elem.attr('data-intervals') ),
|
||||
formatSubmit: 'HH:i',
|
||||
hiddenName: true,
|
||||
onOpen: function() { elem.blur(); },
|
||||
onClose: function() { elem.blur(); }
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
UM.admin.tooltip.init();
|
||||
UM.admin.colorPicker.init();
|
||||
UM.admin.datetimePicker.init();
|
||||
});
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
"object"!=typeof window.UM&&(window.UM={}),"object"!=typeof window.UM.admin&&(window.UM.admin={}),UM.admin={tooltip:{all:null,init:function(){var t=jQuery(".um_tooltip");0<t.length&&(UM.admin.tooltip.all=t.tooltip({tooltipClass:"um_tooltip",content:function(){return jQuery(this).attr("title")}}))},close:function(){null!==UM.admin.tooltip.all&&0<UM.admin.tooltip.all&&"function"==typeof UM.admin.tooltip.all.tooltip&&UM.admin.tooltip.all.tooltip("close")}},colorPicker:{init:function(){var t=jQuery(".um-admin-colorpicker");t.length&&t.wpColorPicker()}},datetimePicker:{init:function(){jQuery(".um-datepicker:not(.picker__input)").each(function(){t=void 0!==(elem=jQuery(this)).attr("data-disabled_weekdays")&&""!=elem.attr("data-disabled_weekdays")&&JSON.parse(elem.attr("data-disabled_weekdays"));var t,e=null,a=(void 0!==elem.attr("data-years")&&(e=elem.attr("data-years")),elem.attr("data-date_min")),i=elem.attr("data-date_max"),n=[],l=[],a=(void 0!==a&&(n=a.split(",")),void 0!==i&&(l=i.split(",")),n.length?new Date(n):null),i=n.length?new Date(l):null,l=(a&&"Invalid Date"==a.toString()&&3==n.length&&(n=n[1]+"/"+n[2]+"/"+n[0],a=new Date(Date.parse(n))),i&&"Invalid Date"==i.toString()&&3==l.length&&(n=l[1]+"/"+l[2]+"/"+l[0],i=new Date(Date.parse(n))),{disable:t,format:elem.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}});null!==e&&(l.selectYears=e),null!==a&&(l.min=a),null!==i&&(l.max=i),elem.pickadate(l)}),jQuery(".um-timepicker:not(.picker__input)").each(function(){(elem=jQuery(this)).pickatime({format:elem.attr("data-format"),interval:parseInt(elem.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})})}}},jQuery(document).ready(function(){UM.admin.tooltip.init(),UM.admin.colorPicker.init(),UM.admin.datetimePicker.init()});
|
||||
"object"!=typeof window.UM&&(window.UM={}),"object"!=typeof window.UM.admin&&(window.UM.admin={}),UM.admin={tooltip:{all:null,init:function(){var o=jQuery(".um_tooltip");0<o.length&&(UM.admin.tooltip.all=o.tooltip({tooltipClass:"um_tooltip",content:function(){return jQuery(this).attr("title")}}))},close:function(){null!==UM.admin.tooltip.all&&0<UM.admin.tooltip.all&&"function"==typeof UM.admin.tooltip.all.tooltip&&UM.admin.tooltip.all.tooltip("close")}},colorPicker:{init:function(){var o=jQuery(".um-admin-colorpicker");o.length&&o.wpColorPicker()}}},jQuery(document).ready(function(){UM.admin.tooltip.init(),UM.admin.colorPicker.init()});
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
+1
File diff suppressed because one or more lines are too long
+71
-177
@@ -1,13 +1,50 @@
|
||||
var $um_tiny_editor = {};
|
||||
if ( typeof (window.UM) !== 'object' ) {
|
||||
window.UM = {};
|
||||
}
|
||||
|
||||
if ( typeof (window.UM.admin) !== 'object' ) {
|
||||
window.UM.admin = {};
|
||||
}
|
||||
|
||||
function um_admin_live_update_scripts() {
|
||||
jQuery('.um-adm-conditional').each( function() {
|
||||
jQuery(this).trigger('change');
|
||||
});
|
||||
UM.admin.modal = {
|
||||
preload: function () {
|
||||
jQuery('.um-admin-modal:visible').addClass('loading');
|
||||
jQuery('.um-admin-modal-body:visible').empty();
|
||||
},
|
||||
loaded: function() {
|
||||
jQuery('.um-admin-modal:visible').removeClass('loading');
|
||||
},
|
||||
setSize: function ( size ) {
|
||||
jQuery('.um-admin-modal:visible').addClass( size );
|
||||
},
|
||||
setAttr: function( id, value ) {
|
||||
jQuery('.um-admin-modal:visible').data( id, value );
|
||||
},
|
||||
remove: function () {
|
||||
wp.hooks.doAction( 'um_admin_modal_remove' );
|
||||
|
||||
if ( jQuery('.um-admin-colorpicker').length ) {
|
||||
jQuery('.um-admin-colorpicker').wpColorPicker();
|
||||
UM.admin.tooltip.close();
|
||||
UM.common.tipsy.hide();
|
||||
jQuery('body').removeClass('um-admin-modal-open');
|
||||
jQuery('.um-admin-modal div[id^="UM_"]').hide().appendTo('body');
|
||||
jQuery('.um-admin-modal,.um-admin-overlay').remove();
|
||||
},
|
||||
resize: function () {
|
||||
var required_margin = jQuery('.um-admin-modal:visible').innerHeight() / 2 + 'px';
|
||||
jQuery('.um-admin-modal:visible').css({'margin-top': '-' + required_margin });
|
||||
|
||||
if ( jQuery('#UM_preview_form .um-s1').length ) {
|
||||
jQuery("#UM_preview_form .um-s1").select2({
|
||||
allowClear: true
|
||||
});
|
||||
}
|
||||
|
||||
if ( jQuery('#UM_preview_form .um-s2').length ) {
|
||||
jQuery("#UM_preview_form .um-s2").select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +53,7 @@ function um_admin_new_modal( id, ajax, size ) {
|
||||
|
||||
UM.common.tipsy.hide();
|
||||
|
||||
um_admin_remove_modal();
|
||||
UM.admin.modal.remove();
|
||||
|
||||
jQuery('body').addClass('um-admin-modal-open').append('<div class="um-admin-overlay"></div><div class="um-admin-modal"></div>');
|
||||
jQuery('#' + id).prependTo('.um-admin-modal');
|
||||
@@ -26,81 +63,30 @@ function um_admin_new_modal( id, ajax, size ) {
|
||||
jQuery('.um-admin-modal-head').append('<a href="javascript:void(0);" data-action="UM_remove_modal" class="um-admin-modal-close"><i class="um-faicon-times"></i></a>');
|
||||
|
||||
if ( ajax == true ) {
|
||||
um_admin_modal_size( size );
|
||||
um_admin_modal_preload();
|
||||
um_admin_modal_responsive();
|
||||
UM.admin.modal.setSize( size );
|
||||
UM.admin.modal.preload();
|
||||
UM.admin.modal.resize();
|
||||
} else {
|
||||
um_admin_modal_responsive();
|
||||
UM.admin.modal.resize();
|
||||
}
|
||||
}
|
||||
|
||||
function um_tinymce_init( id, content ) {
|
||||
var object = jQuery('#' + id);
|
||||
|
||||
if ( typeof( tinyMCE ) === 'object' && tinyMCE.get( id ) !== null ) {
|
||||
tinyMCE.triggerSave();
|
||||
tinyMCE.EditorManager.execCommand( 'mceRemoveEditor', true, id );
|
||||
"4" === tinyMCE.majorVersion ? window.tinyMCE.execCommand( "mceRemoveEditor", !0, id ) : window.tinyMCE.execCommand( "mceRemoveControl", !0, id );
|
||||
$um_tiny_editor = jQuery('<div>').append( object.parents( '#wp-' + id + '-wrap' ).clone() );
|
||||
object.parents('#wp-' + id + '-wrap').replaceWith('<div class="um_tiny_placeholder"></div>');
|
||||
jQuery('.um-admin-editor:visible').html( jQuery( $um_tiny_editor ).html() );
|
||||
|
||||
var init;
|
||||
if( typeof tinyMCEPreInit.mceInit[ id ] == 'undefined' ){
|
||||
init = tinyMCEPreInit.mceInit[ id ] = tinyMCE.extend( {}, tinyMCEPreInit.mceInit[ id ] );
|
||||
} else {
|
||||
init = tinyMCEPreInit.mceInit[ id ];
|
||||
}
|
||||
if ( typeof(QTags) == 'function' ) {
|
||||
QTags( tinyMCEPreInit.qtInit[ id ] );
|
||||
QTags._buttonsInit();
|
||||
}
|
||||
if ( typeof( window.switchEditors ) === 'object' ) {
|
||||
window.switchEditors.go( id );
|
||||
}
|
||||
tinyMCE.init( init );
|
||||
tinyMCE.get( id ).setContent( content );
|
||||
object.html( content );
|
||||
} else {
|
||||
$um_tiny_editor = jQuery('<div>').append( object.parents('#wp-' + id + '-wrap').clone() );
|
||||
object.parents('#wp-' + id + '-wrap').replaceWith('<div class="um_tiny_placeholder"></div>');
|
||||
|
||||
jQuery('.um-admin-editor:visible').html( jQuery( $um_tiny_editor ).html() );
|
||||
|
||||
if ( typeof(QTags) == 'function' ) {
|
||||
QTags( tinyMCEPreInit.qtInit[ id ] );
|
||||
QTags._buttonsInit();
|
||||
}
|
||||
|
||||
//use duplicate because it's new element
|
||||
jQuery('#' + id).html( content );
|
||||
}
|
||||
|
||||
jQuery( 'body' ).on( 'click', '.wp-switch-editor', function() {
|
||||
var target = jQuery(this);
|
||||
|
||||
if ( target.hasClass( 'wp-switch-editor' ) && typeof( window.switchEditors ) === 'object' ) {
|
||||
var mode = target.hasClass( 'switch-tmce' ) ? 'tmce' : 'html';
|
||||
window.switchEditors.go( id, mode );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function um_admin_modal_ajaxcall( act_id, arg1, arg2, arg3 ) {
|
||||
in_row = '';
|
||||
in_sub_row = '';
|
||||
in_column = '';
|
||||
in_group = '';
|
||||
let in_row = '';
|
||||
let in_sub_row = '';
|
||||
let in_column = '';
|
||||
let in_group = '';
|
||||
|
||||
if ( jQuery('.um-col-demon-settings').data('in_column') ) {
|
||||
in_row = jQuery('.um-col-demon-settings').data('in_row');
|
||||
in_sub_row = jQuery('.um-col-demon-settings').data('in_sub_row');
|
||||
in_column = jQuery('.um-col-demon-settings').data('in_column');
|
||||
in_group = jQuery('.um-col-demon-settings').data('in_group');
|
||||
let $hiddenModalData = jQuery('.um-col-demon-settings');
|
||||
|
||||
if ( $hiddenModalData.data('in_column') ) {
|
||||
in_row = $hiddenModalData.data('in_row');
|
||||
in_sub_row = $hiddenModalData.data('in_sub_row');
|
||||
in_column = $hiddenModalData.data('in_column');
|
||||
in_group = $hiddenModalData.data('in_group');
|
||||
}
|
||||
|
||||
var form_mode = jQuery('input[type=hidden][id=form__um_mode]').val();
|
||||
let form_mode = jQuery('input[type="hidden"][id="form__um_mode"]').val();
|
||||
|
||||
jQuery.ajax({
|
||||
url: wp.ajax.settings.url,
|
||||
@@ -119,36 +105,16 @@ function um_admin_modal_ajaxcall( act_id, arg1, arg2, arg3 ) {
|
||||
form_mode: form_mode
|
||||
},
|
||||
complete: function(){
|
||||
um_admin_modal_loaded();
|
||||
um_admin_modal_responsive();
|
||||
UM.admin.modal.loaded();
|
||||
UM.admin.modal.resize();
|
||||
},
|
||||
success: function(data) {
|
||||
let $adminModal = jQuery('.um-admin-modal');
|
||||
$adminModal.find('.um-admin-modal-body').html( data );
|
||||
|
||||
jQuery('.um-admin-modal').find('.um-admin-modal-body').html( data );
|
||||
wp.hooks.doAction( 'um_admin_modal_success_result', $adminModal, act_id );
|
||||
|
||||
wp.hooks.doAction( 'um_admin_modal_success_result', jQuery('.um-admin-modal') );
|
||||
|
||||
um_admin_live_update_scripts();
|
||||
|
||||
jQuery( "#_custom_dropdown_options_source" ).trigger('blur');
|
||||
|
||||
if ( jQuery('.um-admin-editor:visible').length > 0 ) {
|
||||
|
||||
if ( act_id == 'um_admin_edit_field_popup' ) {
|
||||
um_tinymce_init( 'um_editor_edit', jQuery('.um-admin-modal:visible .dynamic-mce-content').html() );
|
||||
} else {
|
||||
um_tinymce_init( 'um_editor_new', '' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( act_id === 'um_admin_preview_form' ) {
|
||||
//fix for overlay in scrollable preview modal
|
||||
jQuery('.um-admin-preview-overlay').css('height', jQuery('.um-admin-preview-overlay').siblings('.um').outerHeight(true)*1 + 20 + 'px' );
|
||||
}
|
||||
|
||||
UM.admin.tooltip.init();
|
||||
UM.admin.datetimePicker.init();
|
||||
UM.admin.tooltip.init();
|
||||
},
|
||||
error: function(data) {
|
||||
|
||||
@@ -157,86 +123,18 @@ function um_admin_modal_ajaxcall( act_id, arg1, arg2, arg3 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function um_admin_modal_responsive() {
|
||||
var required_margin = jQuery('.um-admin-modal:visible').innerHeight() / 2 + 'px';
|
||||
jQuery('.um-admin-modal:visible').css({'margin-top': '-' + required_margin });
|
||||
|
||||
if ( jQuery('#UM_preview_form .um-s1').length ) {
|
||||
jQuery("#UM_preview_form .um-s1").select2({
|
||||
allowClear: true
|
||||
});
|
||||
}
|
||||
|
||||
if ( jQuery('#UM_preview_form .um-s2').length ) {
|
||||
jQuery("#UM_preview_form .um-s2").select2({
|
||||
allowClear: false,
|
||||
minimumResultsForSearch: 10
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function um_admin_remove_modal() {
|
||||
|
||||
if ( jQuery('.um-admin-editor:visible').length > 0 ) {
|
||||
tinyMCE.triggerSave();
|
||||
|
||||
if ( jQuery('.um-admin-modal:visible').find('form').parent().attr('id') == 'UM_edit_field' ) {
|
||||
jQuery('#wp-um_editor_edit-wrap').remove();
|
||||
|
||||
/*tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_edit');
|
||||
jQuery('.um-hidden-editor-edit').html( jQuery('.um-admin-editor:visible').contents() );
|
||||
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_edit');*/
|
||||
|
||||
} else {
|
||||
jQuery('#wp-um_editor_new-wrap').remove();
|
||||
|
||||
/*tinyMCE.execCommand('mceRemoveEditor', true, 'um_editor_new');
|
||||
jQuery('.um-hidden-editor-new').html( jQuery('.um-admin-editor:visible').contents() );
|
||||
tinyMCE.execCommand('mceAddEditor', true, 'um_editor_new');*/
|
||||
|
||||
}
|
||||
|
||||
jQuery('.um_tiny_placeholder').replaceWith( jQuery( $um_tiny_editor ).html() );
|
||||
}
|
||||
|
||||
UM.admin.tooltip.close();
|
||||
UM.common.tipsy.hide();
|
||||
jQuery('body').removeClass('um-admin-modal-open');
|
||||
jQuery('.um-admin-modal div[id^="UM_"]').hide().appendTo('body');
|
||||
jQuery('.um-admin-modal,.um-admin-overlay').remove();
|
||||
}
|
||||
|
||||
function um_admin_modal_preload() {
|
||||
jQuery('.um-admin-modal:visible').addClass('loading');
|
||||
jQuery('.um-admin-modal-body:visible').empty();
|
||||
}
|
||||
|
||||
function um_admin_modal_loaded() {
|
||||
jQuery('.um-admin-modal:visible').removeClass('loading');
|
||||
}
|
||||
|
||||
function um_admin_modal_size( aclass ) {
|
||||
jQuery('.um-admin-modal:visible').addClass(aclass);
|
||||
}
|
||||
|
||||
function um_admin_modal_add_attr( id, value ) {
|
||||
jQuery('.um-admin-modal:visible').data( id, value );
|
||||
}
|
||||
|
||||
/**
|
||||
Custom modal scripting starts
|
||||
**/
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
remove modal via action
|
||||
**/
|
||||
jQuery(document.body).on('click', '.um-admin-overlay, a[data-action="UM_remove_modal"]', function(){
|
||||
UM.common.tipsy.hide();
|
||||
um_admin_remove_modal();
|
||||
UM.admin.modal.remove();
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -268,8 +166,6 @@ jQuery(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
submit font icon
|
||||
**/
|
||||
@@ -289,7 +185,7 @@ jQuery(document).ready(function() {
|
||||
jQuery(this).attr('data-code', '');
|
||||
if ( v_id == '.postbox' ) {
|
||||
UM.common.tipsy.hide();
|
||||
um_admin_remove_modal();
|
||||
UM.admin.modal.remove();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -318,8 +214,6 @@ jQuery(document).ready(function() {
|
||||
} else {
|
||||
jQuery('.um-admin-icons span:hidden').show();
|
||||
}
|
||||
um_admin_modal_responsive();
|
||||
UM.admin.modal.resize();
|
||||
});
|
||||
|
||||
}); // end jQuery(document).ready
|
||||
|
||||
});
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user