MediaWiki

Difference between revisions of "Gadget-Login.js"

From ACES

(Created page with "$(function () { "use strict"; if (window.LoginLink) { return; } window.LoginLink = true; mw.hook("wikipage.content").add(function ($content) { $("#cosmos-foo...")
 
(fix)
 
(2 intermediate revisions by the same user not shown)
Line 6: Line 6:
   window.LoginLink = true;
   window.LoginLink = true;
   mw.hook("wikipage.content").add(function ($content) {
   mw.hook("wikipage.content").add(function ($content) {
     $("#cosmos-footerLinks-places").add("Hello World");
     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);
    });
   });
   });
});
});

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);
    });
  });
});