Skip to content

Simplify and optimize loading the gadget #415

@siddharthvp

Description

@siddharthvp

Currently, only the https://en.wikipedia.org/wiki/MediaWiki:Gadget-afchelper.js page gets loaded via ResourceLoader. If you're in User or Draft namespaces, it loads /core.js and /submissions.js and everything else (css, html templates).

Instead, we can use the gadget definition to restrict the gadget to those namespaces. We can then remove all manual http calls and just let ResourceLoader load everything in one go. Note that ResourceLoader uses browser caches (localstorage and/or disk cache) and is much faster than using mw.loader.load to invoke action=raw which is not cached at all.

  • move namespace check to MediaWiki:Gadgets-definition
  • move page loads to MediaWiki:Gadgets-definition, then remove $.getScript(), AFCH.load(), and mw.loader.load code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions