5,798
edits
No edit summary |
No edit summary |
||
Line 675: | Line 675: | ||
function initWikiAppSidebar() { | function initWikiAppSidebar() { | ||
if (navigator.userAgent.indexOf('gonative melvorwiki') > -1) { | if (navigator.userAgent.indexOf('gonative melvorwiki') > -1) { | ||
const myFavs = { | |||
url: 'https://wiki.melvoridle.com/w/Special:Favoritelist', | |||
label: 'My Favourite Pages', | |||
subLinks: [], | |||
icon: 'fas fa-star' | |||
}; | |||
const items = [ | const items = [ | ||
{ | { | ||
Line 681: | Line 687: | ||
subLinks: [], | subLinks: [], | ||
icon: 'fas fa-house' | icon: 'fas fa-house' | ||
} | } | ||
{ | ]; | ||
if(isUserLoggedIn()) { | |||
items.push(myFavs); | |||
} | |||
items.push({ | |||
url: 'https://wiki.melvoridle.com/w/Special:Favoritelist', | url: 'https://wiki.melvoridle.com/w/Special:Favoritelist', | ||
label: 'My Favourite Pages', | label: 'My Favourite Pages', | ||
Line 821: | Line 831: | ||
] | ] | ||
} | } | ||
); | |||
median.sidebar.setItems({"items":items,"enabled":true, "persist":false}); | median.sidebar.setItems({"items":items,"enabled":true, "persist":false}); | ||
} | } | ||
} | |||
function isUserLoggedIn() { | |||
mw.loader.using('mediawiki.util').then(function () { | |||
if (mw.config.get('wgUserName') === null) { | |||
return false; | |||
} else { | |||
return true; | |||
} | |||
}); | |||
} | } | ||