MediaWiki

Difference between revisions of "Gadget-Login.js"

From ACES

(fix)
 
(One intermediate revision by the same user not shown)
Line 10: Line 10:


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



Latest revision as of 22:16, 1 September 2021

$(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("$1", "Special:UserLogin"));
      linkEntry.append(linkEle);

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