MediaWiki:Common.js: Difference between revisions

Content deleted Content added
No edit summary
Tag: Reverted
No edit summary
Tag: Manual revert
Line 307:
 
/* DO NOT ADD CODE BELOW THIS LINE */
 
/* ======================================================= */
/* MOBILE AI ASSISTANT: INJECT CLOSE BUTTON IN FOOTER */
/* ======================================================= */
$(function() {
// Run an interval to check for the footer appearing (handles slow loading)
var checkFooter = setInterval(function() {
var $footer = $('.ext-aiassistant-footer');
if ($footer.length) {
clearInterval(checkFooter);
// Prevent duplicates
if ($('#ai-assistant-close-mobile').length === 0) {
var $closeBtn = $('<button>', {
id: 'ai-assistant-close-mobile',
// Use 'quiet' class so it doesn't conflict with our custom CSS colors
class: 'cdx-button cdx-button--weight-quiet cdx-button--icon-only',
title: 'Close Assistant',
click: function() {
// 1. Hide the panel
$('.ext-aiassistant-panel').hide();
// 2. FORCE SHOW THE CHAT ICON (TRIGGER)
// We use attr('style') to override any !important hidden rules
$('.ext-aiassistant-trigger').attr('style', 'display: block !important');
}
});
 
// Icon SVG (X shape)
var iconSvg = '<span class="cdx-icon cdx-icon--medium"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"><path d="M4.34 2.93l12.73 12.73-1.41 1.41L2.93 4.35z"/><path d="M17.07 4.34L4.34 17.07l-1.41-1.41L15.66 2.93z" fill="currentColor"/></svg></span>';
$closeBtn.html(iconSvg);
 
// Prepend to put it on the Left side
$footer.prepend($closeBtn);
}
}
}, 200);
});