fix: YouTube-Elementor-widget laedt video wieder zuverlaessig (v1.4.6)
Der reload-ansatz aus 1.4.4 fuer e-youtube-base war unzuverlaessig (Elementor rendert nach reload nicht sicher nativ). Zurueck zum direkten weg: aus dem "source"-key habe ich die embed-URL -> ich baue das iframe bei einwilligung selbst (unabhaengig von Elementor/iframe_api). Das iframe bekommt eine responsive 16:9-aspect-ratio (data-cb-aspect) und laedt damit voll und in originalproportionen, auch ohne definite parent-hoehe. Reload-pfad bleibt nur fuer den fall ganz ohne URL (video_type-fallback). Weissraum-einklappen unveraendert. node --check ok. + version 1.4.6. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -126,6 +126,16 @@
|
|||||||
if ( blockerEl.dataset.width ) iframe.width = blockerEl.dataset.width;
|
if ( blockerEl.dataset.width ) iframe.width = blockerEl.dataset.width;
|
||||||
if ( blockerEl.dataset.height ) iframe.height = blockerEl.dataset.height;
|
if ( blockerEl.dataset.height ) iframe.height = blockerEl.dataset.height;
|
||||||
|
|
||||||
|
// Responsive aspect (Elementor video widgets we build ourselves): full
|
||||||
|
// width at the given ratio, so it loads at its original proportions even
|
||||||
|
// without a definite parent height.
|
||||||
|
if ( blockerEl.dataset.cbAspect ) {
|
||||||
|
iframe.style.width = '100%';
|
||||||
|
iframe.style.height = 'auto';
|
||||||
|
iframe.style.aspectRatio = blockerEl.dataset.cbAspect;
|
||||||
|
}
|
||||||
|
iframe.style.border = '0';
|
||||||
|
|
||||||
iframe.setAttribute( 'loading', 'lazy' );
|
iframe.setAttribute( 'loading', 'lazy' );
|
||||||
iframe.setAttribute( 'allowfullscreen', '' );
|
iframe.setAttribute( 'allowfullscreen', '' );
|
||||||
iframe.setAttribute( 'referrerpolicy', 'no-referrer-when-downgrade' );
|
iframe.setAttribute( 'referrerpolicy', 'no-referrer-when-downgrade' );
|
||||||
@@ -409,15 +419,19 @@
|
|||||||
|
|
||||||
// Neutralise Elementor so it won't build the player / load the overlay.
|
// Neutralise Elementor so it won't build the player / load the overlay.
|
||||||
widget.removeAttribute( 'data-settings' );
|
widget.removeAttribute( 'data-settings' );
|
||||||
const placeholder = buildPlaceholder( svc, embed, {} );
|
|
||||||
|
|
||||||
// These widgets are built entirely by JS (no server iframe we could
|
// With an embed URL we build the iframe ourselves on consent (reliable,
|
||||||
// catch). Rather than guess the embed size, reload on consent so
|
// independent of Elementor/iframe_api). The iframe gets a responsive
|
||||||
// Elementor renders the player natively at its ORIGINAL size. Drop the
|
// 16:9 aspect so it loads full-width at its original proportions.
|
||||||
// "load once" option (it can't apply here).
|
// Without a URL we fall back to reloading so Elementor renders it.
|
||||||
|
const placeholder = buildPlaceholder( svc, embed, {} );
|
||||||
|
if ( embed ) {
|
||||||
|
placeholder.dataset.cbAspect = '16 / 9';
|
||||||
|
} else {
|
||||||
placeholder.setAttribute( 'data-cb-reload', '1' );
|
placeholder.setAttribute( 'data-cb-reload', '1' );
|
||||||
const remember = placeholder.querySelector( '.cb-blocker__remember' );
|
const remember = placeholder.querySelector( '.cb-blocker__remember' );
|
||||||
if ( remember ) remember.remove();
|
if ( remember ) remember.remove();
|
||||||
|
}
|
||||||
|
|
||||||
container.innerHTML = '';
|
container.innerHTML = '';
|
||||||
container.appendChild( placeholder );
|
container.appendChild( placeholder );
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: GDPR Content Blocker
|
* Plugin Name: GDPR Content Blocker
|
||||||
* Plugin URI: https://lucas-orth.de
|
* Plugin URI: https://lucas-orth.de
|
||||||
* Description: DSGVO-konformer Consent-Blocker für externe iframes. Lädt Drittinhalte erst nach aktiver Einwilligung.
|
* Description: DSGVO-konformer Consent-Blocker für externe iframes. Lädt Drittinhalte erst nach aktiver Einwilligung.
|
||||||
* Version: 1.4.5
|
* Version: 1.4.6
|
||||||
* Author: Lucas Orth
|
* Author: Lucas Orth
|
||||||
* Author URI: https://lucas-orth.de
|
* Author URI: https://lucas-orth.de
|
||||||
* Text Domain: gdpr-content-blocker
|
* Text Domain: gdpr-content-blocker
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
define( 'CB_VERSION', '1.4.5' );
|
define( 'CB_VERSION', '1.4.6' );
|
||||||
define( 'CB_FILE', __FILE__ );
|
define( 'CB_FILE', __FILE__ );
|
||||||
define( 'CB_DIR', plugin_dir_path( __FILE__ ) );
|
define( 'CB_DIR', plugin_dir_path( __FILE__ ) );
|
||||||
define( 'CB_URL', plugin_dir_url( __FILE__ ) );
|
define( 'CB_URL', plugin_dir_url( __FILE__ ) );
|
||||||
|
|||||||
Reference in New Issue
Block a user