|
// Находим и записываем координаты обекта |
|
55.002707° 82.975013° |
|
|
|
// addition js |
|
<script> |
|
if(navigator.vendor != null && navigator.vendor.match(/Apple Computer, Inc./) && navigator.userAgent.match(/iPhone/i) || (navigator.userAgent.match(/iPod/i))) |
|
{ |
|
document.querySelector('.geo').style.display = 'none'; |
|
} |
|
else if (navigator.vendor != null && navigator.vendor.match(/Apple Computer, Inc./) && navigator.userAgent.match(/iPad/i)) |
|
{ |
|
document.querySelector('.geo').style.display = 'none'; |
|
} |
|
else if (navigator.vendor != null && navigator.vendor.match(/Apple Computer, Inc./) && navigator.userAgent.indexOf('Safari') != -1) |
|
{ |
|
document.querySelector('.geo').style.display = 'none'; |
|
} |
|
else if (navigator.vendor == null || navigator.vendor != null) |
|
{ |
|
document.querySelector('.igeo').style.display = 'none'; |
|
} |
|
</script> |
|
|
|
//optimized js |
|
document.addEventListener('DOMContentLoaded', function () { |
|
const vendorMatch = navigator.vendor && navigator.vendor.match(/Apple Computer, Inc./); |
|
const userAgentMatch = navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.indexOf('Safari') != -1; |
|
if (vendorMatch && userAgentMatch) { |
|
document.querySelector('.geo').style.display = 'none'; |
|
} else if (navigator.vendor == null || navigator.vendor != null) { |
|
document.querySelector('.igeo').style.display = 'none'; |
|
} |
|
}); |
|
|
|
//new version js |
|
document.addEventListener('DOMContentLoaded', function () { |
|
const vendorMatch = navigator.vendor && navigator.vendor.match(/Apple Computer, Inc./); |
|
const safariMatch = navigator.userAgent.match(/Safari/i) && parseInt(navigator.userAgent.match(/Version\/[\d.]+/)![0]) >= 10 && parseFloat(navigator.userAgent.match(/OS X/i)[0].substr(0, parseFloat(navigator.userAgent.match(/OS X/i)[0].substr(0, parseFloat(navigator.userAgent.match(/OS X/i)[0].match(/OS X/i)[0].substr(0, 2))-1))) >= 10; |
|
const iphoneMatch = navigator.userAgent.match(/iPhone/i) && parseInt(navigator.userAgent.match(/CPU like Mac OS X/i)[0].match(/CPU like Mac OS X/i)[1].substr(0, 2)) > 1 && parseInt(navigator.userAgent.match(/OS X/i)[0].substr(0, parseFloat(navigator.userAgent.match(/OS X/i)[0].match(/OS X/i)[0].substr(0, parseFloat(navigator.userAgent.match(/OS X/i)[0].substr(0, parseFloat(navigator.userAgent.match(/OS X/i)[0].substr(0, parseFloat(navigator.userAgent.match(/OS X/i)[0].substr(0, parseFloat(navigator.userAgent.match(/OS X/i)[0].substr(0, 2))-1)))-1))-1)) >= 8; |
|
if (vendorMatch && (safariMatch || iphoneMatch)) { |
|
document.querySelector('.geo').style.display = 'none'; |
|
} else if (navigator.vendor == null || navigator.vendor != null) { |
|
document.querySelector('.igeo').style.display = 'none'; |
|
} |
|
}); |
|
|
|
//add desktop as cgeo class |
|
document.addEventListener('DOMContentLoaded', function () { |
|
const vendorMatch = navigator.vendor && navigator.vendor.match(/Apple Computer, Inc./); |
|
const safariMatch = navigator.userAgent.match(/Safari/i) && parseFloat(navigator.userAgent.match(/Version\/[\d.]+/)![0].substr(7)) >= 10 && parseFloat(navigator.userAgent.match(/OS X/i)[0].substr(4)) >= 10; |
|
const iphoneMatch = navigator.userAgent.match(/iPhone/i) && parseInt(navigator.userAgent.match(/CPU like Mac OS X/i)[0].substr(11)) > 1 && parseFloat(navigator.userAgent.match(/CPU like Mac OS X/i)[0].substr(22)) >= 8; |
|
const desktopMatch = window.matchMedia('(min-width: 960px)').matches; |
|
if (vendorMatch && (safariMatch || iphoneMatch)) { |
|
if (desktopMatch) { |
|
document.querySelector('.geo').style.display = 'none'; |
|
document.querySelector('.cgeo').style.display = 'block'; |
|
} |
|
} else if (navigator.vendor == null || navigator.vendor != null) { |
|
if (desktopMatch) { |
|
document.querySelector('.igeo').style.display = 'none'; |
|
document.querySelector('.cgeo').style.display = 'block'; |
|
} |
|
} |
|
}); |
|
|
|
// addition html code |
|
<a href="geo:55.0560,82.9643" class="uk-icon-link uk-text-primary geo" uk-icon="location" onClick="ym(xxxxxxxx, 'reachGoal', 'LOCATION');"></a> |
|
<a href="https://maps.apple.com/maps?q=55.0560,82.9643" class="uk-icon-link uk-text-primary igeo" uk-icon="location" onClick="ym(xxxxxxxx, 'reachGoal', 'LOCATION');"></a> |
add optimized js