fix: textausrichtung-option + hover-fixes (link/badge) + remember-farbe (v1.5.2)

- Darstellung: neue option "Textausrichtung" (mittig/links/rechts). Setzt
  --cb-align (text-align) und --cb-justify (remember-zeile) inline.
- "Diesen Dienst kuenftig immer laden" nutzt jetzt die textfarbe (var(--cb-text),
  ohne dimming).
- Datenschutz-link: schriftgroesse/-gewicht/laufweite/transform/decoration in
  allen zustaenden festgenagelt -> keine theme-a:hover-aenderung mehr.
- Werbe-badge: dito -> wird beim hover nicht mehr riesig (theme-scaling/
  font-size gesperrt).

+ i18n DE/EN (138 strings). version 1.5.2.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
s4luorth
2026-06-08 17:41:26 +02:00
parent 6caece78f5
commit ef84c43ded
9 changed files with 74 additions and 23 deletions

View File

@@ -34,19 +34,28 @@
/* No reserved height: the placeholder is exactly as tall as its content. */ /* No reserved height: the placeholder is exactly as tall as its content. */
} }
/* ── Promo badge (bottom-right) ── */ /* ── Promo badge (bottom-right) ── (locked against theme a:hover scaling) */
.cb-blocker .cb-blocker__badge { .cb-blocker .cb-blocker__badge,
.cb-blocker .cb-blocker__badge:hover,
.cb-blocker .cb-blocker__badge:focus {
position: absolute; position: absolute;
right: 8px; right: 8px;
bottom: 5px; bottom: 5px;
font-size: 0.6875rem; font-size: 0.6875rem;
line-height: 1; line-height: 1;
font-weight: 400;
letter-spacing: normal;
color: var(--cb-text); color: var(--cb-text);
background: none;
white-space: nowrap;
transform: none;
}
.cb-blocker .cb-blocker__badge {
opacity: 0.55; opacity: 0.55;
text-decoration: none; text-decoration: none;
white-space: nowrap;
} }
.cb-blocker .cb-blocker__badge:hover { .cb-blocker .cb-blocker__badge:hover,
.cb-blocker .cb-blocker__badge:focus {
opacity: 1; opacity: 1;
text-decoration: underline; text-decoration: underline;
} }
@@ -55,7 +64,7 @@
.cb-blocker .cb-blocker__inner { .cb-blocker .cb-blocker__inner {
width: 100%; width: 100%;
max-width: 520px; max-width: 520px;
text-align: center; text-align: var(--cb-align, center); /* set in Appearance: center|left|right */
} }
/* ── Text elements ── */ /* ── Text elements ── */
@@ -79,23 +88,22 @@
color: var(--cb-text); /* same colour as the rest of the text */ color: var(--cb-text); /* same colour as the rest of the text */
} }
/* ── Privacy link ── */ /* ── Privacy link ── (locked so the theme's a:hover can't restyle/resize it) */
.cb-blocker .cb-blocker__privacy-link { .cb-blocker .cb-blocker__privacy-link,
.cb-blocker .cb-blocker__privacy-link:hover,
.cb-blocker .cb-blocker__privacy-link:focus {
display: inline-block; display: inline-block;
margin-bottom: 0.75em; margin-bottom: 0.75em;
font-size: 0.8125rem; font-size: 0.8125rem;
line-height: 1.5; line-height: 1.5;
font-weight: 400;
letter-spacing: normal;
color: var(--cb-btn-bg); color: var(--cb-btn-bg);
background: none;
text-decoration: underline; text-decoration: underline;
text-decoration-thickness: 1px;
text-underline-offset: 3px; text-underline-offset: 3px;
transform: none; /* neutralise theme hover scaling */ transform: none;
}
.cb-blocker .cb-blocker__privacy-link:hover,
.cb-blocker .cb-blocker__privacy-link:focus {
color: var(--cb-btn-hover-bg);
transform: none; /* link must not grow on hover */
font-size: 0.8125rem;
} }
/* ── Button ── */ /* ── Button ── */
@@ -137,11 +145,11 @@
.cb-blocker .cb-blocker__remember { .cb-blocker .cb-blocker__remember {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: var(--cb-justify, center); /* follows the text alignment */
gap: 6px; gap: 6px;
margin-top: 0.8em; margin-top: 0.8em;
font-size: 0.8rem; font-size: 0.8rem;
opacity: 0.85; color: var(--cb-text); /* same colour as the rest of the text */
cursor: pointer; cursor: pointer;
} }
.cb-blocker .cb-blocker__remember input { .cb-blocker .cb-blocker__remember input {

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@@ -3,7 +3,7 @@
* Plugin Name: GDPR Content Blocker * Plugin Name: GDPR Content Blocker
* Plugin URI: https://lucas-orth.de/wp-plugins/gdpr-content-blocker/ * Plugin URI: https://lucas-orth.de/wp-plugins/gdpr-content-blocker/
* 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.5.1 * Version: 1.5.2
* 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.5.1' ); define( 'CB_VERSION', '1.5.2' );
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__ ) );

View File

@@ -80,14 +80,19 @@ class CB_Renderer {
// Build one inline block: CSS variables first, the user's Custom-CSS LAST // Build one inline block: CSS variables first, the user's Custom-CSS LAST
// so it always overrides. Emitted as a single wp_add_inline_style call. // so it always overrides. Emitted as a single wp_add_inline_style call.
$align = in_array( $style['text_align'] ?? 'center', [ 'left', 'center', 'right' ], true ) ? $style['text_align'] : 'center';
$justify = [ 'left' => 'flex-start', 'center' => 'center', 'right' => 'flex-end' ][ $align ];
$inline = sprintf( $inline = sprintf(
':root{--cb-text:%s;--cb-bg:%s;--cb-btn-bg:%s;--cb-btn-text:%s;--cb-btn-hover-bg:%s;--cb-btn-hover-text:%s;}', ':root{--cb-text:%s;--cb-bg:%s;--cb-btn-bg:%s;--cb-btn-text:%s;--cb-btn-hover-bg:%s;--cb-btn-hover-text:%s;--cb-align:%s;--cb-justify:%s;}',
esc_attr( $style['text_color'] ), esc_attr( $style['text_color'] ),
esc_attr( $style['bg_color'] ), esc_attr( $style['bg_color'] ),
esc_attr( $style['button_bg'] ), esc_attr( $style['button_bg'] ),
esc_attr( $style['button_text'] ), esc_attr( $style['button_text'] ),
esc_attr( $style['button_hover_bg'] ), esc_attr( $style['button_hover_bg'] ),
esc_attr( $style['button_hover_text'] ) esc_attr( $style['button_hover_text'] ),
esc_attr( $align ),
esc_attr( $justify )
); );
if ( trim( (string) $style['custom_css'] ) !== '' ) { if ( trim( (string) $style['custom_css'] ) !== '' ) {

View File

@@ -47,6 +47,9 @@ class CB_Settings {
$val = isset( $input[ $key ] ) ? sanitize_text_field( $input[ $key ] ) : ''; $val = isset( $input[ $key ] ) ? sanitize_text_field( $input[ $key ] ) : '';
$clean[ $key ] = self::sanitize_hex_color( $val ) ?? $defaults[ $key ]; $clean[ $key ] = self::sanitize_hex_color( $val ) ?? $defaults[ $key ];
} }
$align = $input['text_align'] ?? 'center';
$clean['text_align'] = in_array( $align, [ 'left', 'center', 'right' ], true ) ? $align : 'center';
$clean['custom_css'] = isset( $input['custom_css'] ) $clean['custom_css'] = isset( $input['custom_css'] )
? wp_strip_all_tags( $input['custom_css'] ) ? wp_strip_all_tags( $input['custom_css'] )
: ''; : '';
@@ -71,6 +74,7 @@ class CB_Settings {
'button_text' => '#ffffff', 'button_text' => '#ffffff',
'button_hover_bg' => '#1a369a', 'button_hover_bg' => '#1a369a',
'button_hover_text' => '#ffffff', 'button_hover_text' => '#ffffff',
'text_align' => 'center',
'custom_css' => '', 'custom_css' => '',
'hide_badge' => false, 'hide_badge' => false,
]; ];
@@ -670,6 +674,20 @@ class CB_Settings {
echo '<tr><th scope="row"><label>' . esc_html( $label ) . '</label></th>'; echo '<tr><th scope="row"><label>' . esc_html( $label ) . '</label></th>';
echo '<td><input type="text" class="cb-color-picker" name="' . esc_attr( CB_STYLE_OPTION . '[' . $key . ']' ) . '" value="' . $val . '" data-default-color="' . $val . '"></td></tr>'; echo '<td><input type="text" class="cb-color-picker" name="' . esc_attr( CB_STYLE_OPTION . '[' . $key . ']' ) . '" value="' . $val . '" data-default-color="' . $val . '"></td></tr>';
} }
// Text alignment of the placeholder content.
$align = in_array( $style['text_align'] ?? 'center', [ 'left', 'center', 'right' ], true ) ? $style['text_align'] : 'center';
$options = [
'center' => __( 'Mittig', 'gdpr-content-blocker' ),
'left' => __( 'Linksbündig', 'gdpr-content-blocker' ),
'right' => __( 'Rechtsbündig', 'gdpr-content-blocker' ),
];
echo '<tr><th scope="row"><label>' . esc_html__( 'Textausrichtung', 'gdpr-content-blocker' ) . '</label></th><td>';
echo '<select name="' . esc_attr( CB_STYLE_OPTION . '[text_align]' ) . '">';
foreach ( $options as $val => $label ) {
echo '<option value="' . esc_attr( $val ) . '"' . selected( $align, $val, false ) . '>' . esc_html( $label ) . '</option>';
}
echo '</select></td></tr>';
// Promo-badge toggle — only effective with an active unlimited licence. // Promo-badge toggle — only effective with an active unlimited licence.
$unlimited = CB_License::is_unlimited(); $unlimited = CB_License::is_unlimited();
echo '<tr><th scope="row">' . esc_html__( 'Werbe-Badge', 'gdpr-content-blocker' ) . '</th><td>'; echo '<tr><th scope="row">' . esc_html__( 'Werbe-Badge', 'gdpr-content-blocker' ) . '</th><td>';

View File

@@ -312,6 +312,18 @@ msgstr "Button hover: background color"
msgid "Button Hover: Textfarbe" msgid "Button Hover: Textfarbe"
msgstr "Button hover: text color" msgstr "Button hover: text color"
msgid "Mittig"
msgstr "Centered"
msgid "Linksbündig"
msgstr "Left-aligned"
msgid "Rechtsbündig"
msgstr "Right-aligned"
msgid "Textausrichtung"
msgstr "Text alignment"
msgid "Werbe-Badge" msgid "Werbe-Badge"
msgstr "Promo badge" msgstr "Promo badge"

View File

@@ -1,4 +1,4 @@
# 134 unique strings # 138 unique strings
MSGID Ungültige Antwort vom Lizenzserver. MSGID Ungültige Antwort vom Lizenzserver.
MSGID Keine Berechtigung. MSGID Keine Berechtigung.
MSGID Bitte einen Lizenzschlüssel eingeben. MSGID Bitte einen Lizenzschlüssel eingeben.
@@ -101,6 +101,10 @@ MSGID Button: Hintergrundfarbe
MSGID Button: Textfarbe MSGID Button: Textfarbe
MSGID Button Hover: Hintergrundfarbe MSGID Button Hover: Hintergrundfarbe
MSGID Button Hover: Textfarbe MSGID Button Hover: Textfarbe
MSGID Mittig
MSGID Linksbündig
MSGID Rechtsbündig
MSGID Textausrichtung
MSGID Werbe-Badge MSGID Werbe-Badge
MSGID Badge „GDPR Content Blocker" im Platzhalter ausblenden MSGID Badge „GDPR Content Blocker" im Platzhalter ausblenden
MSGID Das Ausblenden ist nur mit einer aktiven Unlimited-Lizenz möglich. MSGID Das Ausblenden ist nur mit einer aktiven Unlimited-Lizenz möglich.

View File

@@ -133,5 +133,9 @@
"style=\"button\" zeigt eine Schaltfläche (Standard), style=\"link\" einen schlichten Textlink.": "style=\"button\" shows a button (default), style=\"link\" a plain text link.", "style=\"button\" zeigt eine Schaltfläche (Standard), style=\"link\" einen schlichten Textlink.": "style=\"button\" shows a button (default), style=\"link\" a plain text link.",
"Werbe-Badge": "Promo badge", "Werbe-Badge": "Promo badge",
"Badge „GDPR Content Blocker\" im Platzhalter ausblenden": "Hide the \"GDPR Content Blocker\" badge in the placeholder", "Badge „GDPR Content Blocker\" im Platzhalter ausblenden": "Hide the \"GDPR Content Blocker\" badge in the placeholder",
"Das Ausblenden ist nur mit einer aktiven Unlimited-Lizenz möglich.": "Hiding it is only possible with an active unlimited licence." "Das Ausblenden ist nur mit einer aktiven Unlimited-Lizenz möglich.": "Hiding it is only possible with an active unlimited licence.",
"Textausrichtung": "Text alignment",
"Mittig": "Centered",
"Linksbündig": "Left-aligned",
"Rechtsbündig": "Right-aligned"
} }