User:Антаркт/fandommobile.js

mw.loader.using("mediawiki.api").then(   function  {        return new mw.Api.loadMessagesIfMissing(["community-header-pages"]);    } ).then(    function  {        $.ajax({ url: encodeURI(mw.config.get("wgServer") + mw.config.get("wgScriptPath") + "/api/v1/Articles/Details"), type: "GET", data: { controller: "DesignSystemApi", method: "getCommunityHeader", product: "wikis", id: mw.config.get("wgCityId"), }       }).done( function (data) { var counter = document.createElement("div");

Object.assign(counter.style, {                   textAlign: "right",                    marginRight: "6px"                });

var counterValue = document.createElement("span"); counterValue.innerHTML = data.counter.value;

Object.assign(counterValue.style, {                   display: "block",                    lineHeight: 1                });

counter.appendChild(counterValue);

var counterLabel = document.createElement("span"); counterLabel.innerHTML = mw.message(data.counter.label.key).text;

Object.assign(counterLabel.style, {                   display: "block",                    fontSize: "10px",                    lineHeight: 1,                    marginTop: "3px",                    textTransform: "uppercase"                });

counter.appendChild(counterLabel);

document.querySelector(".wds-community-bar__discussions").before(counter) }       );    } );