Jump to content

MediaWiki:Mobile.js: Difference between revisions

From Bose Portable PA Knowledge
Created page with "All JavaScript here will be loaded for users of the mobile site: // Make the Minerva/logo area link to the Main Page on small screens mw.hook('wikipage.content').add(function () { if (window.innerWidth <= 800 && !document.querySelector('.minerva-logo-link')) { var logo = document.querySelector('.minerva-logo, .mw-logo, .minerva-header .site-title'); if (logo && !logo.closest('a')) { var a = document.createElement('a'); a.href = mw.util.getUrl('..."
 
m removed all menu hacks and test again
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the mobile site */
/* Make the Minerva/logo area link to the Main Page on small screens */
// Make the Minerva/logo area link to the Main Page on small screens
mw.hook('wikipage.content').add(function () {
mw.hook('wikipage.content').add(function () {
   if (window.innerWidth <= 800 && !document.querySelector('.minerva-logo-link')) {
   if (window.innerWidth <= 800 && !document.querySelector('.minerva-logo-link')) {

Latest revision as of 22:59, 31 March 2026

/* Make the Minerva/logo area link to the Main Page on small screens */
mw.hook('wikipage.content').add(function () {
  if (window.innerWidth <= 800 && !document.querySelector('.minerva-logo-link')) {
    var logo = document.querySelector('.minerva-logo, .mw-logo, .minerva-header .site-title');
    if (logo && !logo.closest('a')) {
      var a = document.createElement('a');
      a.href = mw.util.getUrl('Main_Page');
      a.className = 'minerva-logo-link';
      a.setAttribute('aria-label', 'Home');
      logo.parentNode.insertBefore(a, logo);
      a.appendChild(logo);
    }
  }
});