Skip to content

Commit b17cf1b

Browse files
author
Nicholas Thomson
committed
Mobile detection
1 parent f6f67c4 commit b17cf1b

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed

app/index.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
</script>
4848
<!-- Add your site or application content here -->
4949

50-
<div id="splash" role="splash" ng-if="!isIE()">
50+
<div id="splash" role="splash" ng-if="!isIE && !isMobile">
5151
<a class='forkme' target='_blank' href='https://github.com/cloudspace/angular.crunchinator.com'>
5252
<img src='images/forkme_right_ribbon.png' alt='Fork me on GitHub' />
5353
</a>
@@ -62,15 +62,19 @@
6262
</div>
6363
</div>
6464

65-
<div id="main" role="main" ui-view="main" ng-if="!isIE()">
65+
<div id="main" role="main" ui-view="main" ng-if="!isIE && !isMobile">
6666
</div>
67-
<div class='no-ie' ng-if="isIE()">
67+
<div class='no-ie' ng-if="isIE">
6868
The Crunchinator does not currently support Internet Explorer due to poor Javascript performance. <br />
6969
Please check us out with
7070
<a href='https://www.google.com/intl/en/chrome/browser/'>Chrome</a>,
7171
<a href='http://www.mozilla.org/en-US/firefox/new/'>Firefox</a>,
7272
or <a href='https://www.apple.com/safari/'>Safari</a>.
7373
</div>
74+
<div class='no-ie' ng-if="isMobile">
75+
The Crunchinator is a desktop-only experience due to the processing required. <br />
76+
Please visit us on your desktop.
77+
</div>
7478
<div id="about" role="about" ui-view="about">
7579
</div>
7680

@@ -119,6 +123,7 @@
119123
<script src="scripts/services/fundingRound.js"></script>
120124
<script src="scripts/services/componentData.js"></script>
121125
<script src="scripts/services/bitly.js"></script>
126+
<script src="scripts/services/isMobile.js"></script>
122127

123128
<script src="scripts/controllers/crunchinator.js"></script>
124129
<script src="scripts/controllers/about.js"></script>

app/scripts/app.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ angular.module('crunchinatorApp', [
4141
.run(function run() {
4242
})
4343

44-
.controller('AppCtrl', function AppCtrl($scope, $location) {
45-
$scope.isIE = function() {
44+
.controller('AppCtrl', function AppCtrl($scope, $location, IsMobile) {
45+
$scope.isIE = (function() {
4646
var myNav = navigator.userAgent.toLowerCase();
4747
return (myNav.indexOf('msie') !== -1) ? parseInt(myNav.split('msie')[1]) : false;
48-
};
48+
})();
49+
50+
$scope.isMobile = IsMobile.any();
4951

5052
$scope.shared_results = !!$location.search().filters;
5153

@@ -55,7 +57,7 @@ angular.module('crunchinatorApp', [
5557
}
5658
});
5759

58-
if($scope.isIE()){
60+
if($scope.isIE || $scope.isMobile){
5961
angular.element('html, body').css({
6062
'overflow': 'visible'
6163
});

app/scripts/controllers/about.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
'use strict';
22

33
angular.module('crunchinatorApp.controllers')
4-
.controller('AboutCtrl', [
5-
'$scope',
6-
function AboutCtrl($scope) {
4+
.controller('AboutCtrl', [
5+
'$scope', 'IsMobile',
6+
function AboutCtrl($scope, IsMobile) {
77
var section = angular.element('#about');
88
var body = angular.element('body');
99

1010
$scope.showPage = 'about';
11+
$scope.isMobile = IsMobile.any();
1112

1213
$scope.navigate = function(page) {
1314
if (body.scrollTop() === section.offset().top) {

app/styles/main.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ header{
628628
color: @light-grey;
629629
text-align: left;
630630
padding: 70px 40px 70px 135px;
631-
margin: 10px 20px 10px 0px;
631+
margin: 10px 0 10px 0px;
632632
border: solid 1px @light-grey2;
633633
border-radius: 5px;
634634
box-sizing: border-box;

app/views/about.tpl.html

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
<div class='about-contain'>
2-
<div id="about-header" affix parent='#about'>
3-
<div class='forkme' >
2+
<div id="about-header" affix parent='#about'>
3+
<div class='forkme'>
44
<a target='_blank' href='https://github.com/cloudspace/angular.crunchinator.com'>
55
<img src='/images/forkme_right_ribbon.png' alt='Fork me on GitHub' />
66
</a>
77
</div>
88
<div class="header-text">
99
<h2><a href="http://cloudspace.com/" class="cloudspace-logo">cloudspace</a></h2>
1010
<nav>
11-
<ul>
12-
13-
</ul>
14-
1511
<ul class="nav nav-pills">
1612
<li ng-class="{active: showPage=='about'}"><a ng-click="navigate('about')" href="#about">About Us
1713
<li ng-class="{active: showPage=='faq'}"><a ng-click="navigate('faq')" href="#faq">F.A.Q</a></li></a></li>

0 commit comments

Comments
 (0)