PDF rausgenommen

This commit is contained in:
aschwarz
2023-01-23 11:03:31 +01:00
parent 82d562a322
commit a6523903eb
28078 changed files with 4247552 additions and 2 deletions

View File

@ -0,0 +1,291 @@
( function( $ ) {
'use strict';
if ( typeof wpcf7 === 'undefined' || wpcf7 === null ) {
return;
}
$( function() {
var welcomePanel = $( '#welcome-panel' );
var updateWelcomePanel;
updateWelcomePanel = function( visible ) {
$.post( ajaxurl, {
action: 'wpcf7-update-welcome-panel',
visible: visible,
welcomepanelnonce: $( '#welcomepanelnonce' ).val()
} );
};
$( 'a.welcome-panel-close', welcomePanel ).click( function( event ) {
event.preventDefault();
welcomePanel.addClass( 'hidden' );
updateWelcomePanel( 0 );
} );
$( '#contact-form-editor' ).tabs( {
active: wpcf7.activeTab,
activate: function( event, ui ) {
$( '#active-tab' ).val( ui.newTab.index() );
}
} );
$( '#contact-form-editor-tabs' ).focusin( function( event ) {
$( '#contact-form-editor .keyboard-interaction' ).css(
'visibility', 'visible' );
} ).focusout( function( event ) {
$( '#contact-form-editor .keyboard-interaction' ).css(
'visibility', 'hidden' );
} );
wpcf7.toggleMail2( 'input:checkbox.toggle-form-table' );
$( 'input:checkbox.toggle-form-table' ).click( function( event ) {
wpcf7.toggleMail2( this );
} );
if ( '' === $( '#title' ).val() ) {
$( '#title' ).focus();
}
wpcf7.titleHint();
$( '.contact-form-editor-box-mail span.mailtag' ).click( function( event ) {
var range = document.createRange();
range.selectNodeContents( this );
window.getSelection().addRange( range );
} );
wpcf7.updateConfigErrors();
$( '[data-config-field]' ).change( function() {
var postId = $( '#post_ID' ).val();
if ( ! postId || -1 == postId ) {
return;
}
var data = [];
$( this ).closest( 'form' ).find( '[data-config-field]' ).each( function() {
data.push( {
'name': $( this ).attr( 'name' ).replace( /^wpcf7-/, '' ).replace( /-/g, '_' ),
'value': $( this ).val()
} );
} );
data.push( { 'name': 'context', 'value': 'dry-run' } );
$.ajax( {
method: 'POST',
url: wpcf7.apiSettings.getRoute( '/contact-forms/' + postId ),
beforeSend: function( xhr ) {
xhr.setRequestHeader( 'X-WP-Nonce', wpcf7.apiSettings.nonce );
},
data: data
} ).done( function( response ) {
wpcf7.configValidator.errors = response.config_errors;
wpcf7.updateConfigErrors();
} );
} );
$( window ).on( 'beforeunload', function( event ) {
var changed = false;
$( '#wpcf7-admin-form-element :input[type!="hidden"]' ).each( function() {
if ( $( this ).is( ':checkbox, :radio' ) ) {
if ( this.defaultChecked != $( this ).is( ':checked' ) ) {
changed = true;
}
} else if ( $( this ).is( 'select' ) ) {
$( this ).find( 'option' ).each( function() {
if ( this.defaultSelected != $( this ).is( ':selected' ) ) {
changed = true;
}
} );
} else {
if ( this.defaultValue != $( this ).val() ) {
changed = true;
}
}
} );
if ( changed ) {
event.returnValue = wpcf7.saveAlert;
return wpcf7.saveAlert;
}
} );
$( '#wpcf7-admin-form-element' ).submit( function() {
if ( 'copy' != this.action.value ) {
$( window ).off( 'beforeunload' );
}
if ( 'save' == this.action.value ) {
$( '#publishing-action .spinner' ).addClass( 'is-active' );
}
} );
} );
wpcf7.toggleMail2 = function( checkbox ) {
var $checkbox = $( checkbox );
var $fieldset = $( 'fieldset',
$checkbox.closest( '.contact-form-editor-box-mail' ) );
if ( $checkbox.is( ':checked' ) ) {
$fieldset.removeClass( 'hidden' );
} else {
$fieldset.addClass( 'hidden' );
}
};
wpcf7.updateConfigErrors = function() {
var errors = wpcf7.configValidator.errors;
var errorCount = { total: 0 };
$( '[data-config-field]' ).each( function() {
$( this ).removeAttr( 'aria-invalid' );
$( this ).next( 'ul.config-error' ).remove();
var section = $( this ).attr( 'data-config-field' );
if ( errors[ section ] ) {
var $list = $( '<ul></ul>' ).attr( {
'role': 'alert',
'class': 'config-error'
} );
$.each( errors[ section ], function( i, val ) {
var $li = $( '<li></li>' ).append(
wpcf7.iconInCircle( '!' )
).append(
$( '<span class="screen-reader-text"></span>' ).text( wpcf7.configValidator.iconAlt )
).append( ' ' );
if ( val.link ) {
$li.append(
$( '<a></a>' ).attr( 'href', val.link ).text( val.message )
);
} else {
$li.text( val.message );
}
$li.appendTo( $list );
var tab = section
.replace( /^mail_\d+\./, 'mail.' ).replace( /\..*$/, '' );
if ( ! errorCount[ tab ] ) {
errorCount[ tab ] = 0;
}
errorCount[ tab ] += 1;
errorCount.total += 1;
} );
$( this ).after( $list ).attr( { 'aria-invalid': 'true' } );
}
} );
$( '#contact-form-editor-tabs > li' ).each( function() {
var $item = $( this );
$item.find( '.icon-in-circle' ).remove();
var tab = $item.attr( 'id' ).replace( /-panel-tab$/, '' );
$.each( errors, function( key, val ) {
key = key.replace( /^mail_\d+\./, 'mail.' );
if ( key.replace( /\..*$/, '' ) == tab.replace( '-', '_' ) ) {
var $mark = wpcf7.iconInCircle( '!' );
$item.find( 'a.ui-tabs-anchor' ).first().append( $mark );
return false;
}
} );
var $tabPanelError = $( '#' + tab + '-panel > div.config-error:first' );
$tabPanelError.empty();
if ( errorCount[ tab.replace( '-', '_' ) ] ) {
$tabPanelError.append( wpcf7.iconInCircle( '!' ) );
if ( 1 < errorCount[ tab.replace( '-', '_' ) ] ) {
var manyErrorsInTab = wpcf7.configValidator.manyErrorsInTab
.replace( '%d', errorCount[ tab.replace( '-', '_' ) ] );
$tabPanelError.append( manyErrorsInTab );
} else {
$tabPanelError.append( wpcf7.configValidator.oneErrorInTab );
}
}
} );
$( '#misc-publishing-actions .misc-pub-section.config-error' ).remove();
if ( errorCount.total ) {
var $warning = $( '<div></div>' )
.addClass( 'misc-pub-section config-error' )
.append( wpcf7.iconInCircle( '!' ) );
if ( 1 < errorCount.total ) {
$warning.append(
wpcf7.configValidator.manyErrors.replace( '%d', errorCount.total )
);
} else {
$warning.append( wpcf7.configValidator.oneError );
}
$warning.append( '<br />' ).append(
$( '<a></a>' )
.attr( 'href', wpcf7.configValidator.docUrl )
.text( wpcf7.configValidator.howToCorrect )
);
$( '#misc-publishing-actions' ).append( $warning );
}
};
/**
* Copied from wptitlehint() in wp-admin/js/post.js
*/
wpcf7.titleHint = function() {
var $title = $( '#title' );
var $titleprompt = $( '#title-prompt-text' );
if ( '' === $title.val() ) {
$titleprompt.removeClass( 'screen-reader-text' );
}
$titleprompt.click( function() {
$( this ).addClass( 'screen-reader-text' );
$title.focus();
} );
$title.blur( function() {
if ( '' === $(this).val() ) {
$titleprompt.removeClass( 'screen-reader-text' );
}
} ).focus( function() {
$titleprompt.addClass( 'screen-reader-text' );
} ).keydown( function( e ) {
$titleprompt.addClass( 'screen-reader-text' );
$( this ).unbind( e );
} );
};
wpcf7.iconInCircle = function( icon ) {
var $span = $( '<span class="icon-in-circle" aria-hidden="true"></span>' );
return $span.text( icon );
};
wpcf7.apiSettings.getRoute = function( path ) {
var url = wpcf7.apiSettings.root;
url = url.replace(
wpcf7.apiSettings.namespace,
wpcf7.apiSettings.namespace + path );
return url;
};
} )( jQuery );

View File

@ -0,0 +1,249 @@
( function( $ ) {
'use strict';
if ( typeof wpcf7 === 'undefined' || wpcf7 === null ) {
return;
}
wpcf7.taggen = {};
$( function() {
$( 'form.tag-generator-panel' ).each( function() {
wpcf7.taggen.update( $( this ) );
} );
} );
$( 'form.tag-generator-panel' ).submit( function() {
return false;
} );
$( 'form.tag-generator-panel .control-box :input' ).change( function() {
var $form = $( this ).closest( 'form.tag-generator-panel' );
wpcf7.taggen.normalize( $( this ) );
wpcf7.taggen.update( $form );
} );
$( 'input.insert-tag' ).click( function() {
var $form = $( this ).closest( 'form.tag-generator-panel' );
var tag = $form.find( 'input.tag' ).val();
wpcf7.taggen.insert( tag );
tb_remove(); // close thickbox
return false;
} );
wpcf7.taggen.update = function( $form ) {
var id = $form.attr( 'data-id' );
var name = '';
var name_fields = $form.find( 'input[name="name"]' );
if ( name_fields.length ) {
name = name_fields.val();
if ( '' === name ) {
name = id + '-' + Math.floor( Math.random() * 1000 );
name_fields.val( name );
}
}
if ( $.isFunction( wpcf7.taggen.update[ id ] ) ) {
return wpcf7.taggen.update[ id ].call( this, $form );
}
$form.find( 'input.tag' ).each( function() {
var tag_type = $( this ).attr( 'name' );
if ( $form.find( ':input[name="tagtype"]' ).length ) {
tag_type = $form.find( ':input[name="tagtype"]' ).val();
}
if ( $form.find( ':input[name="required"]' ).is( ':checked' ) ) {
tag_type += '*';
}
var components = wpcf7.taggen.compose( tag_type, $form );
$( this ).val( components );
} );
$form.find( 'span.mail-tag' ).text( '[' + name + ']' );
$form.find( 'input.mail-tag' ).each( function() {
$( this ).val( '[' + name + ']' );
} );
};
wpcf7.taggen.update.captcha = function( $form ) {
var captchac = wpcf7.taggen.compose( 'captchac', $form );
var captchar = wpcf7.taggen.compose( 'captchar', $form );
$form.find( 'input.tag' ).val( captchac + ' ' + captchar );
};
wpcf7.taggen.compose = function( tagType, $form ) {
var name = $form.find( 'input[name="name"]' ).val();
var scope = $form.find( '.scope.' + tagType );
if ( ! scope.length ) {
scope = $form;
}
var options = [];
scope.find( 'input.option' ).not( ':checkbox,:radio' ).each( function( i ) {
var val = $( this ).val();
if ( ! val ) {
return;
}
if ( $( this ).hasClass( 'filetype' ) ) {
val = val.split( /[,|\s]+/ ).join( '|' );
}
if ( $( this ).hasClass( 'color' ) ) {
val = '#' + val;
}
if ( 'class' == $( this ).attr( 'name' ) ) {
$.each( val.split( ' ' ), function( i, n ) {
options.push( 'class:' + n );
} );
} else {
options.push( $( this ).attr( 'name' ) + ':' + val );
}
} );
scope.find( 'input:checkbox.option' ).each( function( i ) {
if ( $( this ).is( ':checked' ) ) {
options.push( $( this ).attr( 'name' ) );
}
} );
scope.find( 'input:radio.option' ).each( function( i ) {
if ( $( this ).is( ':checked' ) && ! $( this ).hasClass( 'default' ) ) {
options.push( $( this ).attr( 'name' ) + ':' + $( this ).val() );
}
} );
if ( 'radio' == tagType ) {
options.push( 'default:1' );
}
options = ( options.length > 0 ) ? options.join( ' ' ) : '';
var value = '';
if ( scope.find( ':input[name="values"]' ).val() ) {
$.each(
scope.find( ':input[name="values"]' ).val().split( "\n" ),
function( i, n ) {
value += ' "' + n.replace( /["]/g, '&quot;' ) + '"';
}
);
}
var components = [];
$.each( [ tagType, name, options, value ], function( i, v ) {
v = $.trim( v );
if ( '' != v ) {
components.push( v );
}
} );
components = $.trim( components.join( ' ' ) );
components = '[' + components + ']';
var content = scope.find( ':input[name="content"]' ).val();
content = $.trim( content );
if ( content ) {
components += ' ' + content + ' [/' + tagType + ']';
}
return components;
};
wpcf7.taggen.normalize = function( $input ) {
var val = $input.val();
if ( $input.is( 'input[name="name"]' ) ) {
val = val.replace( /[^0-9a-zA-Z:._-]/g, '' ).replace( /^[^a-zA-Z]+/, '' );
}
if ( $input.is( '.numeric' ) ) {
val = val.replace( /[^0-9.-]/g, '' );
}
if ( $input.is( '.idvalue' ) ) {
val = val.replace( /[^-0-9a-zA-Z_]/g, '' );
}
if ( $input.is( '.classvalue' ) ) {
val = $.map( val.split( ' ' ), function( n ) {
return n.replace( /[^-0-9a-zA-Z_]/g, '' );
} ).join( ' ' );
val = $.trim( val.replace( /\s+/g, ' ' ) );
}
if ( $input.is( '.color' ) ) {
val = val.replace( /[^0-9a-fA-F]/g, '' );
}
if ( $input.is( '.filesize' ) ) {
val = val.replace( /[^0-9kKmMbB]/g, '' );
}
if ( $input.is( '.filetype' ) ) {
val = val.replace( /[^0-9a-zA-Z.,|\s]/g, '' );
}
if ( $input.is( '.date' ) ) {
// 'yyyy-mm-dd' ISO 8601 format
if ( ! val.match( /^\d{4}-\d{2}-\d{2}$/ ) ) {
val = '';
}
}
if ( $input.is( ':input[name="values"]' ) ) {
val = $.trim( val );
}
$input.val( val );
if ( $input.is( ':checkbox.exclusive' ) ) {
wpcf7.taggen.exclusiveCheckbox( $input );
}
};
wpcf7.taggen.exclusiveCheckbox = function( $cb ) {
if ( $cb.is( ':checked' ) ) {
$cb.siblings( ':checkbox.exclusive' ).prop( 'checked', false );
}
};
wpcf7.taggen.insert = function( content ) {
$( 'textarea#wpcf7-form' ).each( function() {
this.focus();
if ( document.selection ) { // IE
var selection = document.selection.createRange();
selection.text = content;
} else if ( this.selectionEnd || 0 === this.selectionEnd ) {
var val = $( this ).val();
var end = this.selectionEnd;
$( this ).val( val.substring( 0, end ) +
content + val.substring( end, val.length ) );
this.selectionStart = end + content.length;
this.selectionEnd = end + content.length;
} else {
$( this ).val( $( this ).val() + content );
}
this.focus();
} );
};
} )( jQuery );