Created
October 4, 2021 10:43
-
-
Save artikus11/ee2bbb7ecac1bd7e86d433d0ca98f703 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( '.feedback a' ).magnificPopup( { | |
type: 'ajax', | |
callbacks: { | |
elementParse: function( item ) { | |
postData = { | |
action: 'feedback_ajax_action', | |
form_id: $( item.el[0] ).attr( 'data-form-id' ) | |
}; | |
var mp = $.magnificPopup.instance; | |
mp.st.ajax.settings.data = postData; | |
}, | |
ajaxContentAdded: function() { | |
$( 'div.wpcf7 > form' ).each( function() { | |
let $form = $( this ); | |
wpcf7.init( this ); | |
if ( wpcf7.cached ) { | |
wpcf7.refill( $form ); | |
} | |
} | |
); | |
let mask_fields = $( '.wpcf7-mask' ); | |
if ( mask_fields.length > 0 ) { | |
mask_fields.each( function() { | |
let $this = $( this ), | |
data_mask = $this.data( 'mask' ); | |
//Если ошибка определения, то выводим в консоль сообщение и продолжаем | |
try { | |
$this.mask( data_mask ); | |
if ( data_mask.indexOf( '*' ) === -1 && data_mask.indexOf( 'a' ) === -1 ) { | |
$this.attr( { | |
'inputmode': 'numeric' | |
} ); | |
} | |
} catch ( e ) { | |
console.log( 'Error ' + e.name + ':' + e.message + '\n' + e.stack ); | |
} | |
} | |
); | |
} | |
} | |
}, | |
ajax: { | |
settings: { | |
type: 'POST', | |
url: vv_feedback.url, | |
nonce: vv_feedback.nonce, | |
} | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment