浏览代码

User agent sniffing

Gaël Métais 10 年之前
父节点
当前提交
49f93e660e
共有 2 个文件被更改,包括 2 次插入1 次删除
  1. 1 0
      front/src/js/app.js
  2. 1 1
      front/src/views/index.html

+ 1 - 0
front/src/js/app.js

@@ -19,6 +19,7 @@ var yltApp = angular.module('YellowLabTools', [
 ]);
 
 yltApp.run(['$rootScope', '$location', function($rootScope, $location) {
+    $rootScope.isTouchDevice = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent);
     $rootScope.loadedRunId = null;
 
     // Google Analytics

+ 1 - 1
front/src/views/index.html

@@ -2,7 +2,7 @@
 <p class="price">Free and open source!</p>
 
 <form ng-submit="launchTest()" >
-    <input type="url" name="url" ng-model="url" placeholder="http://www.mysite.com" class="url" />
+    <input type="{{$root.isTouchDevice? 'url' : 'text'}}" name="url" ng-model="url" placeholder="http://www.mysite.com" class="url" />
     <input type="submit" value="Launch test" class="launchBtn" ng-class="{disabled: !url}" />
     <div class="settings">
         <div class="device">