Skip to content

Commit

Permalink
Add types for JQuery plugin of mediawiki.util
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien LESÉNÉCHAL committed Mar 8, 2024
1 parent d764135 commit 651af94
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions jquery/updateTooltipAccessKeys.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Navigator } from "./client";

declare global {
interface JQuery {
updateTooltipAccessKeys: TooltipAccessKeys<this>;
}
}

type Modifier = "alt" | "alt-shift" | "ctrl" | "ctrl-option";

interface TooltipAccessKeys<This = JQuery> {
/**
* Update the titles for all elements in a jQuery selection.
*
* @returns {JQuery}
*/
(): This;

/**
* Get the access key label for an element.
*
* Will use native accessKeyLabel if available (currently only in Firefox 8+),
* falls back to #getAccessKeyModifiers.
*
* @param {HTMLElement} element Element to get the label for
* @returns {string} Access key label
*/
// result may be HTMLElement.accessKeyLabel, the format of which depend very much on the browser.
getAccessKeyLabel(element: HTMLElement): string;

/**
* @param {Navigator} [nav] An object with a 'userAgent' and 'platform' property.
* @returns {string}
*/
getAccessKeyPrefix(nav?: Navigator): `${Modifier}-`;

/**
* Switch test mode on and off.
*
* @param {boolean} mode New mode
*/
setTestMode(mode: boolean): void;
}

export {};

0 comments on commit 651af94

Please sign in to comment.