MediaWiki:Common.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 26:
 
/**
* @source https://www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL
* @rev 6
*/
Line 124:
// CapSach — Sticky TOC overlay (UNRESTRICTED: Works on iPad/Desktop/Mobile)
(function () {
 
// 1. REMOVED the "min-width: 768px" check. Now runs everywhere.
 
Line 220:
 
// Force button display immediately
btn.style.display = 'flex';
btn.addEventListener('click', openOverlay);
 
Line 317:
// Check if the button already exists to prevent duplicates
if ($('#custom-email-btn').length === 0) {
 
// Create the email button element
var emailBtn = $('<a>', {
Line 335:
$('.fullscreen-logo').css('cursor', 'pointer').click(function(e) {
e.preventDefault();
 
// Method 1: Click the AI Assistant floating icon
var $aiButton = $('img[src*="ai-icon.png"]').closest('div, button, a');
Line 342:
return;
}
 
// Method 2: Try the extension's trigger class
var $trigger = $('.ext-aiassistant-trigger, .ext-aiassistant');
Line 354:
});
 
/* Collapsible inlineInline footnotes ({{footnote}}): toggleneed NO JavaScript: the note onis shown chipby
the browser's native title tooltip on desktop and a CSS attr(title) bubble
click; Enter/Space and aria-expanded for keyboard + screen readers. */
on touch (see MediaWiki:Common.css .ed-fn rules). */
$( function () {
$( '.ed-fn-chip' ).attr( { role: 'button', tabindex: 0, 'aria-expanded': 'false' } );
$( document ).on( 'click keydown', '.ed-fn-chip', function ( e ) {
if ( e.type === 'keydown' && e.key !== 'Enter' && e.key !== ' ' ) {
return;
}
var fn = $( this ).closest( '.ed-fn' ).toggleClass( 'ed-fn-open' );
$( this ).attr( 'aria-expanded', fn.hasClass( 'ed-fn-open' ) ? 'true' : 'false' );
e.preventDefault();
} );
} );