Jump to content

MediaWiki:Common.js: Difference between revisions

From Starship Simulator
Adding StarSim links to the footer
 
Try to move starsim links to the left nav
 
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */


/* Add StarSim socials links to the wiki footer */
/* Add StarSim socials links to the wiki sidebar */
const starsimLinks = [
const starsimLinks = [
     {text: 'Website', url: 'https://starshipsimulator.co.uk/', id: 'starsim-link-website'},
     {text: 'Website', url: 'https://starshipsimulator.co.uk/', id: 'starsim-link-website'},
     {text: 'Steam', url: 'https://store.steampowered.com/app/1332100/Starship_Simulator/', id: 'starsim-link-steam'},
     {text: 'Steam', url: 'https://store.steampowered.com/app/1332100/Starship_Simulator/', id: 'starsim-link-steam'},
    {text: 'Discord', url: 'https://discord.gg/starshipsimulator', id: 'starsim-link-discord'},
     {text: 'Ko-fi', url: 'https://ko-fi.com/starshipsimulator', id: 'starsim-link-kofi'},
     {text: 'Ko-fi', url: 'https://ko-fi.com/starshipsimulator', id: 'starsim-link-kofi'},
     {text: 'Kickstarter', url: 'https://www.kickstarter.com/projects/fleetyard/starship-simulator', id: 'starsim-link-kickstarter'},
     {text: 'Kickstarter', url: 'https://www.kickstarter.com/projects/fleetyard/starship-simulator', id: 'starsim-link-kickstarter'},
     {text: 'YouTube', url: 'https://www.youtube.com/@StarshipSimulator', id: 'starsim-link-youtube'},
     {text: 'YouTube', url: 'https://www.youtube.com/@StarshipSimulator', id: 'starsim-link-youtube'},
     {text: 'X (Twitter)', url: 'https://x.com/Starship_sim', id: 'starsim-link-twitter'},
     {text: 'X (Twitter)', url: 'https://x.com/Starship_sim', id: 'starsim-link-twitter'},
    {text: 'Discord', url: 'https://discord.gg/starshipsimulator', id: 'starsim-link-discord'},
    {text: 'Join Discord', url: 'https://discord.com/invite/eDSQvpgdUX', id: 'starsim-link-joindiscord'},
     {text: 'Facebook', url: 'https://www.facebook.com/Starshipgame', id: 'starsim-link-facebook'},
     {text: 'Facebook', url: 'https://www.facebook.com/Starshipgame', id: 'starsim-link-facebook'},
];
];


const $starsimFooter = jQuery('<ul id="footer-starsim-links"></ul>');
const starsimLinksPortletId = 'p-starsim-links';
const starsimLinksPortlet = mw.util.addPortlet(starsimLinksPortletId, 'Links', '#p-tb');
 
starsimLinks.forEach(linkObj => {
starsimLinks.forEach(linkObj => {
     const anchor = document.createElement('a');
     mw.util.addPortletLink(starsimLinksPortletId, linkObj.url, linkObj.text, linkObj.id);
    anchor.setAttribute('rel', 'nofollow');
    anchor.setAttribute('class', 'external');
    anchor.setAttribute('href', linkObj.url);
    anchor.textContent = linkObj.text;
   
    const li = document.createElement('li');
    li.setAttribute('id', linkObj.id);
    li.appendChild(anchor);
 
    $starsimFooter.append(li);
});
});
$starsimFooter.insertBefore(jQuery('#footer-places'));

Latest revision as of 19:12, 27 April 2025

/* Any JavaScript here will be loaded for all users on every page load. */

/* Add StarSim socials links to the wiki sidebar */
const starsimLinks = [
    {text: 'Website', url: 'https://starshipsimulator.co.uk/', id: 'starsim-link-website'},
    {text: 'Steam', url: 'https://store.steampowered.com/app/1332100/Starship_Simulator/', id: 'starsim-link-steam'},
    {text: 'Discord', url: 'https://discord.gg/starshipsimulator', id: 'starsim-link-discord'},
    {text: 'Ko-fi', url: 'https://ko-fi.com/starshipsimulator', id: 'starsim-link-kofi'},
    {text: 'Kickstarter', url: 'https://www.kickstarter.com/projects/fleetyard/starship-simulator', id: 'starsim-link-kickstarter'},
    {text: 'YouTube', url: 'https://www.youtube.com/@StarshipSimulator', id: 'starsim-link-youtube'},
    {text: 'X (Twitter)', url: 'https://x.com/Starship_sim', id: 'starsim-link-twitter'},
    {text: 'Facebook', url: 'https://www.facebook.com/Starshipgame', id: 'starsim-link-facebook'},
];

const starsimLinksPortletId = 'p-starsim-links';
const starsimLinksPortlet = mw.util.addPortlet(starsimLinksPortletId, 'Links', '#p-tb');

starsimLinks.forEach(linkObj => {
    mw.util.addPortletLink(starsimLinksPortletId, linkObj.url, linkObj.text, linkObj.id);
});