MediaWiki:Common.js: Difference between revisions

Mr Pie 5 (talk | contribs)
Ugh, can't use for-of in es5
Mr Pie 5 (talk | contribs)
Enhanced footer
Line 42: Line 42:
$buttons.appendTo(this);
$buttons.appendTo(this);
});
});
// Creates the enhanced footer
var $footer = $("<div>").attr("id", "footer__content");
$("footer#footer").html("").append($footer);
var footerLinks = [
    {
        header: "Overview",
        links: [
            // [text, link]
            ["What is Gemini Station?", ""],
            ["Contribute", ""],
            ["Press", ""],
            ["Contact", ""],
            ["Terms of Use", ""],
            ["Privacy Policy", "/Project:Privacy_policy"], // [[/Project:Privacy_policy]]
        ]
    },
    {
        header: "Wiki",
        links: [
            ["Ships", "/Ships"], // [[Ships]]
            ["Mods", "/Mods"], // [[Mods]]
            ["Items", "/Items"], // [[Items]]
            ["Facilities", "/Facilities"], // [[Facilities]]
            ["Drones", "/Overview"], // [[Overview]]
            ["Missions", "/Missions"], // [[Missions]]
            ["Stories", "/Stories"], // [[Stories]]
            ["Characters", "/Characters"] // [[Characters]]
        ]
    },
    {
        header: "Community",
        links: [
            ["Game", ""],
            ["Forum", ""],
            ["Discord", ""],
            ["Reddit", ""]
        ]
    },
];
footerLinks.forEach(function(group){
    var $ul = $("<ul>");
    for(var i = 0; i < group.links.length; i++){
        var link = group.links[i];
        $("<li>").append(
            $("<a>").text(link[0]).attr("href", link[1])
        ).appendTo($ul);
    }
    $("<div>").addClass("footer-group").append(
        $("<h2>").text(group.header)
    ).append($ul).appendTo($footer);
});
$("#footer .footer-group:first-child").prepend(
    $("<a>").attr("id", "footer__logo").attr("href", "https://geministation.com/").append(
        $("<img>").attr("src", "https://wiki.geministation.com/images/0/06/Gemini_Station_Logo.png")
    )
);
});
});