Changeset 3751971 for mxchat-basic/trunk/includes/class-mxchat-public.php
- Timestamp:
- 10/17/2026 01:47:11 PM (12 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mxchat-basic/trunk/includes/class-mxchat-public.php
r3738408 r3751971 242 242 // Just remove the old should_hide_chatbot() check from the beginning 243 243 244 // Check for Complianz consent if the toggle is enabled 244 // The chat window always starts closed ("hidden"; chat-script.js opens it). 245 // The floating LAUNCHER is rendered visible (plan 332252), so it paints 246 // from this HTML and chat-style.css before any script runs: a cache or 247 // optimisation plugin that delays JavaScript until the visitor interacts 248 // (Delay JavaScript in WP Rocket, LiteSpeed, FlyingPress, Perfmatters, 249 // Flying Scripts) no longer leaves the page with no chatbot at all. Until 250 // the script has bound its handler a click on it does nothing; the window 251 // never half-opens. The launcher starts hidden only where something must 252 // be decided in the browser: 253 // (a) Complianz consent (complianz_toggle on): hidden + no-consent for 254 // every render, revealed by chat-script.js when the visitor has 255 // consented. Not decided from the consent cookie here: consent is 256 // per visitor, and a page cache would hand one visitor's state to 257 // the next. Fails closed, exactly as before. 258 // (b) Open on load: core has no auto-open. Add-ons that open the chat 259 // (Trigger, the Multi-Bot handoff) click this launcher, and core's 260 // open handler hides it as it opens the window. 261 // (c) Multi-Bot page rules: the bot is chosen on the server (the 262 // router's shortcode filter and compute_display_bot()), so there is 263 // nothing left to decide in the browser. 245 264 $initial_visibility = 'hidden'; 246 265 $additional_class = ''; 247 266 $launcher_class = ''; 267 248 268 if (isset($current_options['complianz_toggle']) && $current_options['complianz_toggle'] === 'on') { 249 269 $additional_class = ' no-consent'; 250 }251 $visibility_class = $initial_visibility . $additional_class;270 $launcher_class = ' hidden no-consent'; 271 } 252 272 253 273 $theme_options = get_option('mxchat_theme_options', array()); … … 644 664 } 645 665 646 $is_initially_hidden = (strpos($visibility_class, 'hidden') !== false);647 $aria_expanded = $is_initially_hidden ? 'false' : 'true';648 echo '<div class="floating-chatbot-button ' . esc_attr($visibility_class) . '" id="floating-chatbot-button-' . esc_attr($bot_id) . '" role="button" tabindex="0" aria-label="' . esc_attr__('Open chat', 'mxchat') . '" aria-expanded="' . esc_attr($aria_expanded) . '" aria-controls="floating-chatbot-' . esc_attr($bot_id) . '"' . ($skip_inline_colors ? '' : ' style="background: ' . esc_attr($chatbot_background_color) . '; color: ' . esc_attr($send_button_font_color) . ';"') . '>';666 // aria-expanded describes the window, which always starts closed 667 // (it used to be derived from the launcher's own hidden class). 668 echo '<div class="floating-chatbot-button' . esc_attr($launcher_class) . '" id="floating-chatbot-button-' . esc_attr($bot_id) . '" role="button" tabindex="0" aria-label="' . esc_attr__('Open chat', 'mxchat') . '" aria-expanded="false" aria-controls="floating-chatbot-' . esc_attr($bot_id) . '"' . ($skip_inline_colors ? '' : ' style="background: ' . esc_attr($chatbot_background_color) . '; color: ' . esc_attr($send_button_font_color) . ';"') . '>'; 649 669 echo '<div id="chat-notification-badge-' . esc_attr($bot_id) . '" class="chat-notification-badge" style="display: none; position: absolute; top: -8px; right: -8px; background-color: #ff4444; color: white; border-radius: 50%; padding: 4px 8px; font-size: 12px; font-weight: bold; z-index: 10001;">1</div>'; 650 670
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)