MediaWiki:Common.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Restrict zooming out beyond the initial page size on mobile */ var initialScale = 1; var pinchStartDistance; document.addEventListener('gesturestart', function(e) { pinchStartDistance = getPinchDistance(e); }); document.addEventListener('gesturechange', function(e) { var pinchDistance = getPinchDistance(e); if (pinchDistance > pinchStartDistance) { /* Zoom in */ initialScale *= 1.1; } else if (pinchDistance < pinchStartDistance && initialScale > 1) { /* Zoom out */ initialScale /= 1.1; } updateViewport(); }); function getPinchDistance(e) { return Math.hypot(e.touches[0].clientX - e.touches[1].clientX, e.touches[0].clientY - e.touches[1].clientY); } function updateViewport() { var viewport = document.querySelector("meta[name=viewport]"); if (viewport) { viewport.content = "width=device-width, initial-scale=" + initialScale + ", maximum-scale=1, user-scalable=yes"; } }