Convert Google Maps links to Apple Maps on iOS

// Change Google Maps links to Apple Maps on iOS
var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
if( !! iOS ) {
var links = document.body.querySelectorAll('.map-link');
links.forEach( function(e) {
var url = e.getAttribute('href').replace('google', 'apple');
e.setAttribute('href', url );
});
}
view raw global.js hosted with ❤ by GitHub

javascript