diff --git a/application/controllers/home.php b/application/controllers/home.php
index 1099a460..684d437b 100755
--- a/application/controllers/home.php
+++ b/application/controllers/home.php
@@ -5,6 +5,7 @@ class Home extends MY_Controller
function __construct()
{
parent::__construct();
+ $this->load->model('measure');
}
function index()
@@ -17,9 +18,29 @@ function index()
}
$this->load->view('header', $this->_headerData);
- $this->load->view('home');
+ $this->load->view('home', $this->homeMessage());
$this->load->view('footer');
}
+
+ private function homeMessage(){
+
+ $rand = rand ( 0 , 3 );
+
+ $watchBrands = array('Seiko', 'Rolex', 'Omega');
+ $videos = array('Omega.mp4', 'Rolex.mp4', 'Zenith.mp4');
+
+ $video = vid_url('Zenith.mp4');
+
+ if($rand >= 0 && $rand <= 2){
+ return array('title'=>$this->measure
+ ->getMeasuresCountByWatchBrand($watchBrands[$rand]) .
+ ' ' . $watchBrands[$rand] . ' measured on Toolwatch.io',
+ 'video_url'=>vid_url($videos[$rand]));
+ }else{
+ return array('title'=>$this->measure->getMeasuresWeeklyAverageAccuracy() .
+ ' spd average accuracy measured this week', 'video_url'=>$video);
+ }
+ }
function logout()
{
diff --git a/application/models/measure.php b/application/models/measure.php
index 018190dc..80ea5b3e 100755
--- a/application/models/measure.php
+++ b/application/models/measure.php
@@ -125,4 +125,29 @@ function deleteMesure($measureId){
return $this->update($measureId, $data) !== false;
}
+ function getMeasuresCountByWatchBrand($watchBrand){
+ return $this->select("count(1) as cnt")
+ ->join("watch", "watch.watchId = measure.watchId")
+ ->find_by("UPPER(brand)", strtoupper($watchBrand))
+ ->cnt;
+ }
+
+ function getMeasuresWeeklyAverageAccuracy(){
+
+ $totalAccuracy = 0;
+
+ $measures = $this->select()
+ ->where('statusId', 2)
+ ->where('accuracyReferenceTime >=', microtime() - 604800000)
+ ->find_all();
+
+ foreach ($measures as $measure) {
+ $totalAccuracy = $totalAccuracy +
+ $this->computeAccuracy($measure);
+ }
+
+ return sprintf("%.2f", $totalAccuracy / sizeof($measures));
+
+ }
+
}
\ No newline at end of file
diff --git a/application/views/home.php b/application/views/home.php
index 2f108529..af21aaa0 100755
--- a/application/views/home.php
+++ b/application/views/home.php
@@ -1,6 +1,7 @@
-
+
+
agent->is_mobile()){ ?>
@@ -29,13 +30,6 @@
-
@@ -44,7 +38,7 @@
-
+
agent->is_mobile()){ ?>
@@ -100,11 +94,11 @@
agent->is_mobile()){ ?>
-
+
-
XXX Followers on Instagram.
+
The most convenient way to measure
the accuracy of your mechanical watch.
diff --git a/assets/css/main.css b/assets/css/main.css
index 91f1675e..936ef765 100755
--- a/assets/css/main.css
+++ b/assets/css/main.css
@@ -785,7 +785,8 @@ button[name=syncDone],
box-shadow: 0 1px 4px #DDDDDD, 0 1px 0 #929292 inset;
}
-.mejs-container .mejs-controls { visibility:hidden !important; }
+.mejs-container .mejs-controls{ visibility:hidden !important; }
+
.slogan-home h1{
color: #FFFFFF;
@@ -911,4 +912,9 @@ footer .links{
#demo-fourth-step{
margin-top: 50px;
+ }
+
+ video{
+ background-color: black;
+ opacity: 0.7;
}
\ No newline at end of file
diff --git a/assets/js/application.js b/assets/js/application.js
index 5ab2cda0..7e254cfc 100755
--- a/assets/js/application.js
+++ b/assets/js/application.js
@@ -11,25 +11,6 @@ $(document).ready(function()
resizeContent();
});
- setInterval("changeBackground()", 7000);
-
-
- $(window).scroll(function()
- {
- if(window.location.pathname == "/")
- {
- if( $(window).scrollTop() >= '70')
- {
- $('header').addClass('blue');
- }
- else
- {
- $('header').removeClass('blue');
- }
- }
-
- });
-
/*
* Modal Update
*/
diff --git a/assets/js/home.logic.js b/assets/js/home.logic.js
index 63330ec0..d982ff80 100755
--- a/assets/js/home.logic.js
+++ b/assets/js/home.logic.js
@@ -2,22 +2,76 @@
var delta = Math.floor((Math.random() * 10) + 1) - 5;
var d;
+var activeIndex = 0;
+var possibleIndex = ["home-video", "demo-screen", "mosa-screen"];
+var animationUnderWay = false;
+var timeouts = [];
+
$( window ).resize(function() {
initSize();
});
+
+
$( document ).ready(function() {
+
+ var mousewheelevt = (/Firefox/i.test(navigator.userAgent)) ? "DOMMouseScroll" : "mousewheel" //FF doesn't recognize mousewheel as of FF3.x
+ $(window).bind(mousewheelevt, function(e){
+
+ if(!animationUnderWay){
+ for (var i=0; i
0) {
+ activeIndex = activeIndex -1;
+ } else {
+ activeIndex = activeIndex +1;
+ }
+
+ if(activeIndex!==0){
+ $('header').addClass('blue');
+ }else{
+ $('header').removeClass('blue');
+ }
+
+ if(activeIndex === 1){
+ timeouts.push(setTimeout(countDownDisplay, 1000));
+ }
+
+ $('html, body').animate({
+ scrollTop: $("#"+possibleIndex[activeIndex]).offset().top - 70
+ }, 2000, function() {
+ animationUnderWay = false;
+ });
+ }else{
+ e.preventDefault();
+ }
+
+ });
+
$("#demo-third-step").hide();
$("#demo-fourth-step").hide();
initSize();
- $('video,audio').mediaelementplayer({features: []});
-
- $(".continue").click(function(){
- setTimeout(countDownDisplay, 1000);
+ $('video,audio').mediaelementplayer({
+ enableAutosize: true,
+ features: []
});
$( "#demo-cta" ).click(function() {
@@ -27,16 +81,20 @@ $( document ).ready(function() {
$("#demo-pointer").hide();
$("#demo-third-step").hide();
$("#demo-fourth-step").fadeToggle();
- console.log();
$(".watch-accuracy").html(result.toFixed(0));
});
});
+function initCounDown(){
+
+}
+
function initSize(){
- var windowHeight = $(window).height();
+ var windowHeight = $(window).height();
+
var headerHeight = $('header').height();
var sloganHeight = $(".slogan-home");
var windowRealHeight = windowHeight - headerHeight;
@@ -63,7 +121,7 @@ function countDownDisplay(){
$("#demo-sync-time").html(countdown - 1);
if(countdown > 1){
- setTimeout(countDownDisplay, 1000);
+ timeouts.push(setTimeout(countDownDisplay, 1000));
}else{
d = new Date(new Date().getTime());
similateInput();
@@ -115,7 +173,7 @@ function writeToInput(text, i){
if(i < text.length){
$("#inputUserTime").val($("#inputUserTime").val() + text.charAt(i));
i = i +1;
- setTimeout(writeToInput, Math.round(Math.random() * (300 - 100) + 100), text, i);
+ timeouts.push(setTimeout(writeToInput, Math.round(Math.random() * (300 - 100) + 100), text, i));
}else{
clickCTA();
}
diff --git a/assets/videos/Omega.mp4 b/assets/videos/Omega.mp4
new file mode 100755
index 00000000..f1e56cb9
Binary files /dev/null and b/assets/videos/Omega.mp4 differ
diff --git a/assets/videos/Rolex.mp4 b/assets/videos/Rolex.mp4
new file mode 100755
index 00000000..598f2fd8
Binary files /dev/null and b/assets/videos/Rolex.mp4 differ
diff --git a/assets/videos/Zenith.mp4 b/assets/videos/Zenith.mp4
new file mode 100755
index 00000000..8231259f
Binary files /dev/null and b/assets/videos/Zenith.mp4 differ