MediaWiki:Common.js: Forskelle mellem versioner
Fra AarhusWiki
mNo edit summary |
mNo edit summary Tag: Tilbagerullet |
||
Linje 54: | Linje 54: | ||
} | } | ||
}); | }); | ||
// Function to adjust map container width on mobile devices | |||
function adjustMapContainerWidth() { | |||
var mapContainer = document.querySelector('.tright > div'); | |||
if (mapContainer) { | |||
var screenWidth = window.innerWidth; | |||
var maxWidth = (screenWidth <= 768) ? 350 : 600; // Adjust widths for mobile and iPad screens | |||
mapContainer.style.maxWidth = maxWidth + 'px'; | |||
} | |||
} | |||
// Call the function on page load and when the screen is resized | |||
document.addEventListener('DOMContentLoaded', adjustMapContainerWidth); | |||
window.addEventListener('resize', adjustMapContainerWidth); |
Versionen fra 2. aug. 2023, 10:29
/* Javascript inkluderet her vil være aktivt for alle brugere. */ // Adds a default template to new pages $(function() { if (mw.config.get('wgAction') !== 'edit' || mw.config.get('wgNamespaceNumber') !== 0 || mw.config.get('wgArticleId') !== 0) { return; } var template = "\n\n== Litteratur og kilder ==\n* \n\n[[Kategori:]]"; var content = $('#wpTextbox1').val(); if (!content) { $('#wpTextbox1').val(template); } else if (content.indexOf('== Litteratur og kilder ==') === -1) { $('#wpTextbox1').val(content + '\n\n' + template); } }); $(document).ready(function() { $('head').append('<script defer data-domain="aarhuswiki.dk" src="https://plausible.io/js/plausible.js"></script>'); // Shorten text to keep background $('#p-banner').text('Aarhuswiki'); $('#searchInput').on('focus', function() { $('body .suggestions').prependTo('#container'); }); /* if (window.location.href.indexOf("Louise_Lindskrog_(1992-)") > 0) { document.getElementById("ca-history").style.display = "none"; } */ /* Erstat link til Mediawiki, med link til vores hjemmeside */ $('#f-poweredbyico a').attr('href', 'http://www.aarhusstadsarkiv.dk'); $("#mw-site-navigation").prepend( '<div id="site-themes" class="sidebar-chunk"><div role="navigation" class="mw-portlet" id="p-tbt" aria-labelledby="p-tbt-label"><div class="mw-portlet-body"><img style="width:100%;" alt="Aarhus Stadsarkiv" src="/mediawiki/images/2/29/As_logo.png"/></div></div></div>' ); $("#mw-site-navigation").append( '<div id="site-themes" class="sidebar-chunk"><div role="navigation" class="mw-portlet" id="p-tbt" aria-labelledby="p-tbt-label"><h3 id="p-tbt-label" dir="ltr" lang="da" style="padding-bottom:0;margin-bottom:0;">Særlige temaer</h3><br><div class="mw-portlet-body"><a class="image" href="https://aarhuswiki.dk/wiki/Kongelunden"><img style="width:100%;margin-bottom:.7em;" alt="Kongelunden" src="/mediawiki/images/7/73/Kongelunden_logo_groen_01_150px.jpg"/></a><br><hr><p><div class="mw-portlet-body"><a class="image" href="https://aarhuswiki.dk/wiki/Broer_over_Aarhus_%C3%85_(oversigtskort)"><img style="width:100%;margin-bottom:.7em;" alt="Broerne over Aarhus Aa" src="/mediawiki/images/1/1e/Broerne_over_Aarhus_Aa.jpg"/></a></div></div></div></div>' ); /* Add link to accessability-declaration in footer */ $("#f-list").append( '<li id="accessability-declaration"><a class="noprint stopMobileRedirectToggle" href="https://www.was.digst.dk/aarhuswiki-dk">Webtilgængelighedserklæring</a></li>' ); }); $(function() { var navPanel = $('#p-navigation ul'); if (navPanel.length > 0) { var linkUrl = 'https://aarhuswiki.dk/wiki/Speciel:Tilf%C3%A6ldig_side'; var linkText = 'Tilfældig side'; navPanel.append('<li><a href="' + linkUrl + '">' + linkText + '</a></li>'); } }); // Function to adjust map container width on mobile devices function adjustMapContainerWidth() { var mapContainer = document.querySelector('.tright > div'); if (mapContainer) { var screenWidth = window.innerWidth; var maxWidth = (screenWidth <= 768) ? 350 : 600; // Adjust widths for mobile and iPad screens mapContainer.style.maxWidth = maxWidth + 'px'; } } // Call the function on page load and when the screen is resized document.addEventListener('DOMContentLoaded', adjustMapContainerWidth); window.addEventListener('resize', adjustMapContainerWidth);