MediaWiki

Gadget-Login.js

From ACES

Revision as of 22:15, 1 September 2021 by Yid010 (talk | contribs)

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
$(function () {
  "use strict";
  if (window.LoginLink) {
    return;
  }
  window.LoginLink = true;
  mw.hook("wikipage.content").add(function ($content) {
    mw.loader.using("mediawiki.api", function () {
      var wgArticlePath = mw.config.get("wgArticlePath");

      var linkEntry = $("<li></li>").addClass("cosmos-footerLinks-listItem");
      var linkEle = $("<a></a>")
        .text("Login")
        .attr("href", wgArticlePath.replace("Special:UserLogin"));
      linkEntry.append(linkEle);

      $("#cosmos-footerLinks-places").append(linkEntry);
    });
  });
});