This commit is contained in:
2026-03-11 15:57:27 +01:00
parent 481271c972
commit b4b460fd21
10775 changed files with 2071579 additions and 26409 deletions

View File

@@ -1,4 +1,3 @@
var __webpack_exports__ = {};
/**
* @package Polylang
*/
@@ -7,9 +6,9 @@ var __webpack_exports__ = {};
* Tag suggest in quick edit
*/
jQuery(
function( $ ) {
function ( $ ) {
$.ajaxPrefilter(
function( options, originalOptions, jqXHR ) {
function ( options, originalOptions, jqXHR ) {
if ( 'string' === typeof options.data && -1 !== options.data.indexOf( 'action=ajax-tag-search' ) && ( lang = $( ':input[name="inline_lang_choice"]' ).val() ) ) {
options.data = 'lang=' + lang + '&' + options.data;
}
@@ -22,10 +21,11 @@ jQuery(
* Quick edit
*/
jQuery(
function( $ ) {
function ( $ ) {
const handleQuickEditInsertion = ( mutationsList ) => {
for ( const mutation of mutationsList ) {
const form = mutation.addedNodes[0];
const addedNodes = Array.from( mutation.addedNodes ).filter( el => el.nodeType === Node.ELEMENT_NODE )
const form = addedNodes[0];
if ( 0 < mutation.addedNodes.length && form.classList.contains( 'inline-editor' ) ) {
// WordPress has inserted the quick edit form.
const post_id = Number( form.id.substring( 5 ) );
@@ -42,7 +42,7 @@ jQuery(
// Modify category checklist and parent dropdown on language change.
select.addEventListener(
'change',
function( event ) {
function ( event ) {
const newLang = event.target.value;
filter_terms( newLang );
filter_pages( newLang );
@@ -57,15 +57,20 @@ jQuery(
if ( "undefined" != typeof( pll_term_languages ) ) {
$.each(
pll_term_languages,
function( lg, term_tax ) {
function ( lg, term_tax ) {
$.each(
term_tax,
function( tax, terms ) {
function ( tax, terms ) {
$.each(
terms,
function( i ) {
id = '#' + tax + '-' + pll_term_languages[ lg ][ tax ][ i ];
lang == lg ? $( id ).show() : $( id ).hide();
function ( i ) {
// Backward compatibility with WordPress < 6.7.
// Support both old (WP < 6.7) and new (WP >= 6.7) ID formats.
// Old format: category-123 (WordPress < 6.7).
// New format: in-category-123-1 (WordPress >= 6.7).
const termId = pll_term_languages[ lg ][ tax ][ i ];
const selector = `#${tax}-${termId}, [id^="in-${tax}-${termId}-"]`;
$( selector ).toggle( lang === lg );
}
);
}
@@ -82,10 +87,10 @@ jQuery(
if ( "undefined" != typeof( pll_page_languages ) ) {
$.each(
pll_page_languages,
function( lg, pages ) {
function ( lg, pages ) {
$.each(
pages,
function( i ) {
function ( i ) {
v = $( '#post_parent option[value="' + pll_page_languages[ lg ][ i ] + '"]' );
lang == lg ? v.show() : v.hide();
}
@@ -97,6 +102,11 @@ jQuery(
}
}
const table = document.getElementById( 'the-list' );
if ( ! table ) {
return;
}
const config = { childList: true, subtree: true };
const observer = new MutationObserver( handleQuickEditInsertion );
@@ -109,14 +119,14 @@ jQuery(
* Acts on ajaxSuccess event
*/
jQuery(
function( $ ) {
function ( $ ) {
$( document ).ajaxSuccess(
function( event, xhr, settings ) {
function ( event, xhr, settings ) {
function update_rows( post_id ) {
// collect old translations
var translations = new Array();
$( '.translation_' + post_id ).each(
function() {
function () {
translations.push( $( this ).parent().parent().attr( 'id' ).substring( 5 ) );
}
);
@@ -134,14 +144,14 @@ jQuery(
$.post(
ajaxurl,
data,
function( response ) {
function ( response ) {
if ( response ) {
// Since WP changeset #52710 parseAjaxReponse() return content to notice the user in a HTML tag with ajax-response id.
// Since WP changeset #52710 parseAjaxResponse() return content to notice the user in a HTML tag with ajax-response id.
// Not to disturb this behaviour by executing another ajax request in the ajaxSuccess event, we need to target another unexisting id.
var res = wpAjax.parseAjaxResponse( response, 'pll-ajax-response' );
$.each(
res.responses,
function() {
function () {
if ( 'row' == this.what ) {
// data is built with a call to WP_Posts_List_Table::single_row method
// which uses internally other WordPress methods which escape correctly values.
@@ -166,19 +176,3 @@ jQuery(
}
);
/**
* Media list table
* When clicking on attach link, filters find post list per media language
*/
jQuery(
function( $ ) {
$.ajaxPrefilter(
function ( options, originalOptions, jqXHR ) {
if ( 'string' === typeof options.data && -1 !== options.data.indexOf( 'action=find_posts' ) ) {
options.data = 'pll_post_id=' + $( '#affected' ).val() + '&' + options.data;
}
}
);
}
);