Skip to content

Commit da9765e

Browse files
committed
removed age/gender from emo demo, hid webcam link from Safari and mobile
1 parent d84d07d commit da9765e

File tree

6 files changed

+39
-16
lines changed

6 files changed

+39
-16
lines changed

php-demo/detect/js/detectDemoApp.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ detectDemoApp = {
2828
// options
2929
this.minHeadScale = 0.015;
3030
this.confidenceThreshold = .98;
31-
// detect getUserMedia compatibility
32-
// hide webcam link if not supported
33-
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
34-
if (!navigator.getUserMedia) {
35-
$(".webcam").hide();
36-
$(".ui-buttons .upload").addClass("full-width");
37-
}
3831
var fileTypeList = [];
3932
$(this.config.uploadFileTypesImage).each(function(idx, fileType) {
4033
fileTypeList.push(" ." + fileType.toString().split("/")[1])

php-demo/detect/js/detectUi.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ else {
2222
$(".options-panel").hide();
2323
}
2424

25+
// hide webcam link if Safari or mobile
26+
var hideWebcam = function() {
27+
if (utils.isSafari() || $(window).width() < 768) {
28+
$(".webcam").hide();
29+
$(".ui-buttons .upload").addClass("full-width");
30+
} else {
31+
$(".webcam").show();
32+
$(".ui-buttons .upload").removeClass("full-width");
33+
}
34+
}
35+
hideWebcam();
36+
$( window ).resize(function() {
37+
hideWebcam();
38+
});
39+
2540
// show JSON container by default at larger resolutions
2641
if ($(window).width() > 768) {
2742
$(".json-response-container").show();

php-demo/emotion/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@
136136
<div class="message-container strong">{{message1}}</div>
137137
<div class="message-container">{{message2}}</div>
138138
</div>
139-
<div class="response-box-container">
139+
<!-- <div class="response-box-container">
140140
{{#if gender}}
141141
<div class="response-box-gender"></div>
142142
{{/if}}
143143
{{#if age}}
144144
<div class="response-box-age"></div>
145145
{{/if}}
146-
</div>
146+
</div> -->
147147
</script>
148148
<script id="json-template" type="text/x-handlebars-template">
149149
<div class="spinner-message-container">

php-demo/emotion/js/emoDemoApp.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ emoDemoApp = {
3232
}
3333
this.captureInterval = 10000;
3434
$("#optionPollTimeout").val(this.config.pollTimeout);
35-
// detect getUserMedia compatibility
36-
// hide webcam link if not supported
37-
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
38-
if (!navigator.getUserMedia) {
39-
$(".webcam").hide();
40-
$(".ui-buttons .upload").addClass("full-width");
41-
}
4235
// hide webcam link from Windows platform until supported
4336
if (navigator.platform.indexOf('Win') > -1) {
4437
$(".webcam").hide();

php-demo/emotion/js/emotionUi.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ else {
2323
$(".options-panel").hide();
2424
}
2525

26+
// hide webcam link if Safari or mobile
27+
var hideWebcam = function() {
28+
if (utils.isSafari() || $(window).width() < 768) {
29+
$(".webcam").hide();
30+
$(".ui-buttons .upload").addClass("full-width");
31+
} else {
32+
$(".webcam").show();
33+
$(".ui-buttons .upload").removeClass("full-width");
34+
}
35+
}
36+
hideWebcam();
37+
$( window ).resize(function() {
38+
hideWebcam();
39+
});
40+
2641
$(".video-thumbnail img").eq(0).css("opacity","1");
2742

2843
// show/hide Highcharts tooltip

php-demo/js/utils.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,13 @@ utils = {
339339
return false;
340340
}
341341
return true;
342+
},
343+
isSafari: function(){
344+
is_safari = false;
345+
if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
346+
is_safari = true;
347+
}
348+
return is_safari;
342349
}
343350

344351
}

0 commit comments

Comments
 (0)