Anonymous

MediaWiki:Common.js: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
Tag: Manual revert
No edit summary
Line 674: Line 674:


function initWikiAppSidebar() {
function initWikiAppSidebar() {
if (navigator.userAgent.indexOf('gonative melvorwiki') > -1) {
    if (navigator.userAgent.indexOf('gonative melvorwiki') > -1) {
const isLoggedIn = isUserLoggedIn();
        var isLoggedIn = isUserLoggedIn();
const myFavs = {
        var myFavs = {
    url: 'https://wiki.melvoridle.com/w/Special:Favoritelist',
            url: 'https://wiki.melvoridle.com/w/Special:Favoritelist',
    label: 'My Favourite Pages',
            label: 'My Favourite Pages',
    subLinks: [],
            subLinks: [],
    icon: 'fas fa-star'
            icon: 'fas fa-star'
};
        };
const signIn = {
        var signIn = {
    label: 'Sign In / Register',
            label: 'Sign In / Register',
    url: 'https://wiki.melvoridle.com/index.php?title=Special:UserLogin&returnto=Main+Page',
            url: 'https://wiki.melvoridle.com/index.php?title=Special:UserLogin&returnto=Main+Page',
    subLinks: []
            subLinks: []
};
        };
const accountManagement =  
        var accountManagement = {
  {
            label: 'Account Management',
    label: 'Account Management',
            url: '',
    url: '',
            isGrouping: true,
    isGrouping: true,
            subLinks: [
    subLinks: [
                { label: 'Preferences', url: 'https://wiki.melvoridle.com/w/Special:Preferences', subLinks: [] },
      {
                { label: 'Logout', url: 'https://wiki.melvoridle.com/index.php?title=Special:UserLogout&returnto=Main+Page', subLinks: [] }
        label: 'Preferences',
            ],
        url: 'https://wiki.melvoridle.com/w/Special:Preferences',
            icon: 'fas fa-user-gear'
        subLinks: []
        };
      },
        var items = [
      {
            { url: 'https://wiki.melvoridle.com/w/Main_Page', label: 'Home', subLinks: [], icon: 'fas fa-house' },
        label: 'Logout',
            isLoggedIn ? myFavs : signIn,
        url: 'https://wiki.melvoridle.com/index.php?title=Special:UserLogout&returnto=Main+Page',
            { label: 'Guides', url: 'https://wiki.melvoridle.com/w/Guides', icon: 'fas fa-book', subLinks: [] },
        subLinks: []
            { label: 'FAQ', url: 'https://wiki.melvoridle.com/w/FAQ', icon: 'fas fa-circle-question', subLinks: [] },
      }
            { label: 'Changelog', url: 'https://wiki.melvoridle.com/w/Changelog', icon: 'fas fa-book-open', subLinks: [] },
    ],
            { label: 'Mod Creation', url: 'https://wiki.melvoridle.com/w/Mod_Creation', icon: 'fas fa-hammer', subLinks: [] }
    icon: 'fas fa-user-gear'
        ];
  };
        if (isLoggedIn) {
const items = [
            items.push(accountManagement);
  {
        }
    url: 'https://wiki.melvoridle.com/w/Main_Page',
        items.push(...[
    label: 'Home',
            {
    subLinks: [],
                label: 'Special Tools',
    icon: 'fas fa-house'
                url: '',
  }
                isGrouping: true,
  ];
                subLinks: [
  if(isLoggedIn) {
                    { label: 'Upload Files', url: 'https://wiki.melvoridle.com/w/Special:Upload', subLinks: [], icon: 'fas fa-upload' },
  items.push(myFavs);
                    { label: 'Special Pages', url: 'https://wiki.melvoridle.com/w/Special:SpecialPages', subLinks: [], icon: 'fas fa-file-powerpoint' }
  } else {
                ],
  items.push(signIn);
                icon: 'fas fa-gear'
  }
            },
  items.push(
            {
  {
                label: 'Support Melvor Idle',
    label: 'Guides',
                url: '',
    url: 'https://wiki.melvoridle.com/w/Guides',
                isGrouping: true,
    icon: 'fas fa-book',
                subLinks: [
    subLinks: []
                    { label: 'Buy Melvor Idle', url: 'https://wiki.melvoridle.com/w/Full_Version', subLinks: [] },
  },
                    { label: 'Buy Throne of the Herald', url: 'https://wiki.melvoridle.com/w/Throne_of_the_Herald_Expansion', subLinks: [] },
  {
                    { label: 'Buy Atlas of Discovery', url: 'httpshttps://wiki.melvoridle.com/w/Atlas_of_Discovery_Expansion://', subLinks: [] },
    label: 'FAQ',
                    { label: 'Patreon', url: 'https://patreon.com/MelvorIdle', subLinks: [], icon: 'fab fa-patreon' }
    url: 'https://wiki.melvoridle.com/w/FAQ',
                ],
    icon: 'fas fa-circle-question',
                icon: null
    subLinks: []
            },
  },
            {
  {
                label: 'Melvor Idle Socials',
    label: 'Changelog',
                url: '',
    url: 'https://wiki.melvoridle.com/w/Changelog',
                isGrouping: true,
    icon: 'fas fa-book-open',
                subLinks: [
    subLinks: []
                    { label: 'Discord', url: 'https://discord.gg/melvoridle', subLinks: [], icon: 'fab fa-discord' },
  },
                    { label: 'Reddit', url: 'https://reddit.com/r/MelvorIdle', icon: 'custom icon-reddit-alien', subLinks: [] },
  {
                    { label: 'Twitter', url: 'https://twitter.com/melvoridle', icon: 'custom icon-twitter', subLinks: [] },
    label: 'Mod Creation',
                    { label: 'Facebook', url: 'https://facebook.com/melvoridle', icon: 'custom icon-facebook', subLinks: [] },
    url: 'https://wiki.melvoridle.com/w/Mod_Creation',
                    { label: 'Instagram', url: 'https://instagram.com/melvoridle', icon: 'custom icon-instagram', subLinks: [] }
    icon: 'fas fa-hammer',
                ]
    subLinks: []
            }
  });
        ]);
  if(isLoggedIn) {
        median.sidebar.setItems({ "items": items, "enabled": true, "persist": false });
  items.push(accountManagement);
    }
  }
  items.push({
    label: 'Special Tools',
    url: '',
    isGrouping: true,
    subLinks: [
      {
        label: 'Upload Files',
        url: 'https://wiki.melvoridle.com/w/Special:Upload',
        subLinks: [],
        icon: 'fas fa-upload'
      },
      {
        label: 'Special Pages',
        url: 'https://wiki.melvoridle.com/w/Special:SpecialPages',
        subLinks: [],
        icon: 'fas fa-file-powerpoint'
      }
    ],
    icon: 'fas fa-gear'
  },
  {
    label: 'Support Melvor Idle',
    url: '',
    isGrouping: true,
    subLinks: [
      {
        label: 'Buy Melvor Idle',
        url: 'https://wiki.melvoridle.com/w/Full_Version',
        subLinks: []
      },
      {
        label: 'Buy Throne of the Herald',
        url: 'https://wiki.melvoridle.com/w/Throne_of_the_Herald_Expansion',
        subLinks: []
      },
      {
        label: 'Buy Atlas of Discovery',
        url: 'httpshttps://wiki.melvoridle.com/w/Atlas_of_Discovery_Expansion://',
        subLinks: []
      },
      {
        label: 'Patreon',
        url: 'https://patreon.com/MelvorIdle',
        subLinks: [],
        icon: 'fab fa-patreon'
      }
    ],
    icon: null
  },
  {
    label: 'Melvor Idle Socials',
    url: '',
    isGrouping: true,
    subLinks: [
      {
        label: 'Discord',
        url: 'https://discord.gg/melvoridle',
        subLinks: [],
        icon: 'fab fa-discord'
      },
      {
        label: 'Reddit',
        url: 'https://reddit.com/r/MelvorIdle',
        icon: 'custom icon-reddit-alien',
        subLinks: []
      },
      {
        label: 'Twitter',
        url: 'https://twitter.com/melvoridle',
        icon: 'custom icon-twitter',
        subLinks: []
      },
      {
        label: 'Facebook',
        url: 'https://facebook.com/melvoridle',
        icon: 'custom icon-facebook',
        subLinks: []
      },
      {
        label: 'Instagram',
        url: 'https://instagram.com/melvoridle',
        icon: 'custom icon-instagram',
        subLinks: []
      }
    ]
  }
);
median.sidebar.setItems({"items":items,"enabled":true, "persist":false});
}
}
}


Line 847: Line 757:


function showIOSAppDownloadLink() {
function showIOSAppDownloadLink() {
const shouldShowDownload = window.navigator.userAgent.match(/iPhone|iPad|iPod/i) && !window.navigator.userAgent.includes('gonative melvorwiki');
    var shouldShowDownload = /iPhone|iPad|iPod/i.test(window.navigator.userAgent) && window.navigator.userAgent.indexOf('gonative melvorwiki') === -1;
     const els = document.getElementsByClassName('ios-app-download');
     var els = document.getElementsByClassName('ios-app-download');
for (let i = 0; i < els.length; i++) {
    for (var i = 0; i < els.length; i++) {
    if (shouldShowDownload) {
        if (shouldShowDownload) {
        els[i].style.display = 'block';
            els[i].style.display = 'block';
    } else {
        } else {
        els[i].style.display = 'none';
            els[i].style.display = 'none';
    }
        }
}
    }
}
}