MediaWiki:Common.js: Difference between revisions
fixed the mobile redirect so it actually sticks now Tag: Reverted |
gave the mobile menu some actual links |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
$(document).ready(function() { | $(document).ready(function() { | ||
$('#ca-nstab-main a').text('Article'); | $('#ca-nstab-main a').text('Article'); | ||
| Line 35: | Line 4: | ||
$('#ca-view a').text('Read'); | $('#ca-view a').text('Read'); | ||
}); | }); | ||
// ========================================================================== | |||
// Minerva (mobile skin) main menu only ships Home/Random by default; it does | |||
// not pull in MediaWiki:Sidebar the way Vector's portlets do. This injects | |||
// the same section links (kept in sync with MediaWiki:Sidebar by hand) into | |||
// the native menu markup so mobile visitors actually get real navigation | |||
// instead of just Home/Random/Settings/About/Disclaimers. | |||
(function () { | |||
function initMinervaNav() { | |||
try { | |||
if (!document.body || !document.body.classList.contains('skin-minerva')) return; | |||
var nav = document.getElementById('p-navigation'); | |||
if (!nav || document.getElementById('wov-minerva-extra-nav')) return; | |||
var sections = [ | |||
{ heading: 'Guides', items: [ | |||
['Getting started', '/w/Getting_Started'], | |||
['Interactive Map (Fullscreen)', 'https://jxlife.github.io/WindsOfValenMap/'], | |||
['All skills', '/w/Skills'], | |||
['All quests', '/w/Quests'], | |||
['Combat guide', '/w/Combat'] | |||
]}, | |||
{ heading: 'Database', items: [ | |||
['Item database', '/w/Items'], | |||
['NPC database', '/w/NPCs'], | |||
['Set bonuses', '/w/Set_bonuses'] | |||
]}, | |||
{ heading: 'Skills', items: [ | |||
['Skill Calculator', '/w/Calculators'], | |||
['Mining', '/w/Mining'], | |||
['Smithing', '/w/Smithing'], | |||
['Fishing', '/w/Fishing'], | |||
['Potion Making', '/w/Potion_Making'] | |||
]}, | |||
{ heading: 'Tools', items: [ | |||
['About this wiki', '/w/Project:About'], | |||
['Random page', '/w/Special:Random'], | |||
['New files', '/w/Special:NewFiles'], | |||
['Wanted pages', '/w/Special:WantedPages'], | |||
['Wiki statistics', '/w/Special:Statistics'] | |||
]}, | |||
{ heading: 'Updates', items: [ | |||
['Recent changes', '/w/Special:RecentChanges'] | |||
]} | |||
]; | |||
var container = document.createElement('div'); | |||
container.id = 'wov-minerva-extra-nav'; | |||
sections.forEach(function (section) { | |||
var heading = document.createElement('div'); | |||
heading.className = 'wov-minerva-nav-heading'; | |||
heading.textContent = section.heading; | |||
container.appendChild(heading); | |||
var ul = document.createElement('ul'); | |||
ul.className = 'toggle-list__list'; | |||
section.items.forEach(function (item) { | |||
var li = document.createElement('li'); | |||
li.className = 'toggle-list-item'; | |||
var a = document.createElement('a'); | |||
a.className = 'toggle-list-item__anchor'; | |||
a.href = item[1]; | |||
var label = document.createElement('span'); | |||
label.className = 'toggle-list-item__label'; | |||
label.textContent = item[0]; | |||
a.appendChild(label); | |||
li.appendChild(a); | |||
ul.appendChild(li); | |||
}); | |||
container.appendChild(ul); | |||
}); | |||
nav.parentNode.insertBefore(container, nav.nextSibling); | |||
} catch (e) {} | |||
} | |||
if (document.body) { | |||
initMinervaNav(); | |||
} else { | |||
document.addEventListener('DOMContentLoaded', initMinervaNav); | |||
} | |||
})(); | |||
// ========================================================================== | // ========================================================================== | ||
// Valen Ledger — Gathering & Combat XP Calculator | // Valen Ledger — Gathering & Combat XP Calculator | ||