Options
All
  • Public
  • Public/Protected
  • All
Menu

twinkle-core

Index

Type aliases

BlockPresetInfo

BlockPresetInfo: { autoblock?: boolean; disabletalk?: boolean; expiry?: string; forAnonOnly?: boolean; forRangeOnly?: boolean; forRegisteredOnly?: boolean; hardblock?: boolean; nocreate?: boolean; noemail?: boolean; nonstandard?: boolean; pageParam?: boolean; prependReason?: boolean; reason?: string; reasonParam?: boolean; requireGroup?: string; sig?: string | null; summary?: string; suppressArticleInSummary?: boolean; templateName?: string; useInitialOptions?: boolean }

Type declaration

  • Optional autoblock?: boolean
  • Optional disabletalk?: boolean
  • Optional expiry?: string
  • Optional forAnonOnly?: boolean
  • Optional forRangeOnly?: boolean
  • Optional forRegisteredOnly?: boolean
  • Optional hardblock?: boolean
  • Optional nocreate?: boolean
  • Optional noemail?: boolean
  • Optional nonstandard?: boolean
  • Optional pageParam?: boolean
  • Optional prependReason?: boolean
  • Optional reason?: string
  • Optional reasonParam?: boolean
  • Optional requireGroup?: string
  • Optional sig?: string | null
  • Optional summary?: string
  • Optional suppressArticleInSummary?: boolean
  • Optional templateName?: string
  • Optional useInitialOptions?: boolean

LogEvent

LogEvent: { action: string; comment: string; logid: number; logpage: number; ns: number; pageid: number; params: any; timestamp: string; title: string; type: string; user: string }

Type declaration

  • action: string
  • comment: string
  • logid: number
  • logpage: number
  • ns: number
  • pageid: number
  • params: any
  • timestamp: string
  • title: string
  • type: string
  • user: string

Preference

Preference: { adminOnly?: boolean; default: boolean | string | number | { label: string; value: string }[]; enumValues?: Record<string, string>; helptip?: string; label?: string; name: string; setValues?: Record<string, string>; type: "boolean" | "string" | "enum" | "integer" | "set" | "customList" }

Type declaration

  • Optional adminOnly?: boolean
  • default: boolean | string | number | { label: string; value: string }[]
  • Optional enumValues?: Record<string, string>
  • Optional helptip?: string
  • Optional label?: string
  • name: string
  • Optional setValues?: Record<string, string>
  • type: "boolean" | "string" | "enum" | "integer" | "set" | "customList"

PreferenceGroup

PreferenceGroup: { adminOnly?: boolean; hidden?: boolean; module?: string; preferences: Preference[]; title: string }

Type declaration

  • Optional adminOnly?: boolean
  • Optional hidden?: boolean
  • Optional module?: string
  • preferences: Preference[]
  • title: string

footerLinks

footerLinks: Record<string, string>

tagListType

tagListType: tagData[] | Record<string, tagData[] | Record<string, tagData[]>>

Variables

Const NS_CATEGORY

NS_CATEGORY: number = ...

Const NS_FILE

NS_FILE: number = ...

Const NS_MAIN

NS_MAIN: number = ...

Const NS_PROJECT

NS_PROJECT: number = ...

Const NS_SPECIAL

NS_SPECIAL: number = ...

Const NS_TALK

NS_TALK: number = ...

Const NS_TEMPLATE

NS_TEMPLATE: number = ...

Const NS_USER

NS_USER: number = ...

Const NS_USER_TALK

NS_USER_TALK: number = ...

Let language

language: string = ...

The language used for all messages in twinkle-core. This includes interface messages as well as edits made to the wiki. Ideally the interface messages should have been in wgUserLanguage and edits in wgContentLanguage, but this duality is not presently supported.

Let userDisabledModules

userDisabledModules: string[] = []

List of names of modules disabled by user. Populated in init() before modules are initialised.

Functions

addMessages

  • addMessages(messages: Messages): void
  • Load messages into the message store.

    Parameters

    • messages: Messages

    Returns void

addNs

  • addNs(title: string, namespaceNumber: number): string
  • Add namespace name to page title if not already given CAUTION: namespace name won't be added if a namespace (not necessarily the same as the one given) already is there in the title

    Parameters

    • title: string
    • namespaceNumber: number

    Returns string

addPortletLink

  • addPortletLink(task: string | (() => void), text: string, id: string, tooltip: string): HTMLLIElement
  • Builds a portlet menu if it doesn't exist yet, and add the portlet link.

    Parameters

    • task: string | (() => void)
    • text: string
    • id: string
    • tooltip: string

    Returns HTMLLIElement

arr_find

  • arr_find<T>(arr: T[], predicate: (value: T, index: number, obj: T[]) => boolean): T
  • Type parameters

    • T

    Parameters

    • arr: T[]
    • predicate: (value: T, index: number, obj: T[]) => boolean
        • (value: T, index: number, obj: T[]): boolean
        • Parameters

          • value: T
          • index: number
          • obj: T[]

          Returns boolean

    Returns T

arr_flatMap

  • arr_flatMap<T>(arr: T[], callbackfn: (value: T, index: number, array: T[]) => T | ReadonlyArray<T>): any
  • Type parameters

    • T

    Parameters

    • arr: T[]
    • callbackfn: (value: T, index: number, array: T[]) => T | ReadonlyArray<T>
        • (value: T, index: number, array: T[]): T | ReadonlyArray<T>
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns T | ReadonlyArray<T>

    Returns any

arr_includes

  • arr_includes<T>(arr: T[], item: T): boolean
  • Type parameters

    • T

    Parameters

    • arr: T[]
    • item: T

    Returns boolean

generateArrowLinks

  • generateArrowLinks(checkbox: HTMLInputElement): void
  • Parameters

    • checkbox: HTMLInputElement

    Returns void

generateBatchPageLinks

  • generateBatchPageLinks(checkbox: HTMLInputElement): void
  • Parameters

    • checkbox: HTMLInputElement

    Returns void

getPref

  • getPref(name: string): any

init

  • init(): void

initMessaging

  • initMessaging(): Promise<void | [any[], void]>
  • Initialize the message store. Called from init.ts.

    Returns Promise<void | [any[], void]>

isTextRedirect

  • isTextRedirect(text: string): boolean

link

  • link(displaytext: string, title: string, params?: any): string
  • Parameters

    • displaytext: string
    • title: string
    • Optional params: any

    Returns string

loadAdditionalMediaWikiMessages

  • loadAdditionalMediaWikiMessages(messageList: string[]): Promise<any[]>
  • Load messages from MediaWiki, in addition to what twinkle-core loads.

    Parameters

    • messageList: string[]

    Returns Promise<any[]>

loadUserConfig

  • loadUserConfig(): JQuery.Promise<void>

makeArray

  • makeArray<T>(obj: T | T[] | undefined | null): T[]
  • Type parameters

    • T

    Parameters

    • obj: T | T[] | undefined | null

    Returns T[]

makeOptoutLink

  • makeOptoutLink(module: string): string

makeTemplate

  • makeTemplate(name: string, parameters: Record<string | number, string>): string
  • Make template wikitext from the template name and parameters

    Parameters

    • name: string

      name of the template. Include "subst:" if necessary

    • parameters: Record<string | number, string>

      object with keys and values being the template param names and values. Use numbers as keys for unnamed parameters. If a value is falsy (undefined or null or empty string), the param doesn't appear in output.

    Returns string

msg

  • msg(msg: string, ...parameters: (string | number | string[])[]): string
  • Get parsed message.

    Parameters

    • msg: string

      the message name

    • Rest ...parameters: (string | number | string[])[]

      the parameters for $1, $2, ... substitutions

    Returns string

num2order

  • num2order(num: number): string

obj_entries

  • obj_entries<T>(obj: {} | ArrayLike<T>): [string, T][]
  • Type parameters

    • T

    Parameters

    • obj: {} | ArrayLike<T>

    Returns [string, T][]

obj_fromEntries

  • obj_fromEntries<T>(entries: [string, T][]): Record<string, T>
  • Type parameters

    • T

    Parameters

    • entries: [string, T][]

    Returns Record<string, T>

obj_values

  • obj_values<T>(obj: {} | ArrayLike<T>): T[]
  • Type parameters

    • T

    Parameters

    • obj: {} | ArrayLike<T>

    Returns T[]

registerModule

setDefaultConfig

  • setDefaultConfig(config: { name: string; value: any }[]): void
  • Extends the defaultConfig

    Parameters

    • config: { name: string; value: any }[]

    Returns void

setPortletConfig

  • setPortletConfig(): void
  • Set portlet configurations, which are skin-specific XXX: move to Config.ts and avoid the function

    Returns void

sortByNamespace

  • sortByNamespace(first: any, second: any): number
  • Parameters

    • first: any
    • second: any

    Returns number

str_endsWith

  • str_endsWith(str: string, text: string): boolean
  • Parameters

    • str: string
    • text: string

    Returns boolean

str_includes

  • str_includes(str: string, item: string): boolean
  • Parameters

    • str: string
    • item: string

    Returns boolean

str_startsWith

  • str_startsWith(str: string, text: string): boolean
  • Parameters

    • str: string
    • text: string

    Returns boolean

stripNs

  • stripNs(title: string): string
  • Remove namespace name from title if present Exception-safe wrapper around mw.Title

    Parameters

    • title: string

    Returns string

urlParamValue

  • urlParamValue(param: string): string
  • Get URL parameter. Alias for mw.util.getParamValue

    Parameters

    • param: string

    Returns string

Generated using TypeDoc