This commit is contained in:
parent
6db0e4b92d
commit
3005967c32
|
@ -8,6 +8,11 @@ var mobileType = '',
|
|||
mobileType += checkW ? 'Windows Phones.' : '';
|
||||
return checkW;
|
||||
},
|
||||
Chrome: function() {
|
||||
var checkC = /Chrome/i.test(navigator.userAgent);
|
||||
// mobileType += checkC ? 'Android Phones.' : '';
|
||||
return checkC;
|
||||
},
|
||||
Android: function() {
|
||||
var checkA = /Android/i.test(navigator.userAgent);
|
||||
mobileType += checkA ? 'Android Phones.' : '';
|
||||
|
@ -26,13 +31,14 @@ var mobileType = '',
|
|||
any: function() {
|
||||
return ( isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Windows());
|
||||
}
|
||||
};
|
||||
},
|
||||
checkMOBS = isMobile.any();
|
||||
|
||||
// protect older / low end devices
|
||||
if (document.body.offsetWidth < 1200 || isMobile.any()) {
|
||||
if (document.body.offsetWidth < 1200 || checkMOBS) {
|
||||
var explain = '';
|
||||
explain += mobileType !== '' ? 'For safety reasons, this page does not work with ' + mobileType : '';
|
||||
explain += document.body.offsetWidth < 1200 && mobileType === '' ? 'For safety reasons this page does not work on your machine because it might be very old. In other cases the browser window size is not enough for the animation to work properly, so if that\'s the case, maximize the window, refresh and proceed with the tests.' : '';
|
||||
explain += checkMOBS && mobileType !== '' ? ('For safety reasons, this page does not work with ' + mobileType) : '';
|
||||
explain += !checkMOBS && document.body.offsetWidth < 1200 && mobileType === '' ? 'For safety reasons this page does not work on your machine because it might be very old. In other cases the browser window size is not enough for the animation to work properly, so if that\'s the case, maximize the window, refresh and proceed with the tests.' : '';
|
||||
var warning = '<div style="padding: 20px;">';
|
||||
warning +='<h1 class="text-danger">Warning!</h1>';
|
||||
warning +='<p class="lead text-danger">This web page is only for high-end desktop computers.</p>';
|
||||
|
@ -40,6 +46,7 @@ if (document.body.offsetWidth < 1200 || isMobile.any()) {
|
|||
warning +='<p class="text-info">'+explain+'</p>';
|
||||
warning +='</div>';
|
||||
document.body.innerHTML = warning;
|
||||
isMobile.Android() && alert(isMobile.Android());
|
||||
throw new Error('This page is only for high-end desktop computers. ' + explain);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue